diff --git a/v.c b/v.c index 4e6da5b..882bed8 100644 --- a/v.c +++ b/v.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "f9079b670" +#define V_COMMIT_HASH "585cb9ec2" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "9a0f49950" + #define V_COMMIT_HASH "f9079b670" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "f9079b6" + #define V_CURRENT_COMMIT_HASH "585cb9e" #endif // V comptime_definitions: @@ -44,6 +44,7 @@ typedef struct multi_return_ref_v__pref__Preferences_string multi_return_ref_v__ typedef struct multi_return_string_string multi_return_string_string; typedef struct multi_return_u64_u64 multi_return_u64_u64; typedef struct multi_return_f64_int multi_return_f64_int; +typedef struct multi_return_f64_f64 multi_return_f64_f64; typedef struct multi_return_int_int_int multi_return_int_int_int; typedef struct multi_return_int_int_int_int_i64_bool multi_return_int_int_int_int_i64_bool; typedef struct multi_return_Array_string_int multi_return_Array_string_int; @@ -66,8 +67,6 @@ typedef struct multi_return_string_string_string_string multi_return_string_stri typedef struct multi_return_int_string_string_string multi_return_int_string_string_string; typedef struct multi_return_Array_string_Array_string_Array_bool multi_return_Array_string_Array_string_Array_bool; typedef struct multi_return_u64_string multi_return_u64_string; -typedef struct multi_return_i64_i64_i64 multi_return_i64_i64_i64; -typedef struct multi_return_f64_f64 multi_return_f64_f64; // END_multi_return_typedefs typedef struct strconv__BF_param strconv__BF_param; @@ -102,25 +101,19 @@ typedef struct RepIndex RepIndex; typedef union StrIntpMem StrIntpMem; typedef struct StrIntpCgenData StrIntpCgenData; typedef struct StrIntpData StrIntpData; -typedef struct os__File os__File; -typedef struct os__FileInfo os__FileInfo; -typedef struct os__FileNotOpenedError os__FileNotOpenedError; -typedef struct os__SizeOfTypeIs0Error os__SizeOfTypeIs0Error; -typedef struct os__FilePermission os__FilePermission; -typedef struct os__FileMode os__FileMode; -typedef struct os__Result os__Result; -typedef struct os__Command os__Command; -typedef struct os__ExecutableNotFoundError os__ExecutableNotFoundError; -typedef struct os__Uname os__Uname; -typedef struct os__Process os__Process; typedef struct strings__textscanner__TextScanner strings__textscanner__TextScanner; typedef struct v__token__KeywordsMatcher v__token__KeywordsMatcher; typedef struct v__token__WIndex v__token__WIndex; typedef struct v__token__Pos v__token__Pos; typedef struct v__token__Token v__token__Token; +typedef struct time__TimeParseError time__TimeParseError; +typedef struct time__StopWatchOptions time__StopWatchOptions; +typedef struct time__StopWatch time__StopWatch; +typedef struct time__Time time__Time; typedef struct v__dotgraph__DotGraph v__dotgraph__DotGraph; typedef struct v__dotgraph__NewNodeConfig v__dotgraph__NewNodeConfig; typedef struct v__dotgraph__NewEdgeConfig v__dotgraph__NewEdgeConfig; +typedef struct rand__buffer__PRNGBuffer rand__buffer__PRNGBuffer; typedef struct flag__Flag flag__Flag; typedef struct flag__UnkownFlagError flag__UnkownFlagError; typedef struct flag__ArgsCountError flag__ArgsCountError; @@ -133,6 +126,25 @@ typedef struct semver__InvalidComparatorFormatError semver__InvalidComparatorFor typedef struct semver__Version semver__Version; typedef struct semver__EmptyInputError semver__EmptyInputError; typedef struct semver__InvalidVersionFormatError semver__InvalidVersionFormatError; +typedef struct os__File os__File; +typedef struct os__FileInfo os__FileInfo; +typedef struct os__FileNotOpenedError os__FileNotOpenedError; +typedef struct os__SizeOfTypeIs0Error os__SizeOfTypeIs0Error; +typedef struct os__FilePermission os__FilePermission; +typedef struct os__FileMode os__FileMode; +typedef struct os__Result os__Result; +typedef struct os__Command os__Command; +typedef struct os__ExecutableNotFoundError os__ExecutableNotFoundError; +typedef struct os__Uname os__Uname; +typedef struct os__Process os__Process; +typedef struct v__errors__Error v__errors__Error; +typedef struct v__errors__Warning v__errors__Warning; +typedef struct v__errors__Notice v__errors__Notice; +typedef struct v__depgraph__DepGraphNode v__depgraph__DepGraphNode; +typedef struct v__depgraph__DepGraph v__depgraph__DepGraph; +typedef struct v__depgraph__OrderedDepMap v__depgraph__OrderedDepMap; +typedef struct v__depgraph__NodeNames v__depgraph__NodeNames; +typedef struct v__vet__Error v__vet__Error; typedef struct term__Coord term__Coord; typedef struct v__vcache__CacheManager v__vcache__CacheManager; typedef struct v__vmod__Manifest v__vmod__Manifest; @@ -141,28 +153,15 @@ typedef struct v__vmod__Parser v__vmod__Parser; typedef struct v__vmod__Token v__vmod__Token; typedef struct v__vmod__ModFileAndFolder v__vmod__ModFileAndFolder; typedef struct v__vmod__ModFileCacher v__vmod__ModFileCacher; -typedef struct v__errors__Error v__errors__Error; -typedef struct v__errors__Warning v__errors__Warning; -typedef struct v__errors__Notice v__errors__Notice; -typedef struct v__depgraph__DepGraphNode v__depgraph__DepGraphNode; -typedef struct v__depgraph__DepGraph v__depgraph__DepGraph; -typedef struct v__depgraph__OrderedDepMap v__depgraph__OrderedDepMap; -typedef struct v__depgraph__NodeNames v__depgraph__NodeNames; typedef struct v__cflag__CFlag v__cflag__CFlag; -typedef struct math__DigitParams math__DigitParams; -typedef struct math__ChebSeries math__ChebSeries; +typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; +typedef struct rand__config__NormalConfigStruct rand__config__NormalConfigStruct; +typedef struct rand__config__ShuffleConfigStruct rand__config__ShuffleConfigStruct; +typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; typedef struct v__pkgconfig__Main v__pkgconfig__Main; typedef struct v__pkgconfig__MainOptions v__pkgconfig__MainOptions; typedef struct v__pkgconfig__Options v__pkgconfig__Options; typedef struct v__pkgconfig__PkgConfig v__pkgconfig__PkgConfig; -typedef struct v__vet__Error v__vet__Error; -typedef struct time__TimeParseError time__TimeParseError; -typedef struct time__StopWatchOptions time__StopWatchOptions; -typedef struct time__StopWatch time__StopWatch; -typedef struct time__Time time__Time; -typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; -typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; -typedef struct rand__ShuffleConfigStruct rand__ShuffleConfigStruct; typedef struct v__pref__Preferences v__pref__Preferences; typedef struct sync__Subscription sync__Subscription; typedef struct sync__Channel sync__Channel; @@ -345,29 +344,30 @@ typedef struct _option_i64 _option_i64; typedef struct _option_rune _option_rune; typedef struct _option_string _option_string; typedef struct _option_u8 _option_u8; -typedef struct _option_os__File _option_os__File; -typedef struct _option_FILE_ptr _option_FILE_ptr; -typedef struct _option_void _option_void; -typedef struct _option_Array_u8 _option_Array_u8; -typedef struct _option_Array_string _option_Array_string; -typedef struct _option_bool _option_bool; -typedef struct _option_os__SignalHandler _option_os__SignalHandler; typedef struct _option_v__token__Kind _option_v__token__Kind; +typedef struct _option_time__Time _option_time__Time; +typedef struct _option_multi_return_int_int_int _option_multi_return_int_int_int; +typedef struct _option_multi_return_int_int_int_int_i64_bool _option_multi_return_int_int_int_int_i64_bool; +typedef struct _option_bool _option_bool; +typedef struct _option_void _option_void; typedef struct _option_flag__Flag _option_flag__Flag; +typedef struct _option_Array_string _option_Array_string; typedef struct _option_semver__Range _option_semver__Range; typedef struct _option_semver__Version _option_semver__Version; typedef struct _option_semver__ComparatorSet _option_semver__ComparatorSet; typedef struct _option_semver__Comparator _option_semver__Comparator; +typedef struct _option_os__File _option_os__File; +typedef struct _option_FILE_ptr _option_FILE_ptr; +typedef struct _option_Array_u8 _option_Array_u8; +typedef struct _option_os__SignalHandler _option_os__SignalHandler; typedef struct _option_term__Coord _option_term__Coord; typedef struct _option_v__vmod__Manifest _option_v__vmod__Manifest; typedef struct _option_multi_return_Array_string_int _option_multi_return_Array_string_int; typedef struct _option_v__pkgconfig__PkgConfig_ptr _option_v__pkgconfig__PkgConfig_ptr; typedef struct _option_v__pkgconfig__Main_ptr _option_v__pkgconfig__Main_ptr; -typedef struct _option_time__Time _option_time__Time; -typedef struct _option_multi_return_int_int_int _option_multi_return_int_int_int; -typedef struct _option_multi_return_int_int_int_int_i64_bool _option_multi_return_int_int_int_int_i64_bool; typedef struct _option_u32 _option_u32; typedef struct _option_f32 _option_f32; +typedef struct _option_multi_return_f64_f64 _option_multi_return_f64_f64; typedef struct _option_v__pref__OS _option_v__pref__OS; typedef struct _option_v__pref__Arch _option_v__pref__Arch; typedef struct _option_v__pref__Backend _option_v__pref__Backend; @@ -1023,174 +1023,46 @@ static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; -// added by module `os`, file: os.c.v:3: +// added by module `time`, file: time.c.v:6: #if defined(__has_include) -#if __has_include() -#include +#if __has_include() +#include #else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. #endif #else -#include +#include #endif -// added by module `os`, file: os.c.v:4: +// added by module `time`, file: time_nix.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time_nix.c.v:7: #include - - -// added by module `os`, file: os_nix.c.v:5: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `os`, file: os_nix.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `os`, file: os_nix.c.v:7: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `os`, file: os_nix.c.v:8: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `os`, file: os_nix.c.v:9: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `os`, file: os_nix.c.v:10: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -#if !defined(__sun) && !defined(__HAIKU__) -// added by module `os`, file: os_nix.c.v:12: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - -#endif // $if !defined(__sun) && !defined(__HAIKU__) - - - - -// added by module `os`, file: signal.c.v:3: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - #if defined(_WIN32) // inserted by module `sync.stdatomic`, file: 1.declarations.c.v:8: /* @@ -1564,9 +1436,8 @@ static inline int atomic_compare_exchange_strong_u16(unsigned short* object, uns #if 1 // inserted by module `sync.stdatomic`, file: 1.declarations.c.v:11: /* - Compability header for stdatomic.h that works for all compilers supported - by V. For TCC libatomic from the operating system is used - + Compatibility header for stdatomic.h that works for all compilers supported by V. + For TCC, we use libatomic from the OS. */ #ifndef __ATOMIC_H #define __ATOMIC_H @@ -2002,6 +1873,176 @@ static inline unsigned char atomic_fetch_xor_byte(unsigned char* x, unsigned cha #endif // $if 1 +// added by module `os`, file: os.c.v:3: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os.c.v:4: +#include + + + + +// added by module `os`, file: os_nix.c.v:5: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os_nix.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os_nix.c.v:7: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os_nix.c.v:8: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os_nix.c.v:9: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `os`, file: os_nix.c.v:10: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +#if !defined(__sun) && !defined(__HAIKU__) +// added by module `os`, file: os_nix.c.v:12: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + +#endif // $if !defined(__sun) && !defined(__HAIKU__) + + + + +// added by module `os`, file: signal.c.v:3: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `os` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + // added by module `term`, file: term_nix.c.v:5: #if defined(__has_include) @@ -2038,66 +2079,6 @@ static inline unsigned char atomic_fetch_xor_byte(unsigned char* x, unsigned cha -// added by module `math`, file: math.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `math` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_nix.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_nix.c.v:7: -#include - - - - // added by module `sync`, file: sync_default.c.v:14: #if defined(__has_include) @@ -2184,74 +2165,6 @@ typedef enum { StrIntpType__si_vp, // 0+18 } StrIntpType; -typedef enum { - os__SeekMode__start, // - os__SeekMode__current, // +1 - os__SeekMode__end, // +2 -} os__SeekMode; - -typedef enum { - os__FileType__regular, // - os__FileType__directory, // +1 - os__FileType__character_device, // +2 - os__FileType__block_device, // +3 - os__FileType__fifo, // +4 - os__FileType__symbolic_link, // +5 - os__FileType__socket, // +6 -} os__FileType; - -typedef enum { - os__GlobMatch__exact, // - os__GlobMatch__ends_with, // +1 - os__GlobMatch__starts_with, // +2 - os__GlobMatch__start_and_ends_with, // +3 - os__GlobMatch__contains, // +4 - os__GlobMatch__any, // +5 -} os__GlobMatch; - -typedef enum { - os__ProcessState__not_started, // - os__ProcessState__running, // +1 - os__ProcessState__stopped, // +2 - os__ProcessState__exited, // +3 - os__ProcessState__aborted, // +4 - os__ProcessState__closed, // +5 -} os__ProcessState; - -typedef enum { - os__Signal__hup = 1, // 1 - os__Signal__int = 2, // 2 - os__Signal__quit = 3, // 3 - os__Signal__ill = 4, // 4 - os__Signal__trap = 5, // 5 - os__Signal__abrt = 6, // 6 - os__Signal__bus = 7, // 7 - os__Signal__fpe = 8, // 8 - os__Signal__kill = 9, // 9 - os__Signal__usr1 = 10, // 10 - os__Signal__segv = 11, // 11 - os__Signal__usr2 = 12, // 12 - os__Signal__pipe = 13, // 13 - os__Signal__alrm = 14, // 14 - os__Signal__term = 15, // 15 - os__Signal__stkflt = 16, // 16 - os__Signal__chld = 17, // 17 - os__Signal__cont = 18, // 18 - os__Signal__stop = 19, // 19 - os__Signal__tstp = 20, // 20 - os__Signal__ttin = 21, // 21 - os__Signal__ttou = 22, // 22 - os__Signal__urg = 23, // 23 - os__Signal__xcpu = 24, // 24 - os__Signal__xfsz = 25, // 25 - os__Signal__vtalrm = 26, // 26 - os__Signal__prof = 27, // 27 - os__Signal__winch = 28, // 28 - os__Signal__poll = 29, // 29 - os__Signal__pwr = 30, // 30 - os__Signal__sys = 31, // 31 -} os__Signal; - typedef enum { v__token__Kind__unknown, // v__token__Kind__eof, // +1 @@ -2401,60 +2314,6 @@ typedef enum { v__token__Precedence__index, // +10 } v__token__Precedence; -typedef enum { - semver__Operator__gt, // - semver__Operator__lt, // +1 - semver__Operator__ge, // +2 - semver__Operator__le, // +3 - semver__Operator__eq, // +4 -} semver__Operator; - -typedef enum { - semver__Increment__major, // - semver__Increment__minor, // +1 - semver__Increment__patch, // +2 -} semver__Increment; - -typedef enum { - v__vmod__TokenKind__module_keyword, // - v__vmod__TokenKind__field_key, // +1 - v__vmod__TokenKind__lcbr, // +2 - v__vmod__TokenKind__rcbr, // +3 - v__vmod__TokenKind__labr, // +4 - v__vmod__TokenKind__rabr, // +5 - v__vmod__TokenKind__comma, // +6 - v__vmod__TokenKind__colon, // +7 - v__vmod__TokenKind__eof, // +8 - v__vmod__TokenKind__str, // +9 - v__vmod__TokenKind__ident, // +10 - v__vmod__TokenKind__unknown, // +11 -} v__vmod__TokenKind; - -typedef enum { - v__errors__Reporter__scanner, // - v__errors__Reporter__parser, // +1 - v__errors__Reporter__checker, // +2 - v__errors__Reporter__builder, // +3 - v__errors__Reporter__gen, // +4 -} v__errors__Reporter; - -typedef enum { - v__vet__ErrorKind__error, // - v__vet__ErrorKind__warning, // +1 -} v__vet__ErrorKind; - -typedef enum { - v__vet__FixKind__unknown, // - v__vet__FixKind__doc, // +1 - v__vet__FixKind__vfmt, // +2 -} v__vet__FixKind; - -typedef enum { - v__vet__ErrorType__default, // - v__vet__ErrorType__space_indent, // +1 - v__vet__ErrorType__trailing_space, // +2 -} v__vet__ErrorType; - typedef enum { time__FormatTime__hhmm12, // time__FormatTime__hhmm24, // +1 @@ -2487,6 +2346,128 @@ typedef enum { time__FormatDelimiter__no_delimiter, // +4 } time__FormatDelimiter; +typedef enum { + semver__Operator__gt, // + semver__Operator__lt, // +1 + semver__Operator__ge, // +2 + semver__Operator__le, // +3 + semver__Operator__eq, // +4 +} semver__Operator; + +typedef enum { + semver__Increment__major, // + semver__Increment__minor, // +1 + semver__Increment__patch, // +2 +} semver__Increment; + +typedef enum { + os__SeekMode__start, // + os__SeekMode__current, // +1 + os__SeekMode__end, // +2 +} os__SeekMode; + +typedef enum { + os__FileType__regular, // + os__FileType__directory, // +1 + os__FileType__character_device, // +2 + os__FileType__block_device, // +3 + os__FileType__fifo, // +4 + os__FileType__symbolic_link, // +5 + os__FileType__socket, // +6 +} os__FileType; + +typedef enum { + os__GlobMatch__exact, // + os__GlobMatch__ends_with, // +1 + os__GlobMatch__starts_with, // +2 + os__GlobMatch__start_and_ends_with, // +3 + os__GlobMatch__contains, // +4 + os__GlobMatch__any, // +5 +} os__GlobMatch; + +typedef enum { + os__ProcessState__not_started, // + os__ProcessState__running, // +1 + os__ProcessState__stopped, // +2 + os__ProcessState__exited, // +3 + os__ProcessState__aborted, // +4 + os__ProcessState__closed, // +5 +} os__ProcessState; + +typedef enum { + os__Signal__hup = 1, // 1 + os__Signal__int = 2, // 2 + os__Signal__quit = 3, // 3 + os__Signal__ill = 4, // 4 + os__Signal__trap = 5, // 5 + os__Signal__abrt = 6, // 6 + os__Signal__bus = 7, // 7 + os__Signal__fpe = 8, // 8 + os__Signal__kill = 9, // 9 + os__Signal__usr1 = 10, // 10 + os__Signal__segv = 11, // 11 + os__Signal__usr2 = 12, // 12 + os__Signal__pipe = 13, // 13 + os__Signal__alrm = 14, // 14 + os__Signal__term = 15, // 15 + os__Signal__stkflt = 16, // 16 + os__Signal__chld = 17, // 17 + os__Signal__cont = 18, // 18 + os__Signal__stop = 19, // 19 + os__Signal__tstp = 20, // 20 + os__Signal__ttin = 21, // 21 + os__Signal__ttou = 22, // 22 + os__Signal__urg = 23, // 23 + os__Signal__xcpu = 24, // 24 + os__Signal__xfsz = 25, // 25 + os__Signal__vtalrm = 26, // 26 + os__Signal__prof = 27, // 27 + os__Signal__winch = 28, // 28 + os__Signal__poll = 29, // 29 + os__Signal__pwr = 30, // 30 + os__Signal__sys = 31, // 31 +} os__Signal; + +typedef enum { + v__errors__Reporter__scanner, // + v__errors__Reporter__parser, // +1 + v__errors__Reporter__checker, // +2 + v__errors__Reporter__builder, // +3 + v__errors__Reporter__gen, // +4 +} v__errors__Reporter; + +typedef enum { + v__vet__ErrorKind__error, // + v__vet__ErrorKind__warning, // +1 +} v__vet__ErrorKind; + +typedef enum { + v__vet__FixKind__unknown, // + v__vet__FixKind__doc, // +1 + v__vet__FixKind__vfmt, // +2 +} v__vet__FixKind; + +typedef enum { + v__vet__ErrorType__default, // + v__vet__ErrorType__space_indent, // +1 + v__vet__ErrorType__trailing_space, // +2 +} v__vet__ErrorType; + +typedef enum { + v__vmod__TokenKind__module_keyword, // + v__vmod__TokenKind__field_key, // +1 + v__vmod__TokenKind__lcbr, // +2 + v__vmod__TokenKind__rcbr, // +3 + v__vmod__TokenKind__labr, // +4 + v__vmod__TokenKind__rabr, // +5 + v__vmod__TokenKind__comma, // +6 + v__vmod__TokenKind__colon, // +7 + v__vmod__TokenKind__eof, // +8 + v__vmod__TokenKind__str, // +9 + v__vmod__TokenKind__ident, // +10 + v__vmod__TokenKind__unknown, // +11 +} v__vmod__TokenKind; + typedef enum { v__pref__OS___auto, // v__pref__OS__ios, // +1 @@ -2728,28 +2709,6 @@ typedef enum { 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 - v__gen__c__StrIntpType__si_u8, // 0+2 - v__gen__c__StrIntpType__si_i8, // 0+3 - v__gen__c__StrIntpType__si_u16, // 0+4 - v__gen__c__StrIntpType__si_i16, // 0+5 - v__gen__c__StrIntpType__si_u32, // 0+6 - v__gen__c__StrIntpType__si_i32, // 0+7 - v__gen__c__StrIntpType__si_u64, // 0+8 - v__gen__c__StrIntpType__si_i64, // 0+9 - v__gen__c__StrIntpType__si_e32, // 0+10 - v__gen__c__StrIntpType__si_e64, // 0+11 - v__gen__c__StrIntpType__si_f32, // 0+12 - v__gen__c__StrIntpType__si_f64, // 0+13 - v__gen__c__StrIntpType__si_g32, // 0+14 - v__gen__c__StrIntpType__si_g64, // 0+15 - v__gen__c__StrIntpType__si_s, // 0+16 - v__gen__c__StrIntpType__si_p, // 0+17 - v__gen__c__StrIntpType__si_vp, // 0+18 -} v__gen__c__StrIntpType; - typedef enum { v__gen__c__SqlExprSide__left, // v__gen__c__SqlExprSide__right, // +1 @@ -2784,15 +2743,15 @@ struct IError { None__* _None__; Error* _Error; MessageError* _MessageError; - os__FileNotOpenedError* _os__FileNotOpenedError; - os__SizeOfTypeIs0Error* _os__SizeOfTypeIs0Error; - os__ExecutableNotFoundError* _os__ExecutableNotFoundError; + time__TimeParseError* _time__TimeParseError; flag__UnkownFlagError* _flag__UnkownFlagError; flag__ArgsCountError* _flag__ArgsCountError; semver__InvalidComparatorFormatError* _semver__InvalidComparatorFormatError; semver__EmptyInputError* _semver__EmptyInputError; semver__InvalidVersionFormatError* _semver__InvalidVersionFormatError; - time__TimeParseError* _time__TimeParseError; + os__FileNotOpenedError* _os__FileNotOpenedError; + os__SizeOfTypeIs0Error* _os__SizeOfTypeIs0Error; + os__ExecutableNotFoundError* _os__ExecutableNotFoundError; v__gen__c__UnsupportedAssertCtempTransform* _v__gen__c__UnsupportedAssertCtempTransform; }; int _typ; @@ -2977,12 +2936,12 @@ typedef map Map_int_bool; typedef array Array_v__gen__c__ProfileCounterMeta; typedef array Array_v__ast__InfixExpr; typedef array Array_v__ast__TypeSymbol; -typedef array Array_f64; typedef array Array_v__token__Token; typedef array Array_sync__Channel_ptr; typedef array Array_sync__Direction; typedef array Array_sync__Subscription; typedef array Array_flag__Flag; +typedef array Array_f64; typedef array Array_semver__Comparator; typedef array Array_semver__ComparatorSet; typedef u8 Array_fixed_u8_5 [5]; @@ -2994,11 +2953,11 @@ typedef voidptr Array_fixed_voidptr_100 [100]; typedef u8 Array_fixed_u8_1000 [1000]; typedef u8 Array_fixed_u8_17 [17]; typedef array Array_StrIntpType; +typedef array Array_v__token__Kind; typedef u8 Array_fixed_u8_1024 [1024]; typedef u8 Array_fixed_u8_4096 [4096]; typedef array Array_os__ProcessState; typedef int Array_fixed_int_6 [6]; -typedef array Array_v__token__Kind; typedef u8 Array_fixed_u8_50 [50]; typedef array Array_v__vmod__TokenKind; typedef array Array_v__pref__Backend; @@ -3155,9 +3114,9 @@ struct v__vmod__ModFileAndFolder { // Union sum type v__ast__TypeDecl = -// | 242 = v__ast__AliasTypeDecl -// | 243 = v__ast__FnTypeDecl -// | 244 = v__ast__SumTypeDecl +// | 244 = v__ast__AliasTypeDecl +// | 245 = v__ast__FnTypeDecl +// | 246 = v__ast__SumTypeDecl struct v__ast__TypeDecl { union { v__ast__AliasTypeDecl* _v__ast__AliasTypeDecl; @@ -3173,57 +3132,57 @@ struct v__ast__TypeDecl { // Union sum type v__ast__Expr = -// | 246 = v__ast__AnonFn -// | 247 = v__ast__ArrayDecompose -// | 248 = v__ast__ArrayInit -// | 249 = v__ast__AsCast -// | 250 = v__ast__Assoc -// | 251 = v__ast__AtExpr -// | 252 = v__ast__BoolLiteral -// | 253 = v__ast__CTempVar -// | 254 = v__ast__CallExpr -// | 255 = v__ast__CastExpr -// | 256 = v__ast__ChanInit -// | 257 = v__ast__CharLiteral -// | 258 = v__ast__Comment -// | 259 = v__ast__ComptimeCall -// | 260 = v__ast__ComptimeSelector -// | 261 = v__ast__ComptimeType -// | 262 = v__ast__ConcatExpr -// | 263 = v__ast__DumpExpr -// | 264 = v__ast__EmptyExpr -// | 265 = v__ast__EnumVal -// | 266 = v__ast__FloatLiteral -// | 267 = v__ast__GoExpr -// | 268 = v__ast__Ident -// | 269 = v__ast__IfExpr -// | 270 = v__ast__IfGuardExpr -// | 271 = v__ast__IndexExpr -// | 272 = v__ast__InfixExpr -// | 273 = v__ast__IntegerLiteral -// | 274 = v__ast__IsRefType -// | 275 = v__ast__Likely -// | 276 = v__ast__LockExpr -// | 277 = v__ast__MapInit -// | 278 = v__ast__MatchExpr -// | 279 = v__ast__NodeError -// | 280 = v__ast__None -// | 281 = v__ast__OffsetOf -// | 282 = v__ast__OrExpr -// | 283 = v__ast__ParExpr -// | 284 = v__ast__PostfixExpr -// | 285 = v__ast__PrefixExpr -// | 286 = v__ast__RangeExpr -// | 287 = v__ast__SelectExpr -// | 288 = v__ast__SelectorExpr -// | 289 = v__ast__SizeOf -// | 290 = v__ast__SqlExpr -// | 291 = v__ast__StringInterLiteral -// | 292 = v__ast__StringLiteral -// | 293 = v__ast__StructInit -// | 294 = v__ast__TypeNode -// | 295 = v__ast__TypeOf -// | 296 = v__ast__UnsafeExpr +// | 248 = v__ast__AnonFn +// | 249 = v__ast__ArrayDecompose +// | 250 = v__ast__ArrayInit +// | 251 = v__ast__AsCast +// | 252 = v__ast__Assoc +// | 253 = v__ast__AtExpr +// | 254 = v__ast__BoolLiteral +// | 255 = v__ast__CTempVar +// | 256 = v__ast__CallExpr +// | 257 = v__ast__CastExpr +// | 258 = v__ast__ChanInit +// | 259 = v__ast__CharLiteral +// | 260 = v__ast__Comment +// | 261 = v__ast__ComptimeCall +// | 262 = v__ast__ComptimeSelector +// | 263 = v__ast__ComptimeType +// | 264 = v__ast__ConcatExpr +// | 265 = v__ast__DumpExpr +// | 266 = v__ast__EmptyExpr +// | 267 = v__ast__EnumVal +// | 268 = v__ast__FloatLiteral +// | 269 = v__ast__GoExpr +// | 270 = v__ast__Ident +// | 271 = v__ast__IfExpr +// | 272 = v__ast__IfGuardExpr +// | 273 = v__ast__IndexExpr +// | 274 = v__ast__InfixExpr +// | 275 = v__ast__IntegerLiteral +// | 276 = v__ast__IsRefType +// | 277 = v__ast__Likely +// | 278 = v__ast__LockExpr +// | 279 = v__ast__MapInit +// | 280 = v__ast__MatchExpr +// | 281 = v__ast__NodeError +// | 282 = v__ast__None +// | 283 = v__ast__OffsetOf +// | 284 = v__ast__OrExpr +// | 285 = v__ast__ParExpr +// | 286 = v__ast__PostfixExpr +// | 287 = v__ast__PrefixExpr +// | 288 = v__ast__RangeExpr +// | 289 = v__ast__SelectExpr +// | 290 = v__ast__SelectorExpr +// | 291 = v__ast__SizeOf +// | 292 = v__ast__SqlExpr +// | 293 = v__ast__StringInterLiteral +// | 294 = v__ast__StringLiteral +// | 295 = v__ast__StructInit +// | 296 = v__ast__TypeNode +// | 297 = v__ast__TypeOf +// | 298 = v__ast__UnsafeExpr struct v__ast__Expr { union { v__ast__AnonFn* _v__ast__AnonFn; @@ -3283,33 +3242,33 @@ struct v__ast__Expr { // Union sum type v__ast__Stmt = -// | 298 = v__ast__AsmStmt -// | 299 = v__ast__AssertStmt -// | 300 = v__ast__AssignStmt -// | 301 = v__ast__Block -// | 302 = v__ast__BranchStmt -// | 303 = v__ast__ComptimeFor -// | 304 = v__ast__ConstDecl -// | 305 = v__ast__DeferStmt -// | 306 = v__ast__EmptyStmt -// | 307 = v__ast__EnumDecl -// | 308 = v__ast__ExprStmt +// | 300 = v__ast__AsmStmt +// | 301 = v__ast__AssertStmt +// | 302 = v__ast__AssignStmt +// | 303 = v__ast__Block +// | 304 = v__ast__BranchStmt +// | 305 = v__ast__ComptimeFor +// | 306 = v__ast__ConstDecl +// | 307 = v__ast__DeferStmt +// | 308 = v__ast__EmptyStmt +// | 309 = v__ast__EnumDecl +// | 310 = v__ast__ExprStmt // | 185 = v__ast__FnDecl -// | 309 = v__ast__ForCStmt -// | 310 = v__ast__ForInStmt -// | 311 = v__ast__ForStmt -// | 312 = v__ast__GlobalDecl -// | 313 = v__ast__GotoLabel -// | 314 = v__ast__GotoStmt -// | 315 = v__ast__HashStmt -// | 316 = v__ast__Import -// | 317 = v__ast__InterfaceDecl -// | 318 = v__ast__Module -// | 279 = v__ast__NodeError -// | 319 = v__ast__Return -// | 320 = v__ast__SqlStmt -// | 321 = v__ast__StructDecl -// | 245 = v__ast__TypeDecl +// | 311 = v__ast__ForCStmt +// | 312 = v__ast__ForInStmt +// | 313 = v__ast__ForStmt +// | 314 = v__ast__GlobalDecl +// | 315 = v__ast__GotoLabel +// | 316 = v__ast__GotoStmt +// | 317 = v__ast__HashStmt +// | 318 = v__ast__Import +// | 319 = v__ast__InterfaceDecl +// | 320 = v__ast__Module +// | 281 = v__ast__NodeError +// | 321 = v__ast__Return +// | 322 = v__ast__SqlStmt +// | 323 = v__ast__StructDecl +// | 247 = v__ast__TypeDecl struct v__ast__Stmt { union { v__ast__AsmStmt* _v__ast__AsmStmt; @@ -3346,10 +3305,10 @@ struct v__ast__Stmt { // Union sum type v__ast__ScopeObject = -// | 323 = v__ast__AsmRegister -// | 324 = v__ast__ConstField -// | 325 = v__ast__GlobalField -// | 326 = v__ast__Var +// | 325 = v__ast__AsmRegister +// | 326 = v__ast__ConstField +// | 327 = v__ast__GlobalField +// | 328 = v__ast__Var struct v__ast__ScopeObject { union { v__ast__AsmRegister* _v__ast__AsmRegister; @@ -3364,22 +3323,22 @@ struct v__ast__ScopeObject { // Union sum type v__ast__Node = -// | 328 = v__ast__CallArg -// | 324 = v__ast__ConstField -// | 329 = v__ast__EmptyNode -// | 330 = v__ast__EnumField -// | 297 = v__ast__Expr +// | 330 = v__ast__CallArg +// | 326 = v__ast__ConstField +// | 331 = v__ast__EmptyNode +// | 332 = v__ast__EnumField +// | 299 = v__ast__Expr // | 176 = v__ast__File -// | 325 = v__ast__GlobalField -// | 331 = v__ast__IfBranch -// | 332 = v__ast__MatchBranch -// | 279 = v__ast__NodeError -// | 333 = v__ast__Param -// | 327 = v__ast__ScopeObject -// | 334 = v__ast__SelectBranch -// | 322 = v__ast__Stmt -// | 335 = v__ast__StructField -// | 336 = v__ast__StructInitField +// | 327 = v__ast__GlobalField +// | 333 = v__ast__IfBranch +// | 334 = v__ast__MatchBranch +// | 281 = v__ast__NodeError +// | 335 = v__ast__Param +// | 329 = v__ast__ScopeObject +// | 336 = v__ast__SelectBranch +// | 324 = v__ast__Stmt +// | 337 = v__ast__StructField +// | 338 = v__ast__StructInitField struct v__ast__Node { union { v__ast__CallArg* _v__ast__CallArg; @@ -3404,7 +3363,7 @@ struct v__ast__Node { // Union sum type v__ast__ComptTimeConstValue = -// | 264 = v__ast__EmptyExpr +// | 266 = v__ast__EmptyExpr // | 15 = f32 // | 16 = f64 // | 6 = i16 @@ -3438,8 +3397,8 @@ struct v__ast__ComptTimeConstValue { // Union sum type v__ast__IdentInfo = -// | 377 = v__ast__IdentFn -// | 378 = v__ast__IdentVar +// | 379 = v__ast__IdentFn +// | 380 = v__ast__IdentVar struct v__ast__IdentInfo { union { v__ast__IdentFn* _v__ast__IdentFn; @@ -3450,14 +3409,14 @@ struct v__ast__IdentInfo { // Union sum type v__ast__AsmArg = -// | 398 = v__ast__AsmAddressing -// | 399 = v__ast__AsmAlias -// | 400 = v__ast__AsmDisp -// | 323 = v__ast__AsmRegister -// | 252 = v__ast__BoolLiteral -// | 257 = v__ast__CharLiteral -// | 266 = v__ast__FloatLiteral -// | 273 = v__ast__IntegerLiteral +// | 400 = v__ast__AsmAddressing +// | 401 = v__ast__AsmAlias +// | 402 = v__ast__AsmDisp +// | 325 = v__ast__AsmRegister +// | 254 = v__ast__BoolLiteral +// | 259 = v__ast__CharLiteral +// | 268 = v__ast__FloatLiteral +// | 275 = v__ast__IntegerLiteral // | 20 = string struct v__ast__AsmArg { union { @@ -3476,20 +3435,20 @@ struct v__ast__AsmArg { // Union sum type v__ast__TypeInfo = -// | 431 = v__ast__Aggregate -// | 433 = v__ast__Alias -// | 413 = v__ast__Array -// | 441 = v__ast__ArrayFixed -// | 442 = v__ast__Chan -// | 447 = v__ast__Enum -// | 445 = v__ast__FnType -// | 446 = v__ast__GenericInst -// | 436 = v__ast__Interface -// | 414 = v__ast__Map -// | 444 = v__ast__MultiReturn -// | 418 = v__ast__Struct -// | 437 = v__ast__SumType -// | 443 = v__ast__Thread +// | 433 = v__ast__Aggregate +// | 435 = v__ast__Alias +// | 415 = v__ast__Array +// | 443 = v__ast__ArrayFixed +// | 444 = v__ast__Chan +// | 449 = v__ast__Enum +// | 447 = v__ast__FnType +// | 448 = v__ast__GenericInst +// | 438 = v__ast__Interface +// | 416 = v__ast__Map +// | 446 = v__ast__MultiReturn +// | 420 = v__ast__Struct +// | 439 = v__ast__SumType +// | 445 = v__ast__Thread struct v__ast__TypeInfo { union { v__ast__Aggregate* _v__ast__Aggregate; @@ -3977,7 +3936,14 @@ struct strings__textscanner__TextScanner { -struct rand__ShuffleConfigStruct { +struct rand__config__NormalConfigStruct { + f64 mu; + f64 sigma; +}; + + + +struct rand__config__ShuffleConfigStruct { int start; int end; }; @@ -3990,14 +3956,6 @@ struct rand__config__PRNGConfigStruct { -struct rand__wyrand__WyRandRNG { - u64 state; - int bytes_left; - u64 buffer; -}; - - - struct v__token__WIndex { string word; int index; @@ -4464,18 +4422,9 @@ struct v__gen__c__GenSafeIntegerCfg { -struct math__DigitParams { - int base; - bool reverse; -}; - - - -struct math__ChebSeries { - Array_f64 c; - int order; - f64 a; - f64 b; +struct rand__buffer__PRNGBuffer { + int bytes_left; + u64 buffer; }; @@ -4688,6 +4637,8 @@ struct v__pref__Preferences { string test_runner; string profile_file; string dump_c_flags; + string dump_modules; + string dump_files; string cflags; string ccompiler; string third_party_option; @@ -4813,6 +4764,15 @@ struct v__errors__Error { +struct rand__wyrand__WyRandRNG { + rand__buffer__PRNGBuffer PRNGBuffer; + u64 state; + int bytes_left; + u64 buffer; +}; + + + struct v__token__KeywordsMatcher { int len_min; int len_max; @@ -6666,6 +6626,11 @@ struct multi_return_f64_int { int arg1; }; +struct multi_return_f64_f64 { + f64 arg0; + f64 arg1; +}; + struct multi_return_int_int_int { int arg0; int arg1; @@ -6791,17 +6756,6 @@ struct multi_return_u64_string { string arg1; }; -struct multi_return_i64_i64_i64 { - i64 arg0; - i64 arg1; - i64 arg2; -}; - -struct multi_return_f64_f64 { - f64 arg0; - f64 arg1; -}; - // END_multi_return_structs @@ -6877,34 +6831,28 @@ struct _option_u8 { byte data[sizeof(u8) > 0 ? sizeof(u8) : 1]; }; -struct _option_os__File { +struct _option_v__token__Kind { byte state; IError err; - byte data[sizeof(os__File) > 0 ? sizeof(os__File) : 1]; + byte data[sizeof(v__token__Kind) > 0 ? sizeof(v__token__Kind) : 1]; }; -struct _option_FILE_ptr { +struct _option_time__Time { byte state; IError err; - byte data[sizeof(FILE*) > 0 ? sizeof(FILE*) : 1]; + byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; }; -struct _option_void { +struct _option_multi_return_int_int_int { byte state; IError err; - byte data[sizeof(u8) > 0 ? sizeof(u8) : 1]; + byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; }; -struct _option_Array_u8 { +struct _option_multi_return_int_int_int_int_i64_bool { byte state; IError err; - byte data[sizeof(Array_u8) > 0 ? sizeof(Array_u8) : 1]; -}; - -struct _option_Array_string { - byte state; - IError err; - byte data[sizeof(Array_string) > 0 ? sizeof(Array_string) : 1]; + byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; }; struct _option_bool { @@ -6913,16 +6861,10 @@ struct _option_bool { byte data[sizeof(bool) > 0 ? sizeof(bool) : 1]; }; -struct _option_os__SignalHandler { +struct _option_void { byte state; IError err; - byte data[sizeof(os__SignalHandler) > 0 ? sizeof(os__SignalHandler) : 1]; -}; - -struct _option_v__token__Kind { - byte state; - IError err; - byte data[sizeof(v__token__Kind) > 0 ? sizeof(v__token__Kind) : 1]; + byte data[sizeof(u8) > 0 ? sizeof(u8) : 1]; }; struct _option_flag__Flag { @@ -6931,6 +6873,12 @@ struct _option_flag__Flag { byte data[sizeof(flag__Flag) > 0 ? sizeof(flag__Flag) : 1]; }; +struct _option_Array_string { + byte state; + IError err; + byte data[sizeof(Array_string) > 0 ? sizeof(Array_string) : 1]; +}; + struct _option_semver__Range { byte state; IError err; @@ -6955,6 +6903,30 @@ struct _option_semver__Comparator { byte data[sizeof(semver__Comparator) > 0 ? sizeof(semver__Comparator) : 1]; }; +struct _option_os__File { + byte state; + IError err; + byte data[sizeof(os__File) > 0 ? sizeof(os__File) : 1]; +}; + +struct _option_FILE_ptr { + byte state; + IError err; + byte data[sizeof(FILE*) > 0 ? sizeof(FILE*) : 1]; +}; + +struct _option_Array_u8 { + byte state; + IError err; + byte data[sizeof(Array_u8) > 0 ? sizeof(Array_u8) : 1]; +}; + +struct _option_os__SignalHandler { + byte state; + IError err; + byte data[sizeof(os__SignalHandler) > 0 ? sizeof(os__SignalHandler) : 1]; +}; + struct _option_term__Coord { byte state; IError err; @@ -6985,24 +6957,6 @@ struct _option_v__pkgconfig__Main_ptr { byte data[sizeof(v__pkgconfig__Main*) > 0 ? sizeof(v__pkgconfig__Main*) : 1]; }; -struct _option_time__Time { - byte state; - IError err; - byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; -}; - -struct _option_multi_return_int_int_int { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; -}; - -struct _option_multi_return_int_int_int_int_i64_bool { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; -}; - struct _option_u32 { byte state; IError err; @@ -7015,6 +6969,12 @@ struct _option_f32 { byte data[sizeof(f32) > 0 ? sizeof(f32) : 1]; }; +struct _option_multi_return_f64_f64 { + byte state; + IError err; + byte data[sizeof(multi_return_f64_f64) > 0 ? sizeof(multi_return_f64_f64) : 1]; +}; + struct _option_v__pref__OS { byte state; IError err; @@ -7685,7 +7645,7 @@ IError _const_none__; // inited later VV_LOCAL_SYMBOL string None___str(None__ _d1); IError _v_error(string message); IError error_with_code(string message, int code); -VV_LOCAL_SYMBOL void opt_ok(voidptr data, Option* option, int size); +VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void opt_ok2(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void _result_ok(voidptr data, _result* res, int size); string none_str(none _d2); @@ -7893,6 +7853,328 @@ bool ArrayFlags_all(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_set(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_clear(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag); +strings__textscanner__TextScanner strings__textscanner__new(string input); +void strings__textscanner__TextScanner_free(strings__textscanner__TextScanner* ss); +int strings__textscanner__TextScanner_remaining(strings__textscanner__TextScanner* ss); +int strings__textscanner__TextScanner_next(strings__textscanner__TextScanner* ss); +void strings__textscanner__TextScanner_skip(strings__textscanner__TextScanner* ss); +void strings__textscanner__TextScanner_skip_n(strings__textscanner__TextScanner* ss, int n); +int strings__textscanner__TextScanner_peek(strings__textscanner__TextScanner* ss); +int strings__textscanner__TextScanner_peek_n(strings__textscanner__TextScanner* ss, int n); +void strings__textscanner__TextScanner_back(strings__textscanner__TextScanner* ss); +void strings__textscanner__TextScanner_back_n(strings__textscanner__TextScanner* ss, int n); +int strings__textscanner__TextScanner_peek_back(strings__textscanner__TextScanner* ss); +int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScanner* ss, int n); +int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss); +void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss); +void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss); +Array_string os__cmdline__options(Array_string args, string param); +string os__cmdline__option(Array_string args, string param, string def); +Array_string os__cmdline__options_before(Array_string args, Array_string what); +Array_string os__cmdline__options_after(Array_string args, Array_string what); +Array_string os__cmdline__only_non_options(Array_string args); +Array_string os__cmdline__only_options(Array_string args); +#define _const_v__token__max_keyword_len 20 +v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); +VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { + if (string__lt(a->word, b->word)) return -1; + else return 1; +} + +v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw_map); +VV_LOCAL_SYMBOL void v__token__KeywordsMatcher_add_word(v__token__KeywordsMatcher* km, string word, int kind); +int v__token__KeywordsMatcher_find(v__token__KeywordsMatcher* km, string word); +void v__token__Pos_free(v__token__Pos* p); +string v__token__Pos_line_str(v__token__Pos p); +v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end); +v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line); +void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line); +v__token__Pos v__token__Token_pos(v__token__Token* tok); +Array_v__token__Kind _const_v__token__assign_tokens; // inited later +Array_string _const_v__token__valid_at_tokens; // inited later +Array_string _const_v__token__token_str; // inited later +Map_string_v__token__Kind _const_v__token__keywords; // inited later +v__token__KeywordsMatcher _const_v__token__matcher; // inited later +VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void); +VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void); +bool v__token__is_key(string key); +bool v__token__is_decl(v__token__Kind t); +bool v__token__Kind_is_assign(v__token__Kind t); +string v__token__Kind_str(v__token__Kind t); +string v__token__Token_str(v__token__Token t); +string v__token__Token_debug(v__token__Token t); +Array_v__token__Precedence v__token__build_precedences(void); +Array_v__token__Precedence _const_v__token__precedences; // inited later +int v__token__Token_precedence(v__token__Token tok); +bool v__token__Token_is_scalar(v__token__Token tok); +bool v__token__Token_is_unary(v__token__Token tok); +bool v__token__Kind_is_relational(v__token__Kind tok); +bool v__token__Kind_is_start_of_type(v__token__Kind k); +bool v__token__Kind_is_prefix(v__token__Kind kind); +bool v__token__Kind_is_infix(v__token__Kind kind); +bool v__token__Kind_is_postfix(v__token__Kind kind); +string v__token__kind_to_string(v__token__Kind k); +_option_v__token__Kind v__token__kind_from_string(string s); +int v__mathutil__min_T_int(int a, int b); +int v__mathutil__max_T_int(int a, int b); +i64 time__portable_timegm(struct tm* t); +int time__days_from_civil(int oy, int m, int d); +string time__Time_format(time__Time t); +string time__Time_format_ss(time__Time t); +string time__Time_format_ss_milli(time__Time t); +string time__Time_format_ss_micro(time__Time t); +string time__Time_hhmm(time__Time t); +string time__Time_hhmmss(time__Time t); +string time__Time_hhmm12(time__Time t); +string time__Time_ymmdd(time__Time t); +string time__Time_ddmmy(time__Time t); +string time__Time_md(time__Time t); +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +string time__Time_custom_format(time__Time t, string s); +string time__Time_clean(time__Time t); +string time__Time_clean12(time__Time t); +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); +string time__Time_utc_string(time__Time t); +VV_LOCAL_SYMBOL f64 time__mceil(f64 x); +bool time__Time__eq(time__Time t1, time__Time t2); +bool time__Time__lt(time__Time t1, time__Time t2); +time__Duration time__Time__minus(time__Time lhs, time__Time rhs); +_option_time__Time time__parse_rfc3339(string s); +_option_time__Time time__parse(string s); +_option_time__Time time__parse_iso8601(string s); +_option_time__Time time__parse_rfc2822(string s); +VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s); +VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); +string time__TimeParseError_msg(time__TimeParseError err); +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); +void time__StopWatch_start(time__StopWatch* t); +void time__StopWatch_restart(time__StopWatch* t); +void time__StopWatch_stop(time__StopWatch* t); +void time__StopWatch_pause(time__StopWatch* t); +time__Duration time__StopWatch_elapsed(time__StopWatch t); +time__Time time__now(void); +time__Time time__utc(void); +time__Time time__new_time(time__Time t); +i64 time__ticks(void); +string time__Time_str(time__Time t); +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); +string time__Time_strftime(time__Time t, string fmt); +string _const_time__days_string; // a string literal, inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +string _const_time__months_string; // a string literal, inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +#define _const_time__days_in_year 365 +Array_int _const_time__days_before; // inited later +string time__Time_smonth(time__Time* t); +i64 time__Time_unix_time(time__Time* t); +i64 time__Time_unix_time_milli(time__Time* t); +time__Time time__Time_add(time__Time* t, time__Duration d); +time__Time time__Time_add_seconds(time__Time* t, int seconds); +time__Time time__Time_add_days(time__Time* t, int days); +time__Duration time__since(time__Time t); +string time__Time_relative(time__Time* t); +string time__Time_relative_short(time__Time* t); +int time__day_of_week(int y, int m, int d); +int time__Time_day_of_week(time__Time* t); +string time__Time_weekday_str(time__Time* t); +string time__Time_long_weekday_str(time__Time* t); +bool time__is_leap_year(int year); +_option_int time__days_in_month(int month, int year); +string time__Time_debug(time__Time* t); +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__microsecond; // inited later +time__Duration _const_time__millisecond; // inited later +time__Duration _const_time__second; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later +time__Duration _const_time__infinite; // inited later +i64 time__Duration_nanoseconds(time__Duration d); +i64 time__Duration_microseconds(time__Duration d); +i64 time__Duration_milliseconds(time__Duration d); +f64 time__Duration_seconds(time__Duration d); +f64 time__Duration_minutes(time__Duration d); +f64 time__Duration_hours(time__Duration d); +string time__Duration_str(time__Duration d); +int time__offset(void); +VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void); +time__Time time__darwin_now(void); +time__Time time__solaris_now(void); +time__Time time__darwin_utc(void); +time__Time time__solaris_utc(void); +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); +time__Time time__Time_local(time__Time* t); +u64 time__sys_mono_now(void); +VV_LOCAL_SYMBOL u64 time__vpc_now(void); +VV_LOCAL_SYMBOL time__Time time__linux_now(void); +VV_LOCAL_SYMBOL time__Time time__linux_utc(void); +time__Time time__win_now(void); +time__Time time__win_utc(void); +struct timespec time__Duration_timespec(time__Duration d); +struct timespec time__zero_timespec(void); +void time__sleep(time__Duration duration); +int time__Duration_sys_milliseconds(time__Duration d); +time__Time time__unix(i64 abs); +time__Time time__unix2(i64 abs, int microsecond); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); +void v__dotgraph__start_digraph(void); +VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void); +v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); +void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); +void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); +void v__dotgraph__DotGraph_new_node(v__dotgraph__DotGraph* d, string nlabel, v__dotgraph__NewNodeConfig cfg); +void v__dotgraph__DotGraph_new_edge(v__dotgraph__DotGraph* d, string source, string target, v__dotgraph__NewEdgeConfig cfg); +string v__dotgraph__node_name(string name, voidptr context); +u64 hash__wyhash_c(u8* key, u64 len, u64 seed); +u64 hash__wyhash64_c(u64 a, u64 b); +u64 hash__sum64_string(string key, u64 seed); +u64 hash__sum64(Array_u8 key, u64 seed); +u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed +u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed +u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed +u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed +u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed +VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k); +u64 hash__wymum(u64 a, u64 b); +VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k); +VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p); +VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p); +u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed +#define _const_rand__constants__max_u32 4294967295 +u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed +f32 _const_rand__constants__max_u32_as_f32; // inited later +f64 _const_rand__constants__max_u64_as_f64; // inited later +u32 _const_rand__constants__u31_mask = 2147483647; // precomputed +u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed +u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed +u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed +u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed +u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed +u32 hash__fnv1a__sum32_string(string data); +u32 hash__fnv1a__sum32(Array_u8 data); +u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); +u64 hash__fnv1a__sum64_string(string data); +u64 hash__fnv1a__sum64(Array_u8 data); +u64 hash__fnv1a__sum64_bytes(u8* data, int data_len); +VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err); +VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err); +VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); +string flag__Flag_str(flag__Flag f); +string Array_flag__Flag_str(Array_flag__Flag af); +VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f); +string _const_flag__space; // a string literal, inited later +string _const_flag__underline; // a string literal, inited later +#define _const_flag__max_args_number 4048 +flag__FlagParser* flag__new_flag_parser(Array_string args); +void flag__FlagParser_usage_example(flag__FlagParser* fs, string example); +void flag__FlagParser_footer(flag__FlagParser* fs, string footer); +void flag__FlagParser_application(flag__FlagParser* fs, string name); +void flag__FlagParser_version(flag__FlagParser* fs, string vers); +void flag__FlagParser_description(flag__FlagParser* fs, string desc); +void flag__FlagParser_skip_executable(flag__FlagParser* fs); +void flag__FlagParser_allow_unknown_args(flag__FlagParser* fs); +VV_LOCAL_SYMBOL void flag__FlagParser_add_flag(flag__FlagParser* fs, string name, u8 abbr, string usage, string desc); +VV_LOCAL_SYMBOL Array_string flag__FlagParser_parse_value(flag__FlagParser* fs, string longhand, u8 shorthand); +VV_LOCAL_SYMBOL _option_string flag__FlagParser_parse_bool_value(flag__FlagParser* fs, string longhand, u8 shorthand); +_option_bool flag__FlagParser_bool_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); +bool flag__FlagParser_bool(flag__FlagParser* fs, string name, u8 abbr, bool bdefault, string usage); +Array_int flag__FlagParser_int_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); +_option_int flag__FlagParser_int_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); +int flag__FlagParser_int(flag__FlagParser* fs, string name, u8 abbr, int idefault, string usage); +Array_f64 flag__FlagParser_float_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); +_option_f64 flag__FlagParser_float_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); +f64 flag__FlagParser_float(flag__FlagParser* fs, string name, u8 abbr, f64 fdefault, string usage); +Array_string flag__FlagParser_string_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); +_option_string flag__FlagParser_string_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); +string flag__FlagParser_string(flag__FlagParser* fs, string name, u8 abbr, string sdefault, string usage); +_option_void flag__FlagParser_limit_free_args_to_at_least(flag__FlagParser* fs, int n); +_option_void flag__FlagParser_limit_free_args_to_exactly(flag__FlagParser* fs, int n); +_option_void flag__FlagParser_limit_free_args(flag__FlagParser* fs, int min, int max); +void flag__FlagParser_arguments_description(flag__FlagParser* fs, string description); +string flag__FlagParser_usage(flag__FlagParser* fs); +VV_LOCAL_SYMBOL _option_flag__Flag flag__FlagParser_find_existing_flag(flag__FlagParser* fs, string fname); +VV_LOCAL_SYMBOL void flag__FlagParser_handle_builtin_options(flag__FlagParser* fs); +_option_Array_string flag__FlagParser_finalize(flag__FlagParser* fs); +Array_string flag__FlagParser_remaining_parameters(flag__FlagParser* fs); +VV_LOCAL_SYMBOL bool semver__version_satisfies(semver__Version ver, string input); +VV_LOCAL_SYMBOL bool semver__compare_eq(semver__Version v1, semver__Version v2); +VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2); +VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2); +VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2); +VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2); +#define _const_semver__ver_major 0 +#define _const_semver__ver_minor 1 +#define _const_semver__ver_patch 2 +Array_int _const_semver__versions; // inited later +VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input); +VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver); +VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ); +VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVersion raw_ver); +VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver); +VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver); +VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver); +string _const_semver__comparator_sep; // a string literal, inited later +string _const_semver__comparator_set_sep; // a string literal, inited later +string _const_semver__hyphen_range_sep; // a string literal, inited later +string _const_semver__x_range_symbols; // a string literal, inited later +VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver); +VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver); +VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver); +VV_LOCAL_SYMBOL _option_semver__Range semver__parse_range(string input); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__parse_comparator_set(string input); +VV_LOCAL_SYMBOL _option_semver__Comparator semver__parse_comparator(string input); +VV_LOCAL_SYMBOL _option_semver__Version semver__parse_xrange(string input); +VV_LOCAL_SYMBOL bool semver__can_expand(string input); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_comparator_set(string input); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_tilda(string raw_version); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_caret(string raw_version); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_hyphen(string raw_range); +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_xrange(string raw_range); +VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_lt(semver__Version min, semver__Version max); +VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_le(semver__Version min, semver__Version max); +string semver__EmptyInputError_msg(semver__EmptyInputError err); +string semver__InvalidVersionFormatError_msg(semver__InvalidVersionFormatError err); +_option_semver__Version semver__from(string input); +semver__Version semver__build(int major, int minor, int patch); +semver__Version semver__Version_increment(semver__Version ver, semver__Increment typ); +bool semver__Version_satisfies(semver__Version ver, string input); +bool semver__Version_eq(semver__Version v1, semver__Version v2); +bool semver__Version_gt(semver__Version v1, semver__Version v2); +bool semver__Version_lt(semver__Version v1, semver__Version v2); +bool semver__Version_ge(semver__Version v1, semver__Version v2); +bool semver__Version_le(semver__Version v1, semver__Version v2); +string semver__Version_str(semver__Version ver); +_option_semver__Version semver__coerce(string input); +bool semver__is_valid(string input); +VV_LOCAL_SYMBOL bool semver__is_version_valid(string input); +VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input); +VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ); +VV_LOCAL_SYMBOL bool semver__is_valid_string(string input); +VV_LOCAL_SYMBOL bool semver__is_valid_number(string input); +#define _const_sync__stdatomic__used 1 +bool sync__stdatomic__add_u64(u64* ptr, int delta); +bool sync__stdatomic__sub_u64(u64* ptr, int delta); +bool sync__stdatomic__add_i64(i64* ptr, int delta); +bool sync__stdatomic__sub_i64(i64* ptr, int delta); +void sync__stdatomic__store_u64(u64* ptr, u64 val); +u64 sync__stdatomic__load_u64(u64* ptr); +void sync__stdatomic__store_i64(i64* ptr, i64 val); +i64 sync__stdatomic__load_i64(i64* ptr); Array_string os__args_after(string cut_word); Array_string os__args_before(string cut_word); #define _const_os__o_rdonly 0 @@ -7947,10 +8229,18 @@ _option_i64 os__File_tell(os__File* f); rune _const_os__fslash = '/'; // precomputed #define _const_os__bslash '\\' rune _const_os__dot = '.'; // precomputed +rune _const_os__qmark = '?'; // precomputed +string _const_os__dot_dot; // a string literal, inited later +string _const_os__empty_str; // a string literal, inited later +string _const_os__dot_str; // a string literal, inited later bool os__is_abs_path(string path); +string os__abs_path(string path); +string os__norm_path(string path); +VV_LOCAL_SYMBOL string os__clean_path(string path); VV_LOCAL_SYMBOL int os__win_volume_len(string path); +VV_LOCAL_SYMBOL string os__get_volume(string path); VV_LOCAL_SYMBOL bool os__is_slash(u8 b); -VV_LOCAL_SYMBOL bool os__is_device_path(string path); +VV_LOCAL_SYMBOL bool os__is_unc_path(string path); VV_LOCAL_SYMBOL bool os__has_drive_letter(string path); VV_LOCAL_SYMBOL bool os__starts_w_slash_slash(string path); VV_LOCAL_SYMBOL bool os__is_drive_rooted(string path); @@ -8161,265 +8451,25 @@ VV_LOCAL_SYMBOL multi_return_string_int os__Process_win_read_string(os__Process* VV_LOCAL_SYMBOL string os__Process_win_slurp(os__Process* p, int idx); _option_os__SignalHandler os__signal_opt(os__Signal signum, void (*handler)(os__Signal )); _option_void os__open_uri(string uri); -strings__textscanner__TextScanner strings__textscanner__new(string input); -void strings__textscanner__TextScanner_free(strings__textscanner__TextScanner* ss); -int strings__textscanner__TextScanner_remaining(strings__textscanner__TextScanner* ss); -int strings__textscanner__TextScanner_next(strings__textscanner__TextScanner* ss); -void strings__textscanner__TextScanner_skip(strings__textscanner__TextScanner* ss); -void strings__textscanner__TextScanner_skip_n(strings__textscanner__TextScanner* ss, int n); -int strings__textscanner__TextScanner_peek(strings__textscanner__TextScanner* ss); -int strings__textscanner__TextScanner_peek_n(strings__textscanner__TextScanner* ss, int n); -void strings__textscanner__TextScanner_back(strings__textscanner__TextScanner* ss); -void strings__textscanner__TextScanner_back_n(strings__textscanner__TextScanner* ss, int n); -int strings__textscanner__TextScanner_peek_back(strings__textscanner__TextScanner* ss); -int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScanner* ss, int n); -int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss); -void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss); -void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss); -Array_string os__cmdline__options(Array_string args, string param); -string os__cmdline__option(Array_string args, string param, string def); -Array_string os__cmdline__options_before(Array_string args, Array_string what); -Array_string os__cmdline__options_after(Array_string args, Array_string what); -Array_string os__cmdline__only_non_options(Array_string args); -Array_string os__cmdline__only_options(Array_string args); -#define _const_v__token__max_keyword_len 20 -v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map); -VV_LOCAL_SYMBOL int compare_5690199065019732925_v__token__WIndex_by_word(v__token__WIndex* a, v__token__WIndex* b) { - if (string__lt(a->word, b->word)) return -1; - else return 1; -} - -v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw_map); -VV_LOCAL_SYMBOL void v__token__KeywordsMatcher_add_word(v__token__KeywordsMatcher* km, string word, int kind); -int v__token__KeywordsMatcher_find(v__token__KeywordsMatcher* km, string word); -void v__token__Pos_free(v__token__Pos* p); -string v__token__Pos_line_str(v__token__Pos p); -v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end); -v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line); -void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line); -v__token__Pos v__token__Token_pos(v__token__Token* tok); -Array_v__token__Kind _const_v__token__assign_tokens; // inited later -Array_string _const_v__token__valid_at_tokens; // inited later -Array_string _const_v__token__token_str; // inited later -Map_string_v__token__Kind _const_v__token__keywords; // inited later -v__token__KeywordsMatcher _const_v__token__matcher; // inited later -VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void); -VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void); -bool v__token__is_key(string key); -bool v__token__is_decl(v__token__Kind t); -bool v__token__Kind_is_assign(v__token__Kind t); -string v__token__Kind_str(v__token__Kind t); -string v__token__Token_str(v__token__Token t); -string v__token__Token_debug(v__token__Token t); -Array_v__token__Precedence v__token__build_precedences(void); -Array_v__token__Precedence _const_v__token__precedences; // inited later -int v__token__Token_precedence(v__token__Token tok); -bool v__token__Token_is_scalar(v__token__Token tok); -bool v__token__Token_is_unary(v__token__Token tok); -bool v__token__Kind_is_relational(v__token__Kind tok); -bool v__token__Kind_is_start_of_type(v__token__Kind k); -bool v__token__Kind_is_prefix(v__token__Kind kind); -bool v__token__Kind_is_infix(v__token__Kind kind); -bool v__token__Kind_is_postfix(v__token__Kind kind); -string v__token__kind_to_string(v__token__Kind k); -_option_v__token__Kind v__token__kind_from_string(string s); -int v__mathutil__min_T_int(int a, int b); -int v__mathutil__max_T_int(int a, int b); -void v__dotgraph__start_digraph(void); -VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void); -v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); -void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line); -void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d); -void v__dotgraph__DotGraph_new_node(v__dotgraph__DotGraph* d, string nlabel, v__dotgraph__NewNodeConfig cfg); -void v__dotgraph__DotGraph_new_edge(v__dotgraph__DotGraph* d, string source, string target, v__dotgraph__NewEdgeConfig cfg); -string v__dotgraph__node_name(string name, voidptr context); -u64 hash__wyhash_c(u8* key, u64 len, u64 seed); -u64 hash__wyhash64_c(u64 a, u64 b); -u64 hash__sum64_string(string key, u64 seed); -u64 hash__sum64(Array_u8 key, u64 seed); -u64 _const_hash__wyp0 = 11562461410679940143U; // precomputed -u64 _const_hash__wyp1 = 16646288086500911323U; // precomputed -u64 _const_hash__wyp2 = 10285213230658275043U; // precomputed -u64 _const_hash__wyp3 = 6384245875588680899U; // precomputed -u64 _const_hash__wyp4 = 2129725606500045391U; // precomputed -VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k); -u64 hash__wymum(u64 a, u64 b); -VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k); -VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p); -VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p); -u64 _const_rand__constants__lower_mask = 4294967295U; // precomputed -#define _const_rand__constants__max_u32 4294967295 -u64 _const_rand__constants__max_u64 = 18446744073709551615U; // precomputed -f32 _const_rand__constants__max_u32_as_f32; // inited later -f64 _const_rand__constants__max_u64_as_f64; // inited later -u32 _const_rand__constants__u31_mask = 2147483647; // precomputed -u64 _const_rand__constants__u63_mask = 9223372036854775807U; // precomputed -u64 _const_hash__fnv1a__fnv64_prime = 1099511628211U; // precomputed -u64 _const_hash__fnv1a__fnv64_offset_basis = 14695981039346656037U; // precomputed -u32 _const_hash__fnv1a__fnv32_offset_basis = 2166136261; // precomputed -u32 _const_hash__fnv1a__fnv32_prime = 16777619; // precomputed -u32 hash__fnv1a__sum32_string(string data); -u32 hash__fnv1a__sum32(Array_u8 data); -u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); -u64 hash__fnv1a__sum64_string(string data); -u64 hash__fnv1a__sum64(Array_u8 data); -u64 hash__fnv1a__sum64_bytes(u8* data, int data_len); -f64 _const_math__internal__f64_epsilon = 2.220446049250313e-16; // precomputed -f64 _const_math__internal__sqrt_f64_epsilon = 3.725290298461914e-09; // precomputed -f64 _const_math__internal__root3_f64_epsilon = 6.055454452393343e-06; // precomputed -f64 _const_math__internal__root4_f64_epsilon = 0.0001220703125; // precomputed -f64 _const_math__internal__root5_f64_epsilon = 0.000740095979741405; // precomputed -f64 _const_math__internal__root6_f64_epsilon = 0.002460783300575925; // precomputed -f64 _const_math__internal__log_f64_epsilon = -36.04365338911715; // precomputed -f64 _const_math__internal__f64_min = 2.2250738585072014e-308; // precomputed -f64 _const_math__internal__sqrt_f64_min = 3.7291703656001034e-155; // precomputed -f64 _const_math__internal__root3_f64_min = 2.8126442852362996e-103; // precomputed -f64 _const_math__internal__root4_f64_min = 1.221338669755462e-77; // precomputed -f64 _const_math__internal__root5_f64_min = 2.9476022969691763e-62; // precomputed -f64 _const_math__internal__root6_f64_min = 5.303436890579822e-52; // precomputed -f64 _const_math__internal__log_f64_min = -708.3964185322641; // precomputed -f64 _const_math__internal__f64_max = 1.7976931348623157e+308; // precomputed -f64 _const_math__internal__sqrt_f64_max = 1.3407807929942596e+154; // precomputed -f64 _const_math__internal__root3_f64_max = 5.64380309412229e+102; // precomputed -f64 _const_math__internal__root4_f64_max = 1.157920892373162e+77; // precomputed -f64 _const_math__internal__root5_f64_max = 4.4765466227572707e+61; // precomputed -f64 _const_math__internal__root6_f64_max = 2.3756689782295612e+51; // precomputed -f64 _const_math__internal__log_f64_max = 709.782712893384; // precomputed -f64 _const_math__internal__f32_epsilon = 1.1920928955078125e-07; // precomputed -f64 _const_math__internal__sqrt_f32_epsilon = 0.00034526698300124393; // precomputed -f64 _const_math__internal__root3_f32_epsilon = 0.00492156660115185; // precomputed -f64 _const_math__internal__root4_f32_epsilon = 0.018581361171917516; // precomputed -f64 _const_math__internal__root5_f32_epsilon = 0.04123462221165294; // precomputed -f64 _const_math__internal__root6_f32_epsilon = 0.07015387801933583; // precomputed -f64 _const_math__internal__log_f32_epsilon = -15.942385152878742; // precomputed -f64 _const_math__internal__f32_min = 2.938735877055719e-39; // precomputed -f64 _const_math__internal__sqrt_f32_min = 2.710505431213761e-20; // precomputed -f64 _const_math__internal__root3_f32_min = 2.273736754432324e-13; // precomputed -f64 _const_math__internal__root4_f32_min = 3.2927225399135965e-10; // precomputed -f64 _const_math__internal__root5_f32_min = 2.5944428542140822e-08; // precomputed -f64 _const_math__internal__root6_f32_min = 4.768371582031254e-07; // precomputed -f64 _const_math__internal__log_f32_min = -87.3365447505531; // precomputed -f64 _const_math__internal__f32_max = 3.4028234663852886e+38; // precomputed -f64 _const_math__internal__sqrt_f32_max = 1.844674352395373e+19; // precomputed -f64 _const_math__internal__root3_f32_max = 6.981463519622324e+12; // precomputed -f64 _const_math__internal__root4_f32_max = 4.2949672319999986e+09; // precomputed -f64 _const_math__internal__root5_f32_max = 5.085900785596004e+07; // precomputed -f64 _const_math__internal__root6_f32_max = 2.642245923380775e+06; // precomputed -f64 _const_math__internal__log_f32_max = 88.72283905206835; // precomputed -f64 _const_math__internal__sflt_epsilon = 0.00048828125; // precomputed -f64 _const_math__internal__sqrt_sflt_epsilon = 0.02209708691207961; // precomputed -f64 _const_math__internal__root3_sflt_epsilon = 0.07874506561842959; // precomputed -f64 _const_math__internal__root4_sflt_epsilon = 0.14865088937534013; // precomputed -f64 _const_math__internal__root5_sflt_epsilon = 0.217637640824031; // precomputed -f64 _const_math__internal__root6_sflt_epsilon = 0.28061551207734325; // precomputed -f64 _const_math__internal__log_sflt_epsilon = -7.6246189861593985; // precomputed -#define _const_math__internal__max_int_fact_arg 170 -f64 _const_math__internal__max_f64_fact_arg = 171.; // precomputed -f64 _const_math__internal__max_long_f64_fact_arg = 1755.5; // precomputed -VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err); -VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err); -VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); -string flag__Flag_str(flag__Flag f); -string Array_flag__Flag_str(Array_flag__Flag af); -VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f); -string _const_flag__space; // a string literal, inited later -string _const_flag__underline; // a string literal, inited later -#define _const_flag__max_args_number 4048 -flag__FlagParser* flag__new_flag_parser(Array_string args); -void flag__FlagParser_usage_example(flag__FlagParser* fs, string example); -void flag__FlagParser_footer(flag__FlagParser* fs, string footer); -void flag__FlagParser_application(flag__FlagParser* fs, string name); -void flag__FlagParser_version(flag__FlagParser* fs, string vers); -void flag__FlagParser_description(flag__FlagParser* fs, string desc); -void flag__FlagParser_skip_executable(flag__FlagParser* fs); -void flag__FlagParser_allow_unknown_args(flag__FlagParser* fs); -VV_LOCAL_SYMBOL void flag__FlagParser_add_flag(flag__FlagParser* fs, string name, u8 abbr, string usage, string desc); -VV_LOCAL_SYMBOL Array_string flag__FlagParser_parse_value(flag__FlagParser* fs, string longhand, u8 shorthand); -VV_LOCAL_SYMBOL _option_string flag__FlagParser_parse_bool_value(flag__FlagParser* fs, string longhand, u8 shorthand); -_option_bool flag__FlagParser_bool_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); -bool flag__FlagParser_bool(flag__FlagParser* fs, string name, u8 abbr, bool bdefault, string usage); -Array_int flag__FlagParser_int_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); -_option_int flag__FlagParser_int_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); -int flag__FlagParser_int(flag__FlagParser* fs, string name, u8 abbr, int idefault, string usage); -Array_f64 flag__FlagParser_float_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); -_option_f64 flag__FlagParser_float_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); -f64 flag__FlagParser_float(flag__FlagParser* fs, string name, u8 abbr, f64 fdefault, string usage); -Array_string flag__FlagParser_string_multi(flag__FlagParser* fs, string name, u8 abbr, string usage); -_option_string flag__FlagParser_string_opt(flag__FlagParser* fs, string name, u8 abbr, string usage); -string flag__FlagParser_string(flag__FlagParser* fs, string name, u8 abbr, string sdefault, string usage); -_option_void flag__FlagParser_limit_free_args_to_at_least(flag__FlagParser* fs, int n); -_option_void flag__FlagParser_limit_free_args_to_exactly(flag__FlagParser* fs, int n); -_option_void flag__FlagParser_limit_free_args(flag__FlagParser* fs, int min, int max); -void flag__FlagParser_arguments_description(flag__FlagParser* fs, string description); -string flag__FlagParser_usage(flag__FlagParser* fs); -VV_LOCAL_SYMBOL _option_flag__Flag flag__FlagParser_find_existing_flag(flag__FlagParser* fs, string fname); -VV_LOCAL_SYMBOL void flag__FlagParser_handle_builtin_options(flag__FlagParser* fs); -_option_Array_string flag__FlagParser_finalize(flag__FlagParser* fs); -Array_string flag__FlagParser_remaining_parameters(flag__FlagParser* fs); -VV_LOCAL_SYMBOL bool semver__version_satisfies(semver__Version ver, string input); -VV_LOCAL_SYMBOL bool semver__compare_eq(semver__Version v1, semver__Version v2); -VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2); -VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2); -VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2); -VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2); -#define _const_semver__ver_major 0 -#define _const_semver__ver_minor 1 -#define _const_semver__ver_patch 2 -Array_int _const_semver__versions; // inited later -VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input); -VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver); -VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ); -VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVersion raw_ver); -VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver); -VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver); -VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver); -string _const_semver__comparator_sep; // a string literal, inited later -string _const_semver__comparator_set_sep; // a string literal, inited later -string _const_semver__hyphen_range_sep; // a string literal, inited later -string _const_semver__x_range_symbols; // a string literal, inited later -VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver); -VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver); -VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver); -VV_LOCAL_SYMBOL _option_semver__Range semver__parse_range(string input); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__parse_comparator_set(string input); -VV_LOCAL_SYMBOL _option_semver__Comparator semver__parse_comparator(string input); -VV_LOCAL_SYMBOL _option_semver__Version semver__parse_xrange(string input); -VV_LOCAL_SYMBOL bool semver__can_expand(string input); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_comparator_set(string input); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_tilda(string raw_version); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_caret(string raw_version); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_hyphen(string raw_range); -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_xrange(string raw_range); -VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_lt(semver__Version min, semver__Version max); -VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_le(semver__Version min, semver__Version max); -string semver__EmptyInputError_msg(semver__EmptyInputError err); -string semver__InvalidVersionFormatError_msg(semver__InvalidVersionFormatError err); -_option_semver__Version semver__from(string input); -semver__Version semver__build(int major, int minor, int patch); -semver__Version semver__Version_increment(semver__Version ver, semver__Increment typ); -bool semver__Version_satisfies(semver__Version ver, string input); -bool semver__Version_eq(semver__Version v1, semver__Version v2); -bool semver__Version_gt(semver__Version v1, semver__Version v2); -bool semver__Version_lt(semver__Version v1, semver__Version v2); -bool semver__Version_ge(semver__Version v1, semver__Version v2); -bool semver__Version_le(semver__Version v1, semver__Version v2); -string semver__Version_str(semver__Version ver); -_option_semver__Version semver__coerce(string input); -bool semver__is_valid(string input); -VV_LOCAL_SYMBOL bool semver__is_version_valid(string input); -VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input); -VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ); -VV_LOCAL_SYMBOL bool semver__is_valid_string(string input); -VV_LOCAL_SYMBOL bool semver__is_valid_number(string input); -#define _const_sync__stdatomic__used 1 -bool sync__stdatomic__add_u64(u64* ptr, int delta); -bool sync__stdatomic__sub_u64(u64* ptr, int delta); -bool sync__stdatomic__add_i64(i64* ptr, int delta); -bool sync__stdatomic__sub_i64(i64* ptr, int delta); -void sync__stdatomic__store_u64(u64* ptr, u64 val); -u64 sync__stdatomic__load_u64(u64* ptr); -void sync__stdatomic__store_i64(i64* ptr, i64 val); -i64 sync__stdatomic__load_i64(i64* ptr); +v__depgraph__OrderedDepMap v__depgraph__new_ordered_dependency_map(void); +void v__depgraph__OrderedDepMap_set(v__depgraph__OrderedDepMap* o, string name, Array_string deps); +void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, Array_string deps); +Array_string v__depgraph__OrderedDepMap_get(v__depgraph__OrderedDepMap* o, string name); +void v__depgraph__OrderedDepMap_delete(v__depgraph__OrderedDepMap* o, string name); +void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string name, Array_string deps); +int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o); +v__depgraph__DepGraph* v__depgraph__new_dep_graph(void); +void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps); +v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph); +v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph); +string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); +string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph); +VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen); +void v__depgraph__show(v__depgraph__DepGraph* graph, string path); +VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); +Array_u32 rand__seed__time_seed_array(int count); +u32 rand__seed__time_seed_32(void); +u64 rand__seed__time_seed_64(void); string term__format(string msg, string open, string close); string term__format_rgb(int r, int g, int b, string msg, string open, string close); string term__rgb(int r, int g, int b, string msg); @@ -8519,6 +8569,10 @@ _option_string v__vcache__CacheManager_exists(v__vcache__CacheManager* cm, strin _option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string postfix, string key, string content); _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string postfix, string key); VV_LOCAL_SYMBOL int v__vcache__mypid(void); +_option_string v__util__diff__find_working_diff_command(void); +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); string _const_v__vmod__err_label; // a string literal, inited later _option_v__vmod__Manifest v__vmod__from_file(string vmod_path); _option_v__vmod__Manifest v__vmod__decode(string contents); @@ -8546,21 +8600,6 @@ v__vmod__ModFileCacher* _const_v__vmod__private_file_cacher; // inited later v__vmod__ModFileCacher* v__vmod__get_cache(void); string v__util__recompilation__disabling_file(string vroot); void v__util__recompilation__must_be_enabled(string vroot, string error_message); -v__depgraph__OrderedDepMap v__depgraph__new_ordered_dependency_map(void); -void v__depgraph__OrderedDepMap_set(v__depgraph__OrderedDepMap* o, string name, Array_string deps); -void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, Array_string deps); -Array_string v__depgraph__OrderedDepMap_get(v__depgraph__OrderedDepMap* o, string name); -void v__depgraph__OrderedDepMap_delete(v__depgraph__OrderedDepMap* o, string name); -void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string name, Array_string deps); -int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o); -v__depgraph__DepGraph* v__depgraph__new_dep_graph(void); -void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps); -v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph); -v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph); -string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); -string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph); -VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen); -void v__depgraph__show(v__depgraph__DepGraph* graph, string path); string v__cflag__CFlag_str(v__cflag__CFlag* c); string _const_v__cflag__fexisting_literal; // a string literal, inited later string v__cflag__CFlag_eval(v__cflag__CFlag* cf); @@ -8572,262 +8611,16 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); -f64 math__fabs(f64 x); -u64 _const_math__uvnan = 9221120237041090561U; // precomputed -u64 _const_math__uvinf = 9218868437227405312U; // precomputed -u64 _const_math__uvneginf = 18442240474082181120U; // precomputed -u64 _const_math__uvone = 4607182418800017408U; // precomputed -#define _const_math__mask 2047 -#define _const_math__shift 52 -#define _const_math__bias 1023 -u64 _const_math__normalize_smallest_mask = 4503599627370496U; // precomputed -u64 _const_math__sign_mask = 9223372036854775808U; // precomputed -u64 _const_math__frac_mask = 4503599627370495U; // precomputed -f64 math__inf(int sign); -f64 math__nan(void); -bool math__is_nan(f64 f); -bool math__is_inf(f64 f, int sign); -bool math__is_finite(f64 f); -multi_return_f64_int math__normalize(f64 x); -f64 math__cbrt(f64 a); -f64 _const_math__e = 2.718281828459045; // precomputed -f64 _const_math__pi = 3.141592653589793; // precomputed -f64 _const_math__pi_2; // inited later -f64 _const_math__pi_4; // inited later -f64 _const_math__phi = 1.618033988749895; // precomputed -f64 _const_math__tau = 6.283185307179586; // precomputed -f64 _const_math__sqrt2 = 1.4142135623730951; // precomputed -f64 _const_math__sqrt_e = 1.6487212707001282; // precomputed -f64 _const_math__sqrt_pi = 1.772453850905516; // precomputed -f64 _const_math__sqrt_tau = 2.5066282746310007; // precomputed -f64 _const_math__sqrt_phi = 1.272019649514069; // precomputed -f64 _const_math__ln2 = 0.6931471805599453; // precomputed -f64 _const_math__log2_e; // inited later -f64 _const_math__ln10 = 2.302585092994046; // precomputed -f64 _const_math__log10_e; // inited later -f64 _const_math__max_f32 = 3.4028234663852886e+38; // precomputed -f64 _const_math__smallest_non_zero_f32 = 3.503246160812043e-46; // precomputed -f64 _const_math__max_f64 = 1.7976931348623157e+308; // precomputed -f64 _const_math__smallest_non_zero_f64 = 0; // precomputed -#define _const_math__max_i8 127 -#define _const_math__min_i8 -128 -#define _const_math__max_i16 32767 -#define _const_math__min_i16 -32768 -#define _const_math__max_i32 2147483647 -#define _const_math__min_i32 -2147483648 -i64 _const_math__min_i64; // inited later -i64 _const_math__max_i64; // inited later -#define _const_math__max_u8 255 -#define _const_math__max_u16 65535 -u32 _const_math__max_u32 = 4294967295; // precomputed -u64 _const_math__max_u64 = 18446744073709551615U; // precomputed -f64 math__mod(f64 x, f64 y); -f64 math__fmod(f64 x, f64 y); -i64 math__gcd(i64 a_, i64 b_); -multi_return_i64_i64_i64 math__egcd(i64 a, i64 b); -i64 math__lcm(i64 a, i64 b); -f64 _const_math__erx = 0.8450629115104675; // precomputed -f64 _const_math__efx = 0.1283791670955126; // precomputed -f64 _const_math__efx8 = 1.0270333367641007; // precomputed -f64 _const_math__pp0 = 0.12837916709551256; // precomputed -f64 _const_math__pp1 = -0.3250421072470015; // precomputed -f64 _const_math__pp2 = -0.02848174957559851; // precomputed -f64 _const_math__pp3 = -0.005770270296489442; // precomputed -f64 _const_math__pp4 = -2.3763016656650163e-05; // precomputed -f64 _const_math__qq1 = 0.39791722395915535; // precomputed -f64 _const_math__qq2 = 0.0650222499887673; // precomputed -f64 _const_math__qq3 = 0.005081306281875766; // precomputed -f64 _const_math__qq4 = 0.00013249473800432164; // precomputed -f64 _const_math__qq5 = -3.960228278775368e-06; // precomputed -f64 _const_math__pa0 = -0.0023621185607526594; // precomputed -f64 _const_math__pa1 = 0.41485611868374833; // precomputed -f64 _const_math__pa2 = -0.3722078760357013; // precomputed -f64 _const_math__pa3 = 0.31834661990116175; // precomputed -f64 _const_math__pa4 = -0.11089469428239668; // precomputed -f64 _const_math__pa5 = 0.035478304325618236; // precomputed -f64 _const_math__pa6 = -0.002166375594868791; // precomputed -f64 _const_math__qa1 = 0.10642088040084423; // precomputed -f64 _const_math__qa2 = 0.540397917702171; // precomputed -f64 _const_math__qa3 = 0.07182865441419627; // precomputed -f64 _const_math__qa4 = 0.12617121980876164; // precomputed -f64 _const_math__qa5 = 0.01363708391202905; // precomputed -f64 _const_math__qa6 = 0.011984499846799107; // precomputed -f64 _const_math__ra0 = -0.009864944034847148; // precomputed -f64 _const_math__ra1 = -0.6938585727071818; // precomputed -f64 _const_math__ra2 = -10.558626225323291; // precomputed -f64 _const_math__ra3 = -62.375332450326006; // precomputed -f64 _const_math__ra4 = -162.39666946257347; // precomputed -f64 _const_math__ra5 = -184.60509290671104; // precomputed -f64 _const_math__ra6 = -81.2874355063066; // precomputed -f64 _const_math__ra7 = -9.814329344169145; // precomputed -f64 _const_math__sa1 = 19.651271667439257; // precomputed -f64 _const_math__sa2 = 137.65775414351904; // precomputed -f64 _const_math__sa3 = 434.56587747522923; // precomputed -f64 _const_math__sa4 = 645.3872717332679; // precomputed -f64 _const_math__sa5 = 429.00814002756783; // precomputed -f64 _const_math__sa6 = 108.63500554177944; // precomputed -f64 _const_math__sa7 = 6.570249770319282; // precomputed -f64 _const_math__sa8 = -0.0604244152148581; // precomputed -f64 _const_math__rb0 = -0.0098649429247001; // precomputed -f64 _const_math__rb1 = -0.799283237680523; // precomputed -f64 _const_math__rb2 = -17.757954917754752; // precomputed -f64 _const_math__rb3 = -160.63638485582192; // precomputed -f64 _const_math__rb4 = -637.5664433683896; // precomputed -f64 _const_math__rb5 = -1025.0951316110772; // precomputed -f64 _const_math__rb6 = -483.5191916086514; // precomputed -f64 _const_math__sb1 = 30.33806074348246; // precomputed -f64 _const_math__sb2 = 325.7925129965739; // precomputed -f64 _const_math__sb3 = 1536.729586084437; // precomputed -f64 _const_math__sb4 = 3199.8582195085955; // precomputed -f64 _const_math__sb5 = 2553.0504064331644; // precomputed -f64 _const_math__sb6 = 474.52854120695537; // precomputed -f64 _const_math__sb7 = -22.44095244658582; // precomputed -f64 math__erf(f64 a); -f64 math__erfc(f64 a); -f64 _const_math__f64_max_exp = 1024.; // precomputed -f64 _const_math__f64_min_exp = -1021.; // precomputed -f64 _const_math__threshold = 709.782712893384; // precomputed -f64 _const_math__ln2_x56 = 38.816242111356935; // precomputed -f64 _const_math__ln2_halfx3 = 1.0397207708399179; // precomputed -f64 _const_math__ln2_half = 0.34657359027997264; // precomputed -f64 _const_math__ln2hi = 0.6931471803691238; // precomputed -f64 _const_math__ln2lo = 1.9082149292705877e-10; // precomputed -f64 _const_math__inv_ln2 = 1.4426950408889634; // precomputed -f64 _const_math__expm1_q1 = -0.03333333333333313; // precomputed -f64 _const_math__expm1_q2 = 0.0015873015872548146; // precomputed -f64 _const_math__expm1_q3 = -7.93650757867488e-05; // precomputed -f64 _const_math__expm1_q4 = 4.008217827329362e-06; // precomputed -f64 _const_math__expm1_q5 = -2.0109921818362437e-07; // precomputed -f64 math__exp(f64 x); -f64 math__exp2(f64 x); -f64 math__ldexp(f64 frac, int exp); -multi_return_f64_int math__frexp(f64 x); -f64 math__expm1(f64 x); -VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k); -f64 math__factorial(f64 n); -f64 math__log_factorial(f64 n); -VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n); -i64 math__factoriali(int n); -f64 _const_math__log_sqrt_2pi = 0.9189385332046728; // precomputed -Array_f64 _const_math__bernoulli; // inited later -Array_f64 _const_math__factorials_table; // inited later -Array_f64 _const_math__log_factorials_table; // inited later -f64 math__floor(f64 x); -f64 math__ceil(f64 x); -f64 math__trunc(f64 x); -f64 math__round(f64 x); -f64 math__round_to_even(f64 x); -VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x); -f64 math__gamma(f64 a); -f64 math__log_gamma(f64 x); -multi_return_f64_int math__log_gamma_sign(f64 a); -VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_); -Array_f64 _const_math__gamma_p; // inited later -Array_f64 _const_math__gamma_q; // inited later -Array_f64 _const_math__gamma_s; // inited later -Array_f64 _const_math__lgamma_a; // inited later -Array_f64 _const_math__lgamma_r; // inited later -Array_f64 _const_math__lgamma_s; // inited later -Array_f64 _const_math__lgamma_t; // inited later -Array_f64 _const_math__lgamma_u; // inited later -Array_f64 _const_math__lgamma_v; // inited later -Array_f64 _const_math__lgamma_w; // inited later -f64 math__hypot(f64 x, f64 y); -f64 math__acosh(f64 x); -f64 math__asinh(f64 x); -f64 math__atanh(f64 x); -f64 _const_math__morebits = 6.123233995736766e-17; // precomputed -f64 _const_math__tan3pio8 = 2.414213562373095; // precomputed -VV_LOCAL_SYMBOL f64 math__xatan(f64 x); -VV_LOCAL_SYMBOL f64 math__satan(f64 x); -f64 math__atan(f64 x); -f64 math__atan2(f64 y, f64 x); -f64 math__asin(f64 x_); -f64 math__acos(f64 x); -f64 math__log_n(f64 x, f64 b); -f64 math__log10(f64 x); -f64 math__log2(f64 x); -f64 math__log1p(f64 x); -f64 math__log_b(f64 x); -int math__ilog_b(f64 x); -VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_); -f64 math__log(f64 a); -f64 math__aprox_sin(f64 a); -f64 math__aprox_cos(f64 a); -f64 math__copysign(f64 x, f64 y); -f64 math__degrees(f64 radians); -Array_int math__digits(i64 num, math__DigitParams params); -int math__count_digits(i64 number); -multi_return_f64_f64 math__minmax(f64 a, f64 b); -f64 math__clamp(f64 x, f64 a, f64 b); -f64 math__sign(f64 n); -int math__signi(f64 n); -f64 math__radians(f64 degrees); -bool math__signbit(f64 x); -bool math__tolerance(f64 a, f64 b, f64 tol); -bool math__close(f64 a, f64 b); -bool math__veryclose(f64 a, f64 b); -bool math__alike(f64 a, f64 b); -VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x); -VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x); -int math__min_T_int(int a, int b); -f64 math__abs_T_f64(f64 a); -f64 _const_math__modf_maxpowtwo = 4.503599627370496e+15; // precomputed -multi_return_f64_f64 math__modf(f64 f); -f32 math__nextafter32(f32 x, f32 y); -f64 math__nextafter(f64 x, f64 y); -VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x); -VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x); -f32 math__powf(f32 a, f32 b); -Array_f64 _const_math__pow10tab; // inited later -Array_f64 _const_math__pow10postab32; // inited later -Array_f64 _const_math__pow10negtab32; // inited later -f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b); -f64 math__pow10(int n); -i64 math__powi(i64 a, i64 b); -f64 math__pow(f64 x, f64 y); -f64 math__q_rsqrt(f64 x); -f64 math__scalbn(f64 x, int n_); -f32 math__cosf(f32 a); -f32 math__sinf(f32 a); -Array_f64 _const_math__sin_data; // inited later -math__ChebSeries _const_math__sin_cs; // inited later -Array_f64 _const_math__cos_data; // inited later -math__ChebSeries _const_math__cos_cs; // inited later -f64 math__sin(f64 x); -f64 math__cos(f64 x); -f32 math__pure_v_but_overriden_by_c_cosf(f32 a); -f32 math__pure_v_but_overriden_by_c_sinf(f32 a); -multi_return_f64_f64 math__sincos(f64 x); -f64 math__sinh(f64 x_); -f64 math__cosh(f64 x); -f32 math__sqrtf(f32 a); -f64 math__sqrt(f64 a); -f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a); -i64 math__sqrti(i64 a); -f32 math__tanf(f32 a); -Array_f64 _const_math__tan_p; // inited later -Array_f64 _const_math__tan_q; // inited later -f64 _const_math__tan_dp1 = 0.7853981554508209; // precomputed -f64 _const_math__tan_dp2 = 7.946627356147928e-09; // precomputed -f64 _const_math__tan_dp3 = 3.061616997868383e-17; // precomputed -f64 _const_math__tan_lossth = 1.073741824e+09; // precomputed -f64 math__tan(f64 a); -f32 math__pure_v_but_overriden_by_c_tanf(f32 a); -f64 math__cot(f64 a); -Array_f64 _const_math__tanh_p; // inited later -Array_f64 _const_math__tanh_q; // inited later -f64 math__tanh(f64 x); -u32 math__f32_bits(f32 f); -f32 math__f32_from_bits(u32 b); -u64 math__f64_bits(f64 f); -f64 math__f64_from_bits(u64 b); -f64 math__with_set_low_word(f64 f, u32 lo); -f64 math__with_set_high_word(f64 f, u32 hi); -u32 math__get_high_word(f64 f); +u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed +u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed +#define _const_rand__wyrand__seed_len 2 +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); +u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); +u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); +u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); +u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); +int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod); _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { @@ -8861,138 +8654,13 @@ bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); -i64 time__portable_timegm(struct tm* t); -int time__days_from_civil(int oy, int m, int d); -string time__Time_format(time__Time t); -string time__Time_format_ss(time__Time t); -string time__Time_format_ss_milli(time__Time t); -string time__Time_format_ss_micro(time__Time t); -string time__Time_hhmm(time__Time t); -string time__Time_hhmmss(time__Time t); -string time__Time_hhmm12(time__Time t); -string time__Time_ymmdd(time__Time t); -string time__Time_ddmmy(time__Time t); -string time__Time_md(time__Time t); -VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); -Array_string _const_time__tokens_2; // inited later -Array_string _const_time__tokens_3; // inited later -Array_string _const_time__tokens_4; // inited later -string time__Time_custom_format(time__Time t, string s); -string time__Time_clean(time__Time t); -string time__Time_clean12(time__Time t); -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); -string time__Time_utc_string(time__Time t); -bool time__Time__eq(time__Time t1, time__Time t2); -bool time__Time__lt(time__Time t1, time__Time t2); -time__Duration time__Time__minus(time__Time lhs, time__Time rhs); -_option_time__Time time__parse_rfc3339(string s); -_option_time__Time time__parse(string s); -_option_time__Time time__parse_iso8601(string s); -_option_time__Time time__parse_rfc2822(string s); -VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s); -VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); -string time__TimeParseError_msg(time__TimeParseError err); -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); -void time__StopWatch_start(time__StopWatch* t); -void time__StopWatch_restart(time__StopWatch* t); -void time__StopWatch_stop(time__StopWatch* t); -void time__StopWatch_pause(time__StopWatch* t); -time__Duration time__StopWatch_elapsed(time__StopWatch t); -time__Time time__now(void); -time__Time time__utc(void); -time__Time time__new_time(time__Time t); -i64 time__ticks(void); -string time__Time_str(time__Time t); -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); -string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_string _const_time__long_days; // inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -Array_string _const_time__long_months; // inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -#define _const_time__days_in_year 365 -Array_int _const_time__days_before; // inited later -string time__Time_smonth(time__Time* t); -i64 time__Time_unix_time(time__Time* t); -i64 time__Time_unix_time_milli(time__Time* t); -time__Time time__Time_add(time__Time* t, time__Duration d); -time__Time time__Time_add_seconds(time__Time* t, int seconds); -time__Time time__Time_add_days(time__Time* t, int days); -time__Duration time__since(time__Time t); -string time__Time_relative(time__Time* t); -string time__Time_relative_short(time__Time* t); -int time__day_of_week(int y, int m, int d); -int time__Time_day_of_week(time__Time* t); -string time__Time_weekday_str(time__Time* t); -string time__Time_long_weekday_str(time__Time* t); -bool time__is_leap_year(int year); -_option_int time__days_in_month(int month, int year); -string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later -i64 time__Duration_nanoseconds(time__Duration d); -i64 time__Duration_microseconds(time__Duration d); -i64 time__Duration_milliseconds(time__Duration d); -f64 time__Duration_seconds(time__Duration d); -f64 time__Duration_minutes(time__Duration d); -f64 time__Duration_hours(time__Duration d); -string time__Duration_str(time__Duration d); -int time__offset(void); -VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void); -time__Time time__darwin_now(void); -time__Time time__solaris_now(void); -time__Time time__darwin_utc(void); -time__Time time__solaris_utc(void); -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); -time__Time time__Time_local(time__Time* t); -u64 time__sys_mono_now(void); -VV_LOCAL_SYMBOL u64 time__vpc_now(void); -VV_LOCAL_SYMBOL time__Time time__linux_now(void); -VV_LOCAL_SYMBOL time__Time time__linux_utc(void); -time__Time time__win_now(void); -time__Time time__win_utc(void); -struct timespec time__Duration_timespec(time__Duration d); -struct timespec time__zero_timespec(void); -void time__sleep(time__Duration duration); -int time__Duration_sys_milliseconds(time__Duration d); -time__Time time__unix(i64 abs); -time__Time time__unix2(i64 abs, int microsecond); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); -_option_string v__util__diff__find_working_diff_command(void); -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); -Array_u32 rand__seed__time_seed_array(int count); -u32 rand__seed__time_seed_32(void); -u64 rand__seed__time_seed_64(void); -u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed -u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed -#define _const_rand__wyrand__seed_len 2 -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); -u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); -u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); -u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); -u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); -int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); +f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed +VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a); +VV_LOCAL_SYMBOL f64 rand__mlog(f64 a); +VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x); +VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_); +VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b); +VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f); Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later string rand__uuid_v4(void); VV_LOCAL_SYMBOL string rand__internal_uuid_v4(rand__PRNG* rng); @@ -9032,6 +8700,11 @@ string rand__PRNG_string_from_set(rand__PRNG* rng, string charset, int len); string rand__PRNG_string(rand__PRNG* rng, int len); string rand__PRNG_hex(rand__PRNG* rng, int len); string rand__PRNG_ascii(rand__PRNG* rng, int len); +_option_bool rand__PRNG_bernoulli(rand__PRNG* rng, f64 p); +_option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct conf); +_option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf); +_option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p); +f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda); rand__PRNG* default_rng; // global4 rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config); rand__PRNG* rand__get_current_rng(void); @@ -9070,6 +8743,11 @@ string rand__string_from_set(string charset, int len); string rand__string(int len); string rand__hex(int len); string rand__ascii(int len); +_option_bool rand__bernoulli(f64 p); +_option_f64 rand__normal(rand__config__NormalConfigStruct conf); +_option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf); +_option_int rand__binomial(int n, f64 p); +f64 rand__exponential(f64 lambda); string _const_v__pref__default_module_path; // inited later v__pref__Preferences* v__pref__new_preferences(void); VV_LOCAL_SYMBOL void v__pref__Preferences_expand_lookup_paths(v__pref__Preferences* p); @@ -9588,6 +9266,7 @@ Array_v__ast__Type _const_v__ast__cptr_types; // inited later Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params); v__ast__Type v__ast__mktyp(v__ast__Type typ); v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ); +bool v__ast__Table_type_is_for_pointer_arithmetic(v__ast__Table* t, v__ast__Type typ); string v__ast__TypeSymbol_str(v__ast__TypeSymbol* t); VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymbol* t, string fname); v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t); @@ -9755,6 +9434,7 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExpr* node, bool* continue_check); v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__CallExpr* node); VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node); +VV_LOCAL_SYMBOL void v__checker__Checker_set_node_expected_arg_types(v__checker__Checker* c, v__ast__CallExpr* node, v__ast__Fn* func); VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* c, string kind, string name, v__ast__Fn the_fn, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__checker__Checker_deprecate(v__checker__Checker* c, string kind, string name, string deprecation_message, time__Time now, time__Time after_time, v__token__Pos pos); VV_LOCAL_SYMBOL string v__checker__semicolonize(string main, string details); @@ -9891,10 +9571,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_struct(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string fn_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string fn_name); VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp); -string v__gen__c__type_to_str(StrIntpType x); -string v__gen__c__data_str(StrIntpType x); string _const_v__gen__c__si_s_code; // a string literal, inited later -VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name); VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__StrType typ); @@ -9916,7 +9593,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string str_fn_name); VV_LOCAL_SYMBOL StrIntpType v__gen__c__Gen_type_to_fmt(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_struct(v__gen__c__Gen* g, v__ast__Struct info, string styp, string str_fn_name); -VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); +VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); +VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x); +VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); Array_string _const_v__gen__c__c_reserved; // inited later Map_string_bool _const_v__gen__c__c_reserved_map; // inited later Array_string _const_v__gen__c__cmp_str; // inited later @@ -10075,6 +9754,7 @@ void v__gen__c__Gen_gen_c_android_sokol_main(v__gen__c__Gen* g); void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g); void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name); void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name); +void v__gen__c__Gen_gen_c_main_profile_hook(v__gen__c__Gen* g); void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g); Array_string v__gen__c__Gen_filter_only_matching_fn_names(v__gen__c__Gen* g, Array_string fnames); VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast__ComptimeSelector node); @@ -10456,7 +10136,6 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui VV_LOCAL_SYMBOL Array_string v__builder__Builder_all_args(v__builder__Builder* v, v__builder__CcompilerOptions ccoptions); VV_LOCAL_SYMBOL Array_string v__builder__Builder_thirdparty_object_args(v__builder__Builder* v, v__builder__CcompilerOptions ccoptions, Array_string middle); VV_LOCAL_SYMBOL void v__builder__Builder_setup_output_name(v__builder__Builder* v); -VV_LOCAL_SYMBOL void v__builder__Builder_dump_c_options(v__builder__Builder* v, Array_string all_args); void v__builder__Builder_cc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_ensure_linuxroot_exists(v__builder__Builder* b, string sysroot); VV_LOCAL_SYMBOL void v__builder__Builder_cc_linux_cross(v__builder__Builder* b); @@ -10478,6 +10157,10 @@ VV_LOCAL_SYMBOL void v__builder__Builder_cleanup_run_executable_after_exit(v__bu void v__builder__Builder_set_module_lookup_paths(v__builder__Builder* v); Array_string v__builder__Builder_get_builtin_files(v__builder__Builder* v); Array_string v__builder__Builder_get_user_files(v__builder__Builder* v); +void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all_args); +void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods); +void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files); +VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list); v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later #define _const_v__builder__key_query_value 1 #define _const_v__builder__key_wow64_32key 512 @@ -10494,6 +10177,8 @@ VV_LOCAL_SYMBOL _option_v__builder__MsvcResult v__builder__find_msvc(bool m64_ta void v__builder__Builder_cc_msvc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__builder__Builder* v, string path, Array_v__cflag__CFlag moduleflags); v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag cflags); +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r); +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r); void v__builder__Builder_rebuild_modules(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL string v__builder__Builder_rebuild_cached_module(v__builder__Builder* b, string vexe, string imp_path); @@ -10626,24 +10311,24 @@ static IError I_Error_to_Interface_IError(Error* x); const int _IError_Error_index = 1; static IError I_MessageError_to_Interface_IError(MessageError* x); const int _IError_MessageError_index = 2; -static IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x); -const int _IError_os__FileNotOpenedError_index = 3; -static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x); -const int _IError_os__SizeOfTypeIs0Error_index = 4; -static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); -const int _IError_os__ExecutableNotFoundError_index = 5; -static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); -const int _IError_flag__UnkownFlagError_index = 6; -static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); -const int _IError_flag__ArgsCountError_index = 7; -static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); -const int _IError_semver__InvalidComparatorFormatError_index = 8; -static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); -const int _IError_semver__EmptyInputError_index = 9; -static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); -const int _IError_semver__InvalidVersionFormatError_index = 10; static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); -const int _IError_time__TimeParseError_index = 11; +const int _IError_time__TimeParseError_index = 3; +static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); +const int _IError_flag__UnkownFlagError_index = 4; +static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); +const int _IError_flag__ArgsCountError_index = 5; +static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); +const int _IError_semver__InvalidComparatorFormatError_index = 6; +static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); +const int _IError_semver__EmptyInputError_index = 7; +static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); +const int _IError_semver__InvalidVersionFormatError_index = 8; +static IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x); +const int _IError_os__FileNotOpenedError_index = 9; +static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x); +const int _IError_os__SizeOfTypeIs0Error_index = 10; +static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); +const int _IError_os__ExecutableNotFoundError_index = 11; static IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x); const int _IError_v__gen__c__UnsupportedAssertCtempTransform_index = 12; // ^^^ number of types for interface IError: 13 @@ -10667,22 +10352,10 @@ static inline string MessageError_msg_Interface_IError_method_wrapper(MessageErr static inline int MessageError_code_Interface_IError_method_wrapper(MessageError* err) { return MessageError_code(*err); } -static inline string os__FileNotOpenedError_msg_Interface_IError_method_wrapper(os__FileNotOpenedError* err) { - return os__FileNotOpenedError_msg(*err); +static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { + return time__TimeParseError_msg(*err); } -static inline int os__FileNotOpenedError_code_Interface_IError_method_wrapper(os__FileNotOpenedError* err) { - return Error_code(err->Error); -} -static inline string os__SizeOfTypeIs0Error_msg_Interface_IError_method_wrapper(os__SizeOfTypeIs0Error* err) { - return os__SizeOfTypeIs0Error_msg(*err); -} -static inline int os__SizeOfTypeIs0Error_code_Interface_IError_method_wrapper(os__SizeOfTypeIs0Error* err) { - return Error_code(err->Error); -} -static inline string os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { - return os__ExecutableNotFoundError_msg(*err); -} -static inline int os__ExecutableNotFoundError_code_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { +static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { return Error_code(err->Error); } static inline string flag__UnkownFlagError_msg_Interface_IError_method_wrapper(flag__UnkownFlagError* err) { @@ -10715,10 +10388,22 @@ static inline string semver__InvalidVersionFormatError_msg_Interface_IError_meth static inline int semver__InvalidVersionFormatError_code_Interface_IError_method_wrapper(semver__InvalidVersionFormatError* err) { return Error_code(err->Error); } -static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { - return time__TimeParseError_msg(*err); +static inline string os__FileNotOpenedError_msg_Interface_IError_method_wrapper(os__FileNotOpenedError* err) { + return os__FileNotOpenedError_msg(*err); } -static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { +static inline int os__FileNotOpenedError_code_Interface_IError_method_wrapper(os__FileNotOpenedError* err) { + return Error_code(err->Error); +} +static inline string os__SizeOfTypeIs0Error_msg_Interface_IError_method_wrapper(os__SizeOfTypeIs0Error* err) { + return os__SizeOfTypeIs0Error_msg(*err); +} +static inline int os__SizeOfTypeIs0Error_code_Interface_IError_method_wrapper(os__SizeOfTypeIs0Error* err) { + return Error_code(err->Error); +} +static inline string os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { + return os__ExecutableNotFoundError_msg(*err); +} +static inline int os__ExecutableNotFoundError_code_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { return Error_code(err->Error); } static inline string v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper(v__gen__c__UnsupportedAssertCtempTransform* err) { @@ -10747,16 +10432,8 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_code = (void*) MessageError_code_Interface_IError_method_wrapper, }, { - ._method_msg = (void*) os__FileNotOpenedError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) os__FileNotOpenedError_code_Interface_IError_method_wrapper, - }, - { - ._method_msg = (void*) os__SizeOfTypeIs0Error_msg_Interface_IError_method_wrapper, - ._method_code = (void*) os__SizeOfTypeIs0Error_code_Interface_IError_method_wrapper, - }, - { - ._method_msg = (void*) os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) os__ExecutableNotFoundError_code_Interface_IError_method_wrapper, + ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, }, { ._method_msg = (void*) flag__UnkownFlagError_msg_Interface_IError_method_wrapper, @@ -10779,8 +10456,16 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_code = (void*) semver__InvalidVersionFormatError_code_Interface_IError_method_wrapper, }, { - ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, + ._method_msg = (void*) os__FileNotOpenedError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) os__FileNotOpenedError_code_Interface_IError_method_wrapper, + }, + { + ._method_msg = (void*) os__SizeOfTypeIs0Error_msg_Interface_IError_method_wrapper, + ._method_code = (void*) os__SizeOfTypeIs0Error_code_Interface_IError_method_wrapper, + }, + { + ._method_msg = (void*) os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) os__ExecutableNotFoundError_code_Interface_IError_method_wrapper, }, { ._method_msg = (void*) v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper, @@ -10819,33 +10504,13 @@ static inline IError I_MessageError_to_Interface_IError(MessageError* x) { }; } -// Casting functions for converting "os__FileNotOpenedError" to interface "IError" -static inline IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x) { +// Casting functions for converting "time__TimeParseError" to interface "IError" +static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { return (IError) { - ._os__FileNotOpenedError = x, - ._typ = _IError_os__FileNotOpenedError_index, + ._time__TimeParseError = x, + ._typ = _IError_time__TimeParseError_index, .msg = (string*)((char*)x), - .code = (int*)((char*)x), - }; -} - -// Casting functions for converting "os__SizeOfTypeIs0Error" to interface "IError" -static inline IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x) { - return (IError) { - ._os__SizeOfTypeIs0Error = x, - ._typ = _IError_os__SizeOfTypeIs0Error_index, - .msg = (string*)((char*)x), - .code = (int*)((char*)x), - }; -} - -// Casting functions for converting "os__ExecutableNotFoundError" to interface "IError" -static inline IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x) { - return (IError) { - ._os__ExecutableNotFoundError = x, - ._typ = _IError_os__ExecutableNotFoundError_index, - .msg = (string*)((char*)x), - .code = (int*)((char*)x), + .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), }; } @@ -10899,13 +10564,33 @@ static inline IError I_semver__InvalidVersionFormatError_to_Interface_IError(sem }; } -// Casting functions for converting "time__TimeParseError" to interface "IError" -static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { +// Casting functions for converting "os__FileNotOpenedError" to interface "IError" +static inline IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x) { return (IError) { - ._time__TimeParseError = x, - ._typ = _IError_time__TimeParseError_index, + ._os__FileNotOpenedError = x, + ._typ = _IError_os__FileNotOpenedError_index, .msg = (string*)((char*)x), - .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), + .code = (int*)((char*)x), + }; +} + +// Casting functions for converting "os__SizeOfTypeIs0Error" to interface "IError" +static inline IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x) { + return (IError) { + ._os__SizeOfTypeIs0Error = x, + ._typ = _IError_os__SizeOfTypeIs0Error_index, + .msg = (string*)((char*)x), + .code = (int*)((char*)x), + }; +} + +// Casting functions for converting "os__ExecutableNotFoundError" to interface "IError" +static inline IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x) { + return (IError) { + ._os__ExecutableNotFoundError = x, + ._typ = _IError_os__ExecutableNotFoundError_index, + .msg = (string*)((char*)x), + .code = (int*)((char*)x), }; } @@ -11100,20 +10785,23 @@ void vinit_string_literals(void){ _const_si_s_code = _SLIT("0xfe10"); _const_si_g32_code = _SLIT("0xfe0e"); _const_si_g64_code = _SLIT("0xfe0f"); - _const_os__path_separator = _SLIT("/"); - _const_os__path_delimiter = _SLIT(":"); + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_flag__space = _SLIT(" "); _const_flag__underline = _SLIT("-----------------------------------------------"); _const_semver__comparator_sep = _SLIT(" "); _const_semver__comparator_set_sep = _SLIT(" || "); _const_semver__hyphen_range_sep = _SLIT(" - "); _const_semver__x_range_symbols = _SLIT("Xx*"); + _const_os__dot_dot = _SLIT(".."); + _const_os__empty_str = _SLIT(""); + _const_os__dot_str = _SLIT("."); + _const_os__path_separator = _SLIT("/"); + _const_os__path_delimiter = _SLIT(":"); _const_v__util__version__v_version = _SLIT("0.2.4"); _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); _const_v__pkgconfig__version = _SLIT("0.3.2"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_rand__ulid_encoding = _SLIT("0123456789ABCDEFGHJKMNPQRSTVWXYZ"); _const_rand__english_letters = _SLIT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); _const_rand__hex_chars = _SLIT("abcdef0123456789"); @@ -11618,59 +11306,59 @@ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) { switch(x._typ) { - case 431: return str_intp(2, _MOV((StrIntpData[]){ + case 433: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Aggregate_str(*(v__ast__Aggregate*)x._v__ast__Aggregate, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 433: return str_intp(2, _MOV((StrIntpData[]){ + case 435: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Alias_str(*(v__ast__Alias*)x._v__ast__Alias, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 413: return str_intp(2, _MOV((StrIntpData[]){ + case 415: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Array_str(*(v__ast__Array*)x._v__ast__Array, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 441: return str_intp(2, _MOV((StrIntpData[]){ + case 443: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__ArrayFixed_str(*(v__ast__ArrayFixed*)x._v__ast__ArrayFixed, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 442: return str_intp(2, _MOV((StrIntpData[]){ + case 444: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Chan_str(*(v__ast__Chan*)x._v__ast__Chan, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 447: return str_intp(2, _MOV((StrIntpData[]){ + case 449: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Enum_str(*(v__ast__Enum*)x._v__ast__Enum, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 445: return str_intp(2, _MOV((StrIntpData[]){ + case 447: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__FnType_str(*(v__ast__FnType*)x._v__ast__FnType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 446: return str_intp(2, _MOV((StrIntpData[]){ + case 448: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__GenericInst_str(*(v__ast__GenericInst*)x._v__ast__GenericInst, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 436: return str_intp(2, _MOV((StrIntpData[]){ + case 438: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Interface_str(*(v__ast__Interface*)x._v__ast__Interface, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 414: return str_intp(2, _MOV((StrIntpData[]){ + case 416: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Map_str(*(v__ast__Map*)x._v__ast__Map, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 444: return str_intp(2, _MOV((StrIntpData[]){ + case 446: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__MultiReturn_str(*(v__ast__MultiReturn*)x._v__ast__MultiReturn, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 418: return str_intp(2, _MOV((StrIntpData[]){ + case 420: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Struct_str(*(v__ast__Struct*)x._v__ast__Struct, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 437: return str_intp(2, _MOV((StrIntpData[]){ + case 439: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__SumType_str(*(v__ast__SumType*)x._v__ast__SumType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 443: return str_intp(2, _MOV((StrIntpData[]){ + case 445: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Thread_str(*(v__ast__Thread*)x._v__ast__Thread, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11781,7 +11469,7 @@ static string indent_v__ast__Enum_str(v__ast__Enum it, int indent_count) { static string indent_v__ast__ComptTimeConstValue_str(v__ast__ComptTimeConstValue x, int indent_count) { switch(x._typ) { - case 264: return str_intp(2, _MOV((StrIntpData[]){ + case 266: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.ComptTimeConstValue("), 0xfe10, {.d_s = indent_v__ast__EmptyExpr_str(*(v__ast__EmptyExpr*)x._v__ast__EmptyExpr, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -12254,32 +11942,32 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ static inline v__ast__Expr v__ast__EmptyExpr_to_sumtype_v__ast__Expr(v__ast__EmptyExpr* x) { v__ast__EmptyExpr* ptr = memdup(x, sizeof(v__ast__EmptyExpr)); - return (v__ast__Expr){ ._v__ast__EmptyExpr = ptr, ._typ = 264}; + return (v__ast__Expr){ ._v__ast__EmptyExpr = ptr, ._typ = 266}; } static inline v__ast__Stmt v__ast__EmptyStmt_to_sumtype_v__ast__Stmt(v__ast__EmptyStmt* x) { v__ast__EmptyStmt* ptr = memdup(x, sizeof(v__ast__EmptyStmt)); - return (v__ast__Stmt){ ._v__ast__EmptyStmt = ptr, ._typ = 306, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EmptyStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__EmptyStmt = ptr, ._typ = 308, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EmptyStmt, pos))}; } static inline v__ast__Node v__ast__EmptyNode_to_sumtype_v__ast__Node(v__ast__EmptyNode* x) { v__ast__EmptyNode* ptr = memdup(x, sizeof(v__ast__EmptyNode)); - return (v__ast__Node){ ._v__ast__EmptyNode = ptr, ._typ = 329}; + return (v__ast__Node){ ._v__ast__EmptyNode = ptr, ._typ = 331}; } static inline v__ast__Node v__ast__Expr_to_sumtype_v__ast__Node(v__ast__Expr* x) { v__ast__Expr* ptr = memdup(x, sizeof(v__ast__Expr)); - return (v__ast__Node){ ._v__ast__Expr = ptr, ._typ = 297}; + return (v__ast__Node){ ._v__ast__Expr = ptr, ._typ = 299}; } static inline v__ast__Node v__ast__Stmt_to_sumtype_v__ast__Node(v__ast__Stmt* x) { v__ast__Stmt* ptr = memdup(x, sizeof(v__ast__Stmt)); - return (v__ast__Node){ ._v__ast__Stmt = ptr, ._typ = 322}; + return (v__ast__Node){ ._v__ast__Stmt = ptr, ._typ = 324}; } static inline v__ast__Node v__ast__StructInitField_to_sumtype_v__ast__Node(v__ast__StructInitField* x) { v__ast__StructInitField* ptr = memdup(x, sizeof(v__ast__StructInitField)); - return (v__ast__Node){ ._v__ast__StructInitField = ptr, ._typ = 336}; + return (v__ast__Node){ ._v__ast__StructInitField = ptr, ._typ = 338}; } static inline v__ast__Stmt v__ast__FnDecl_to_sumtype_v__ast__Stmt(v__ast__FnDecl* x) { @@ -12289,177 +11977,177 @@ static inline v__ast__Stmt v__ast__FnDecl_to_sumtype_v__ast__Stmt(v__ast__FnDecl static inline v__ast__Node v__ast__CallArg_to_sumtype_v__ast__Node(v__ast__CallArg* x) { v__ast__CallArg* ptr = memdup(x, sizeof(v__ast__CallArg)); - return (v__ast__Node){ ._v__ast__CallArg = ptr, ._typ = 328}; + return (v__ast__Node){ ._v__ast__CallArg = ptr, ._typ = 330}; } static inline v__ast__Expr v__ast__OrExpr_to_sumtype_v__ast__Expr(v__ast__OrExpr* x) { v__ast__OrExpr* ptr = memdup(x, sizeof(v__ast__OrExpr)); - return (v__ast__Expr){ ._v__ast__OrExpr = ptr, ._typ = 282}; + return (v__ast__Expr){ ._v__ast__OrExpr = ptr, ._typ = 284}; } static inline v__ast__Node v__ast__IfBranch_to_sumtype_v__ast__Node(v__ast__IfBranch* x) { v__ast__IfBranch* ptr = memdup(x, sizeof(v__ast__IfBranch)); - return (v__ast__Node){ ._v__ast__IfBranch = ptr, ._typ = 331}; + return (v__ast__Node){ ._v__ast__IfBranch = ptr, ._typ = 333}; } static inline v__ast__Node v__ast__MatchBranch_to_sumtype_v__ast__Node(v__ast__MatchBranch* x) { v__ast__MatchBranch* ptr = memdup(x, sizeof(v__ast__MatchBranch)); - return (v__ast__Node){ ._v__ast__MatchBranch = ptr, ._typ = 332}; + return (v__ast__Node){ ._v__ast__MatchBranch = ptr, ._typ = 334}; } static inline v__ast__Node v__ast__SelectBranch_to_sumtype_v__ast__Node(v__ast__SelectBranch* x) { v__ast__SelectBranch* ptr = memdup(x, sizeof(v__ast__SelectBranch)); - return (v__ast__Node){ ._v__ast__SelectBranch = ptr, ._typ = 334}; + return (v__ast__Node){ ._v__ast__SelectBranch = ptr, ._typ = 336}; } static inline v__ast__Node v__ast__StructField_to_sumtype_v__ast__Node(v__ast__StructField* x) { v__ast__StructField* ptr = memdup(x, sizeof(v__ast__StructField)); - return (v__ast__Node){ ._v__ast__StructField = ptr, ._typ = 335}; + return (v__ast__Node){ ._v__ast__StructField = ptr, ._typ = 337}; } static inline v__ast__Node v__ast__GlobalField_to_sumtype_v__ast__Node(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); - return (v__ast__Node){ ._v__ast__GlobalField = ptr, ._typ = 325}; + return (v__ast__Node){ ._v__ast__GlobalField = ptr, ._typ = 327}; } static inline v__ast__Node v__ast__ConstField_to_sumtype_v__ast__Node(v__ast__ConstField* x) { v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__Node){ ._v__ast__ConstField = ptr, ._typ = 324}; + return (v__ast__Node){ ._v__ast__ConstField = ptr, ._typ = 326}; } static inline v__ast__Node v__ast__EnumField_to_sumtype_v__ast__Node(v__ast__EnumField* x) { v__ast__EnumField* ptr = memdup(x, sizeof(v__ast__EnumField)); - return (v__ast__Node){ ._v__ast__EnumField = ptr, ._typ = 330}; + return (v__ast__Node){ ._v__ast__EnumField = ptr, ._typ = 332}; } static inline v__ast__Node v__ast__Param_to_sumtype_v__ast__Node(v__ast__Param* x) { v__ast__Param* ptr = memdup(x, sizeof(v__ast__Param)); - return (v__ast__Node){ ._v__ast__Param = ptr, ._typ = 333}; + return (v__ast__Node){ ._v__ast__Param = ptr, ._typ = 335}; } static inline v__ast__Expr v__ast__TypeNode_to_sumtype_v__ast__Expr(v__ast__TypeNode* x) { v__ast__TypeNode* ptr = memdup(x, sizeof(v__ast__TypeNode)); - return (v__ast__Expr){ ._v__ast__TypeNode = ptr, ._typ = 294}; + return (v__ast__Expr){ ._v__ast__TypeNode = ptr, ._typ = 296}; } static inline v__ast__ScopeObject v__ast__AsmRegister_to_sumtype_v__ast__ScopeObject(v__ast__AsmRegister* x) { v__ast__AsmRegister* ptr = memdup(x, sizeof(v__ast__AsmRegister)); - return (v__ast__ScopeObject){ ._v__ast__AsmRegister = ptr, ._typ = 323, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, typ))}; + return (v__ast__ScopeObject){ ._v__ast__AsmRegister = ptr, ._typ = 325, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, typ))}; } static inline v__ast__ComptTimeConstValue v__ast__EmptyExpr_to_sumtype_v__ast__ComptTimeConstValue(v__ast__EmptyExpr* x) { v__ast__EmptyExpr* ptr = memdup(x, sizeof(v__ast__EmptyExpr)); - return (v__ast__ComptTimeConstValue){ ._v__ast__EmptyExpr = ptr, ._typ = 264}; + return (v__ast__ComptTimeConstValue){ ._v__ast__EmptyExpr = ptr, ._typ = 266}; } static inline v__ast__Expr v__ast__ArrayInit_to_sumtype_v__ast__Expr(v__ast__ArrayInit* x) { v__ast__ArrayInit* ptr = memdup(x, sizeof(v__ast__ArrayInit)); - return (v__ast__Expr){ ._v__ast__ArrayInit = ptr, ._typ = 248}; + return (v__ast__Expr){ ._v__ast__ArrayInit = ptr, ._typ = 250}; } static inline v__ast__Expr v__ast__StringLiteral_to_sumtype_v__ast__Expr(v__ast__StringLiteral* x) { v__ast__StringLiteral* ptr = memdup(x, sizeof(v__ast__StringLiteral)); - return (v__ast__Expr){ ._v__ast__StringLiteral = ptr, ._typ = 292}; + return (v__ast__Expr){ ._v__ast__StringLiteral = ptr, ._typ = 294}; } static inline v__ast__Expr v__ast__MapInit_to_sumtype_v__ast__Expr(v__ast__MapInit* x) { v__ast__MapInit* ptr = memdup(x, sizeof(v__ast__MapInit)); - return (v__ast__Expr){ ._v__ast__MapInit = ptr, ._typ = 277}; + return (v__ast__Expr){ ._v__ast__MapInit = ptr, ._typ = 279}; } static inline v__ast__Expr v__ast__StructInit_to_sumtype_v__ast__Expr(v__ast__StructInit* x) { v__ast__StructInit* ptr = memdup(x, sizeof(v__ast__StructInit)); - return (v__ast__Expr){ ._v__ast__StructInit = ptr, ._typ = 293}; + return (v__ast__Expr){ ._v__ast__StructInit = ptr, ._typ = 295}; } static inline v__ast__TypeInfo v__ast__SumType_to_sumtype_v__ast__TypeInfo(v__ast__SumType* x) { v__ast__SumType* ptr = memdup(x, sizeof(v__ast__SumType)); - return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 437}; + return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 439}; } static inline v__ast__TypeInfo v__ast__Chan_to_sumtype_v__ast__TypeInfo(v__ast__Chan* x) { v__ast__Chan* ptr = memdup(x, sizeof(v__ast__Chan)); - return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 442}; + return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 444}; } static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__Map* x) { v__ast__Map* ptr = memdup(x, sizeof(v__ast__Map)); - return (v__ast__TypeInfo){ ._v__ast__Map = ptr, ._typ = 414}; + return (v__ast__TypeInfo){ ._v__ast__Map = ptr, ._typ = 416}; } static inline v__ast__TypeInfo v__ast__Thread_to_sumtype_v__ast__TypeInfo(v__ast__Thread* x) { v__ast__Thread* ptr = memdup(x, sizeof(v__ast__Thread)); - return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 443}; + return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 445}; } static inline v__ast__TypeInfo v__ast__Struct_to_sumtype_v__ast__TypeInfo(v__ast__Struct* x) { v__ast__Struct* ptr = memdup(x, sizeof(v__ast__Struct)); - return (v__ast__TypeInfo){ ._v__ast__Struct = ptr, ._typ = 418}; + return (v__ast__TypeInfo){ ._v__ast__Struct = ptr, ._typ = 420}; } static inline v__ast__TypeInfo v__ast__Array_to_sumtype_v__ast__TypeInfo(v__ast__Array* x) { v__ast__Array* ptr = memdup(x, sizeof(v__ast__Array)); - return (v__ast__TypeInfo){ ._v__ast__Array = ptr, ._typ = 413}; + return (v__ast__TypeInfo){ ._v__ast__Array = ptr, ._typ = 415}; } static inline v__ast__TypeInfo v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(v__ast__ArrayFixed* x) { v__ast__ArrayFixed* ptr = memdup(x, sizeof(v__ast__ArrayFixed)); - return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 441}; + return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 443}; } static inline v__ast__TypeInfo v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(v__ast__MultiReturn* x) { v__ast__MultiReturn* ptr = memdup(x, sizeof(v__ast__MultiReturn)); - return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 444}; + return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 446}; } static inline v__ast__TypeInfo v__ast__FnType_to_sumtype_v__ast__TypeInfo(v__ast__FnType* x) { v__ast__FnType* ptr = memdup(x, sizeof(v__ast__FnType)); - return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 445}; + return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 447}; } static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) { v__ast__None* ptr = memdup(x, sizeof(v__ast__None)); - return (v__ast__Expr){ ._v__ast__None = ptr, ._typ = 280}; + return (v__ast__Expr){ ._v__ast__None = ptr, ._typ = 282}; } static inline v__ast__TypeInfo v__ast__Interface_to_sumtype_v__ast__TypeInfo(v__ast__Interface* x) { v__ast__Interface* ptr = memdup(x, sizeof(v__ast__Interface)); - return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 436}; + return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 438}; } static inline v__ast__IdentInfo v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(v__ast__IdentVar* x) { v__ast__IdentVar* ptr = memdup(x, sizeof(v__ast__IdentVar)); - return (v__ast__IdentInfo){ ._v__ast__IdentVar = ptr, ._typ = 378}; + return (v__ast__IdentInfo){ ._v__ast__IdentVar = ptr, ._typ = 380}; } static inline v__ast__Expr v__ast__InfixExpr_to_sumtype_v__ast__Expr(v__ast__InfixExpr* x) { v__ast__InfixExpr* ptr = memdup(x, sizeof(v__ast__InfixExpr)); - return (v__ast__Expr){ ._v__ast__InfixExpr = ptr, ._typ = 272}; + return (v__ast__Expr){ ._v__ast__InfixExpr = ptr, ._typ = 274}; } static inline v__ast__Expr v__ast__CastExpr_to_sumtype_v__ast__Expr(v__ast__CastExpr* x) { v__ast__CastExpr* ptr = memdup(x, sizeof(v__ast__CastExpr)); - return (v__ast__Expr){ ._v__ast__CastExpr = ptr, ._typ = 255}; + return (v__ast__Expr){ ._v__ast__CastExpr = ptr, ._typ = 257}; } static inline v__ast__AsmArg v__ast__AsmRegister_to_sumtype_v__ast__AsmArg(v__ast__AsmRegister* x) { v__ast__AsmRegister* ptr = memdup(x, sizeof(v__ast__AsmRegister)); - return (v__ast__AsmArg){ ._v__ast__AsmRegister = ptr, ._typ = 323}; + return (v__ast__AsmArg){ ._v__ast__AsmRegister = ptr, ._typ = 325}; } static inline v__ast__ScopeObject v__ast__Var_to_sumtype_v__ast__ScopeObject(v__ast__Var* x) { v__ast__Var* ptr = memdup(x, sizeof(v__ast__Var)); - return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 326, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; + return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 328, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; } static inline v__ast__IdentInfo v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(v__ast__IdentFn* x) { v__ast__IdentFn* ptr = memdup(x, sizeof(v__ast__IdentFn)); - return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 377}; + return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 379}; } static inline v__ast__Expr v__ast__IndexExpr_to_sumtype_v__ast__Expr(v__ast__IndexExpr* x) { v__ast__IndexExpr* ptr = memdup(x, sizeof(v__ast__IndexExpr)); - return (v__ast__Expr){ ._v__ast__IndexExpr = ptr, ._typ = 271}; + return (v__ast__Expr){ ._v__ast__IndexExpr = ptr, ._typ = 273}; } static inline v__ast__ComptTimeConstValue int_to_sumtype_v__ast__ComptTimeConstValue(int* x) { @@ -12524,397 +12212,397 @@ static inline v__ast__ComptTimeConstValue f32_to_sumtype_v__ast__ComptTimeConstV static inline v__ast__Stmt v__ast__Return_to_sumtype_v__ast__Stmt(v__ast__Return* x) { v__ast__Return* ptr = memdup(x, sizeof(v__ast__Return)); - return (v__ast__Stmt){ ._v__ast__Return = ptr, ._typ = 319, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Return, pos))}; + return (v__ast__Stmt){ ._v__ast__Return = ptr, ._typ = 321, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Return, pos))}; } static inline v__ast__TypeInfo v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(v__ast__Aggregate* x) { v__ast__Aggregate* ptr = memdup(x, sizeof(v__ast__Aggregate)); - return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 431}; + return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 433}; } static inline v__ast__Expr v__ast__Ident_to_sumtype_v__ast__Expr(v__ast__Ident* x) { v__ast__Ident* ptr = memdup(x, sizeof(v__ast__Ident)); - return (v__ast__Expr){ ._v__ast__Ident = ptr, ._typ = 268}; + return (v__ast__Expr){ ._v__ast__Ident = ptr, ._typ = 270}; } static inline v__ast__Stmt v__ast__AssertStmt_to_sumtype_v__ast__Stmt(v__ast__AssertStmt* x) { v__ast__AssertStmt* ptr = memdup(x, sizeof(v__ast__AssertStmt)); - return (v__ast__Stmt){ ._v__ast__AssertStmt = ptr, ._typ = 299, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssertStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AssertStmt = ptr, ._typ = 301, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssertStmt, pos))}; } static inline v__ast__Expr v__ast__IfExpr_to_sumtype_v__ast__Expr(v__ast__IfExpr* x) { v__ast__IfExpr* ptr = memdup(x, sizeof(v__ast__IfExpr)); - return (v__ast__Expr){ ._v__ast__IfExpr = ptr, ._typ = 269}; + return (v__ast__Expr){ ._v__ast__IfExpr = ptr, ._typ = 271}; } static inline v__ast__Expr v__ast__BoolLiteral_to_sumtype_v__ast__Expr(v__ast__BoolLiteral* x) { v__ast__BoolLiteral* ptr = memdup(x, sizeof(v__ast__BoolLiteral)); - return (v__ast__Expr){ ._v__ast__BoolLiteral = ptr, ._typ = 252}; + return (v__ast__Expr){ ._v__ast__BoolLiteral = ptr, ._typ = 254}; } static inline v__ast__Expr v__ast__MatchExpr_to_sumtype_v__ast__Expr(v__ast__MatchExpr* x) { v__ast__MatchExpr* ptr = memdup(x, sizeof(v__ast__MatchExpr)); - return (v__ast__Expr){ ._v__ast__MatchExpr = ptr, ._typ = 278}; + return (v__ast__Expr){ ._v__ast__MatchExpr = ptr, ._typ = 280}; } static inline v__ast__Stmt v__ast__ForCStmt_to_sumtype_v__ast__Stmt(v__ast__ForCStmt* x) { v__ast__ForCStmt* ptr = memdup(x, sizeof(v__ast__ForCStmt)); - return (v__ast__Stmt){ ._v__ast__ForCStmt = ptr, ._typ = 309, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForCStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForCStmt = ptr, ._typ = 311, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForCStmt, pos))}; } static inline v__ast__Stmt v__ast__ForStmt_to_sumtype_v__ast__Stmt(v__ast__ForStmt* x) { v__ast__ForStmt* ptr = memdup(x, sizeof(v__ast__ForStmt)); - return (v__ast__Stmt){ ._v__ast__ForStmt = ptr, ._typ = 311, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForStmt = ptr, ._typ = 313, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForStmt, pos))}; } static inline v__ast__Stmt v__ast__InterfaceDecl_to_sumtype_v__ast__Stmt(v__ast__InterfaceDecl* x) { v__ast__InterfaceDecl* ptr = memdup(x, sizeof(v__ast__InterfaceDecl)); - return (v__ast__Stmt){ ._v__ast__InterfaceDecl = ptr, ._typ = 317, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__InterfaceDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__InterfaceDecl = ptr, ._typ = 319, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__InterfaceDecl, pos))}; } static inline v__ast__Expr v__ast__CallExpr_to_sumtype_v__ast__Expr(v__ast__CallExpr* x) { v__ast__CallExpr* ptr = memdup(x, sizeof(v__ast__CallExpr)); - return (v__ast__Expr){ ._v__ast__CallExpr = ptr, ._typ = 254}; + return (v__ast__Expr){ ._v__ast__CallExpr = ptr, ._typ = 256}; } static inline v__ast__Expr v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(v__ast__IntegerLiteral* x) { v__ast__IntegerLiteral* ptr = memdup(x, sizeof(v__ast__IntegerLiteral)); - return (v__ast__Expr){ ._v__ast__IntegerLiteral = ptr, ._typ = 273}; + return (v__ast__Expr){ ._v__ast__IntegerLiteral = ptr, ._typ = 275}; } static inline v__ast__Expr v__ast__FloatLiteral_to_sumtype_v__ast__Expr(v__ast__FloatLiteral* x) { v__ast__FloatLiteral* ptr = memdup(x, sizeof(v__ast__FloatLiteral)); - return (v__ast__Expr){ ._v__ast__FloatLiteral = ptr, ._typ = 266}; + return (v__ast__Expr){ ._v__ast__FloatLiteral = ptr, ._typ = 268}; } static inline v__ast__Expr v__ast__SqlExpr_to_sumtype_v__ast__Expr(v__ast__SqlExpr* x) { v__ast__SqlExpr* ptr = memdup(x, sizeof(v__ast__SqlExpr)); - return (v__ast__Expr){ ._v__ast__SqlExpr = ptr, ._typ = 290}; + return (v__ast__Expr){ ._v__ast__SqlExpr = ptr, ._typ = 292}; } static inline v__ast__Expr v__ast__CTempVar_to_sumtype_v__ast__Expr(v__ast__CTempVar* x) { v__ast__CTempVar* ptr = memdup(x, sizeof(v__ast__CTempVar)); - return (v__ast__Expr){ ._v__ast__CTempVar = ptr, ._typ = 253}; + return (v__ast__Expr){ ._v__ast__CTempVar = ptr, ._typ = 255}; } static inline v__ast__Expr v__ast__SelectorExpr_to_sumtype_v__ast__Expr(v__ast__SelectorExpr* x) { v__ast__SelectorExpr* ptr = memdup(x, sizeof(v__ast__SelectorExpr)); - return (v__ast__Expr){ ._v__ast__SelectorExpr = ptr, ._typ = 288}; + return (v__ast__Expr){ ._v__ast__SelectorExpr = ptr, ._typ = 290}; } static inline v__ast__Stmt v__ast__ForInStmt_to_sumtype_v__ast__Stmt(v__ast__ForInStmt* x) { v__ast__ForInStmt* ptr = memdup(x, sizeof(v__ast__ForInStmt)); - return (v__ast__Stmt){ ._v__ast__ForInStmt = ptr, ._typ = 310, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForInStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForInStmt = ptr, ._typ = 312, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForInStmt, pos))}; } static inline v__ast__Stmt v__ast__ExprStmt_to_sumtype_v__ast__Stmt(v__ast__ExprStmt* x) { v__ast__ExprStmt* ptr = memdup(x, sizeof(v__ast__ExprStmt)); - return (v__ast__Stmt){ ._v__ast__ExprStmt = ptr, ._typ = 308, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ExprStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ExprStmt = ptr, ._typ = 310, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ExprStmt, pos))}; } static inline v__ast__Stmt v__ast__NodeError_to_sumtype_v__ast__Stmt(v__ast__NodeError* x) { v__ast__NodeError* ptr = memdup(x, sizeof(v__ast__NodeError)); - return (v__ast__Stmt){ ._v__ast__NodeError = ptr, ._typ = 279, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__NodeError, pos))}; + return (v__ast__Stmt){ ._v__ast__NodeError = ptr, ._typ = 281, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__NodeError, pos))}; } static inline v__ast__Stmt v__ast__AssignStmt_to_sumtype_v__ast__Stmt(v__ast__AssignStmt* x) { v__ast__AssignStmt* ptr = memdup(x, sizeof(v__ast__AssignStmt)); - return (v__ast__Stmt){ ._v__ast__AssignStmt = ptr, ._typ = 300, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssignStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AssignStmt = ptr, ._typ = 302, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssignStmt, pos))}; } static inline v__ast__Expr v__ast__ComptimeCall_to_sumtype_v__ast__Expr(v__ast__ComptimeCall* x) { v__ast__ComptimeCall* ptr = memdup(x, sizeof(v__ast__ComptimeCall)); - return (v__ast__Expr){ ._v__ast__ComptimeCall = ptr, ._typ = 259}; + return (v__ast__Expr){ ._v__ast__ComptimeCall = ptr, ._typ = 261}; } static inline v__ast__Expr v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(v__ast__ComptimeSelector* x) { v__ast__ComptimeSelector* ptr = memdup(x, sizeof(v__ast__ComptimeSelector)); - return (v__ast__Expr){ ._v__ast__ComptimeSelector = ptr, ._typ = 260}; + return (v__ast__Expr){ ._v__ast__ComptimeSelector = ptr, ._typ = 262}; } static inline v__ast__Expr v__ast__NodeError_to_sumtype_v__ast__Expr(v__ast__NodeError* x) { v__ast__NodeError* ptr = memdup(x, sizeof(v__ast__NodeError)); - return (v__ast__Expr){ ._v__ast__NodeError = ptr, ._typ = 279}; + return (v__ast__Expr){ ._v__ast__NodeError = ptr, ._typ = 281}; } static inline v__ast__Expr v__ast__Comment_to_sumtype_v__ast__Expr(v__ast__Comment* x) { v__ast__Comment* ptr = memdup(x, sizeof(v__ast__Comment)); - return (v__ast__Expr){ ._v__ast__Comment = ptr, ._typ = 258}; + return (v__ast__Expr){ ._v__ast__Comment = ptr, ._typ = 260}; } static inline v__ast__Expr v__ast__EnumVal_to_sumtype_v__ast__Expr(v__ast__EnumVal* x) { v__ast__EnumVal* ptr = memdup(x, sizeof(v__ast__EnumVal)); - return (v__ast__Expr){ ._v__ast__EnumVal = ptr, ._typ = 265}; + return (v__ast__Expr){ ._v__ast__EnumVal = ptr, ._typ = 267}; } static inline v__ast__Expr v__ast__AtExpr_to_sumtype_v__ast__Expr(v__ast__AtExpr* x) { v__ast__AtExpr* ptr = memdup(x, sizeof(v__ast__AtExpr)); - return (v__ast__Expr){ ._v__ast__AtExpr = ptr, ._typ = 251}; + return (v__ast__Expr){ ._v__ast__AtExpr = ptr, ._typ = 253}; } static inline v__ast__Expr v__ast__ComptimeType_to_sumtype_v__ast__Expr(v__ast__ComptimeType* x) { v__ast__ComptimeType* ptr = memdup(x, sizeof(v__ast__ComptimeType)); - return (v__ast__Expr){ ._v__ast__ComptimeType = ptr, ._typ = 261}; + return (v__ast__Expr){ ._v__ast__ComptimeType = ptr, ._typ = 263}; } static inline v__ast__Expr v__ast__CharLiteral_to_sumtype_v__ast__Expr(v__ast__CharLiteral* x) { v__ast__CharLiteral* ptr = memdup(x, sizeof(v__ast__CharLiteral)); - return (v__ast__Expr){ ._v__ast__CharLiteral = ptr, ._typ = 257}; + return (v__ast__Expr){ ._v__ast__CharLiteral = ptr, ._typ = 259}; } static inline v__ast__Expr v__ast__GoExpr_to_sumtype_v__ast__Expr(v__ast__GoExpr* x) { v__ast__GoExpr* ptr = memdup(x, sizeof(v__ast__GoExpr)); - return (v__ast__Expr){ ._v__ast__GoExpr = ptr, ._typ = 267}; + return (v__ast__Expr){ ._v__ast__GoExpr = ptr, ._typ = 269}; } static inline v__ast__Expr v__ast__SelectExpr_to_sumtype_v__ast__Expr(v__ast__SelectExpr* x) { v__ast__SelectExpr* ptr = memdup(x, sizeof(v__ast__SelectExpr)); - return (v__ast__Expr){ ._v__ast__SelectExpr = ptr, ._typ = 287}; + return (v__ast__Expr){ ._v__ast__SelectExpr = ptr, ._typ = 289}; } static inline v__ast__Expr v__ast__ParExpr_to_sumtype_v__ast__Expr(v__ast__ParExpr* x) { v__ast__ParExpr* ptr = memdup(x, sizeof(v__ast__ParExpr)); - return (v__ast__Expr){ ._v__ast__ParExpr = ptr, ._typ = 283}; + return (v__ast__Expr){ ._v__ast__ParExpr = ptr, ._typ = 285}; } static inline v__ast__Expr v__ast__UnsafeExpr_to_sumtype_v__ast__Expr(v__ast__UnsafeExpr* x) { v__ast__UnsafeExpr* ptr = memdup(x, sizeof(v__ast__UnsafeExpr)); - return (v__ast__Expr){ ._v__ast__UnsafeExpr = ptr, ._typ = 296}; + return (v__ast__Expr){ ._v__ast__UnsafeExpr = ptr, ._typ = 298}; } static inline v__ast__Expr v__ast__LockExpr_to_sumtype_v__ast__Expr(v__ast__LockExpr* x) { v__ast__LockExpr* ptr = memdup(x, sizeof(v__ast__LockExpr)); - return (v__ast__Expr){ ._v__ast__LockExpr = ptr, ._typ = 276}; + return (v__ast__Expr){ ._v__ast__LockExpr = ptr, ._typ = 278}; } static inline v__ast__Expr v__ast__IsRefType_to_sumtype_v__ast__Expr(v__ast__IsRefType* x) { v__ast__IsRefType* ptr = memdup(x, sizeof(v__ast__IsRefType)); - return (v__ast__Expr){ ._v__ast__IsRefType = ptr, ._typ = 274}; + return (v__ast__Expr){ ._v__ast__IsRefType = ptr, ._typ = 276}; } static inline v__ast__Expr v__ast__SizeOf_to_sumtype_v__ast__Expr(v__ast__SizeOf* x) { v__ast__SizeOf* ptr = memdup(x, sizeof(v__ast__SizeOf)); - return (v__ast__Expr){ ._v__ast__SizeOf = ptr, ._typ = 289}; + return (v__ast__Expr){ ._v__ast__SizeOf = ptr, ._typ = 291}; } static inline v__ast__Expr v__ast__TypeOf_to_sumtype_v__ast__Expr(v__ast__TypeOf* x) { v__ast__TypeOf* ptr = memdup(x, sizeof(v__ast__TypeOf)); - return (v__ast__Expr){ ._v__ast__TypeOf = ptr, ._typ = 295}; + return (v__ast__Expr){ ._v__ast__TypeOf = ptr, ._typ = 297}; } static inline v__ast__Expr v__ast__DumpExpr_to_sumtype_v__ast__Expr(v__ast__DumpExpr* x) { v__ast__DumpExpr* ptr = memdup(x, sizeof(v__ast__DumpExpr)); - return (v__ast__Expr){ ._v__ast__DumpExpr = ptr, ._typ = 263}; + return (v__ast__Expr){ ._v__ast__DumpExpr = ptr, ._typ = 265}; } static inline v__ast__Expr v__ast__OffsetOf_to_sumtype_v__ast__Expr(v__ast__OffsetOf* x) { v__ast__OffsetOf* ptr = memdup(x, sizeof(v__ast__OffsetOf)); - return (v__ast__Expr){ ._v__ast__OffsetOf = ptr, ._typ = 281}; + return (v__ast__Expr){ ._v__ast__OffsetOf = ptr, ._typ = 283}; } static inline v__ast__Expr v__ast__Likely_to_sumtype_v__ast__Expr(v__ast__Likely* x) { v__ast__Likely* ptr = memdup(x, sizeof(v__ast__Likely)); - return (v__ast__Expr){ ._v__ast__Likely = ptr, ._typ = 275}; + return (v__ast__Expr){ ._v__ast__Likely = ptr, ._typ = 277}; } static inline v__ast__Expr v__ast__AnonFn_to_sumtype_v__ast__Expr(v__ast__AnonFn* x) { v__ast__AnonFn* ptr = memdup(x, sizeof(v__ast__AnonFn)); - return (v__ast__Expr){ ._v__ast__AnonFn = ptr, ._typ = 246}; + return (v__ast__Expr){ ._v__ast__AnonFn = ptr, ._typ = 248}; } static inline v__ast__Expr v__ast__AsCast_to_sumtype_v__ast__Expr(v__ast__AsCast* x) { v__ast__AsCast* ptr = memdup(x, sizeof(v__ast__AsCast)); - return (v__ast__Expr){ ._v__ast__AsCast = ptr, ._typ = 249}; + return (v__ast__Expr){ ._v__ast__AsCast = ptr, ._typ = 251}; } static inline v__ast__Expr v__ast__PostfixExpr_to_sumtype_v__ast__Expr(v__ast__PostfixExpr* x) { v__ast__PostfixExpr* ptr = memdup(x, sizeof(v__ast__PostfixExpr)); - return (v__ast__Expr){ ._v__ast__PostfixExpr = ptr, ._typ = 284}; + return (v__ast__Expr){ ._v__ast__PostfixExpr = ptr, ._typ = 286}; } static inline v__ast__Expr v__ast__PrefixExpr_to_sumtype_v__ast__Expr(v__ast__PrefixExpr* x) { v__ast__PrefixExpr* ptr = memdup(x, sizeof(v__ast__PrefixExpr)); - return (v__ast__Expr){ ._v__ast__PrefixExpr = ptr, ._typ = 285}; + return (v__ast__Expr){ ._v__ast__PrefixExpr = ptr, ._typ = 287}; } static inline v__ast__Expr v__ast__ArrayDecompose_to_sumtype_v__ast__Expr(v__ast__ArrayDecompose* x) { v__ast__ArrayDecompose* ptr = memdup(x, sizeof(v__ast__ArrayDecompose)); - return (v__ast__Expr){ ._v__ast__ArrayDecompose = ptr, ._typ = 247}; + return (v__ast__Expr){ ._v__ast__ArrayDecompose = ptr, ._typ = 249}; } static inline v__ast__Expr v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(v__ast__IfGuardExpr* x) { v__ast__IfGuardExpr* ptr = memdup(x, sizeof(v__ast__IfGuardExpr)); - return (v__ast__Expr){ ._v__ast__IfGuardExpr = ptr, ._typ = 270}; + return (v__ast__Expr){ ._v__ast__IfGuardExpr = ptr, ._typ = 272}; } static inline v__ast__Expr v__ast__RangeExpr_to_sumtype_v__ast__Expr(v__ast__RangeExpr* x) { v__ast__RangeExpr* ptr = memdup(x, sizeof(v__ast__RangeExpr)); - return (v__ast__Expr){ ._v__ast__RangeExpr = ptr, ._typ = 286}; + return (v__ast__Expr){ ._v__ast__RangeExpr = ptr, ._typ = 288}; } static inline v__ast__TypeInfo v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(v__ast__GenericInst* x) { v__ast__GenericInst* ptr = memdup(x, sizeof(v__ast__GenericInst)); - return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 446}; + return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 448}; } static inline v__ast__Stmt v__ast__Module_to_sumtype_v__ast__Stmt(v__ast__Module* x) { v__ast__Module* ptr = memdup(x, sizeof(v__ast__Module)); - return (v__ast__Stmt){ ._v__ast__Module = ptr, ._typ = 318, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Module, pos))}; + return (v__ast__Stmt){ ._v__ast__Module = ptr, ._typ = 320, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Module, pos))}; } static inline v__ast__Stmt v__ast__Import_to_sumtype_v__ast__Stmt(v__ast__Import* x) { v__ast__Import* ptr = memdup(x, sizeof(v__ast__Import)); - return (v__ast__Stmt){ ._v__ast__Import = ptr, ._typ = 316, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Import, pos))}; + return (v__ast__Stmt){ ._v__ast__Import = ptr, ._typ = 318, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Import, pos))}; } static inline v__ast__Stmt v__ast__ConstDecl_to_sumtype_v__ast__Stmt(v__ast__ConstDecl* x) { v__ast__ConstDecl* ptr = memdup(x, sizeof(v__ast__ConstDecl)); - return (v__ast__Stmt){ ._v__ast__ConstDecl = ptr, ._typ = 304, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__ConstDecl = ptr, ._typ = 306, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstDecl, pos))}; } static inline v__ast__Stmt v__ast__StructDecl_to_sumtype_v__ast__Stmt(v__ast__StructDecl* x) { v__ast__StructDecl* ptr = memdup(x, sizeof(v__ast__StructDecl)); - return (v__ast__Stmt){ ._v__ast__StructDecl = ptr, ._typ = 321, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__StructDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__StructDecl = ptr, ._typ = 323, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__StructDecl, pos))}; } static inline v__ast__Stmt v__ast__EnumDecl_to_sumtype_v__ast__Stmt(v__ast__EnumDecl* x) { v__ast__EnumDecl* ptr = memdup(x, sizeof(v__ast__EnumDecl)); - return (v__ast__Stmt){ ._v__ast__EnumDecl = ptr, ._typ = 307, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EnumDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__EnumDecl = ptr, ._typ = 309, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EnumDecl, pos))}; } static inline v__ast__Stmt v__ast__TypeDecl_to_sumtype_v__ast__Stmt(v__ast__TypeDecl* x) { v__ast__TypeDecl* ptr = memdup(x, sizeof(v__ast__TypeDecl)); - return (v__ast__Stmt){ ._v__ast__TypeDecl = ptr, ._typ = 245, .pos = ptr->pos}; + return (v__ast__Stmt){ ._v__ast__TypeDecl = ptr, ._typ = 247, .pos = ptr->pos}; } static inline v__ast__Stmt v__ast__AsmStmt_to_sumtype_v__ast__Stmt(v__ast__AsmStmt* x) { v__ast__AsmStmt* ptr = memdup(x, sizeof(v__ast__AsmStmt)); - return (v__ast__Stmt){ ._v__ast__AsmStmt = ptr, ._typ = 298, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AsmStmt = ptr, ._typ = 300, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmStmt, pos))}; } static inline v__ast__Stmt v__ast__GlobalDecl_to_sumtype_v__ast__Stmt(v__ast__GlobalDecl* x) { v__ast__GlobalDecl* ptr = memdup(x, sizeof(v__ast__GlobalDecl)); - return (v__ast__Stmt){ ._v__ast__GlobalDecl = ptr, ._typ = 312, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__GlobalDecl = ptr, ._typ = 314, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalDecl, pos))}; } static inline v__ast__Stmt v__ast__HashStmt_to_sumtype_v__ast__Stmt(v__ast__HashStmt* x) { v__ast__HashStmt* ptr = memdup(x, sizeof(v__ast__HashStmt)); - return (v__ast__Stmt){ ._v__ast__HashStmt = ptr, ._typ = 315, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__HashStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__HashStmt = ptr, ._typ = 317, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__HashStmt, pos))}; } static inline v__ast__Stmt v__ast__Block_to_sumtype_v__ast__Stmt(v__ast__Block* x) { v__ast__Block* ptr = memdup(x, sizeof(v__ast__Block)); - return (v__ast__Stmt){ ._v__ast__Block = ptr, ._typ = 301, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Block, pos))}; + return (v__ast__Stmt){ ._v__ast__Block = ptr, ._typ = 303, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Block, pos))}; } static inline v__ast__Stmt v__ast__SqlStmt_to_sumtype_v__ast__Stmt(v__ast__SqlStmt* x) { v__ast__SqlStmt* ptr = memdup(x, sizeof(v__ast__SqlStmt)); - return (v__ast__Stmt){ ._v__ast__SqlStmt = ptr, ._typ = 320, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SqlStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__SqlStmt = ptr, ._typ = 322, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SqlStmt, pos))}; } static inline v__ast__Stmt v__ast__GotoLabel_to_sumtype_v__ast__Stmt(v__ast__GotoLabel* x) { v__ast__GotoLabel* ptr = memdup(x, sizeof(v__ast__GotoLabel)); - return (v__ast__Stmt){ ._v__ast__GotoLabel = ptr, ._typ = 313, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoLabel, pos))}; + return (v__ast__Stmt){ ._v__ast__GotoLabel = ptr, ._typ = 315, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoLabel, pos))}; } static inline v__ast__Stmt v__ast__ComptimeFor_to_sumtype_v__ast__Stmt(v__ast__ComptimeFor* x) { v__ast__ComptimeFor* ptr = memdup(x, sizeof(v__ast__ComptimeFor)); - return (v__ast__Stmt){ ._v__ast__ComptimeFor = ptr, ._typ = 303, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ComptimeFor, pos))}; + return (v__ast__Stmt){ ._v__ast__ComptimeFor = ptr, ._typ = 305, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ComptimeFor, pos))}; } static inline v__ast__Stmt v__ast__BranchStmt_to_sumtype_v__ast__Stmt(v__ast__BranchStmt* x) { v__ast__BranchStmt* ptr = memdup(x, sizeof(v__ast__BranchStmt)); - return (v__ast__Stmt){ ._v__ast__BranchStmt = ptr, ._typ = 302, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__BranchStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__BranchStmt = ptr, ._typ = 304, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__BranchStmt, pos))}; } static inline v__ast__Stmt v__ast__DeferStmt_to_sumtype_v__ast__Stmt(v__ast__DeferStmt* x) { v__ast__DeferStmt* ptr = memdup(x, sizeof(v__ast__DeferStmt)); - return (v__ast__Stmt){ ._v__ast__DeferStmt = ptr, ._typ = 305, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__DeferStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__DeferStmt = ptr, ._typ = 307, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__DeferStmt, pos))}; } static inline v__ast__Stmt v__ast__GotoStmt_to_sumtype_v__ast__Stmt(v__ast__GotoStmt* x) { v__ast__GotoStmt* ptr = memdup(x, sizeof(v__ast__GotoStmt)); - return (v__ast__Stmt){ ._v__ast__GotoStmt = ptr, ._typ = 314, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__GotoStmt = ptr, ._typ = 316, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoStmt, pos))}; } static inline v__ast__AsmArg v__ast__FloatLiteral_to_sumtype_v__ast__AsmArg(v__ast__FloatLiteral* x) { v__ast__FloatLiteral* ptr = memdup(x, sizeof(v__ast__FloatLiteral)); - return (v__ast__AsmArg){ ._v__ast__FloatLiteral = ptr, ._typ = 266}; + return (v__ast__AsmArg){ ._v__ast__FloatLiteral = ptr, ._typ = 268}; } static inline v__ast__AsmArg v__ast__AsmDisp_to_sumtype_v__ast__AsmArg(v__ast__AsmDisp* x) { v__ast__AsmDisp* ptr = memdup(x, sizeof(v__ast__AsmDisp)); - return (v__ast__AsmArg){ ._v__ast__AsmDisp = ptr, ._typ = 400}; + return (v__ast__AsmArg){ ._v__ast__AsmDisp = ptr, ._typ = 402}; } static inline v__ast__AsmArg v__ast__IntegerLiteral_to_sumtype_v__ast__AsmArg(v__ast__IntegerLiteral* x) { v__ast__IntegerLiteral* ptr = memdup(x, sizeof(v__ast__IntegerLiteral)); - return (v__ast__AsmArg){ ._v__ast__IntegerLiteral = ptr, ._typ = 273}; + return (v__ast__AsmArg){ ._v__ast__IntegerLiteral = ptr, ._typ = 275}; } static inline v__ast__AsmArg v__ast__CharLiteral_to_sumtype_v__ast__AsmArg(v__ast__CharLiteral* x) { v__ast__CharLiteral* ptr = memdup(x, sizeof(v__ast__CharLiteral)); - return (v__ast__AsmArg){ ._v__ast__CharLiteral = ptr, ._typ = 257}; + return (v__ast__AsmArg){ ._v__ast__CharLiteral = ptr, ._typ = 259}; } static inline v__ast__AsmArg v__ast__AsmAddressing_to_sumtype_v__ast__AsmArg(v__ast__AsmAddressing* x) { v__ast__AsmAddressing* ptr = memdup(x, sizeof(v__ast__AsmAddressing)); - return (v__ast__AsmArg){ ._v__ast__AsmAddressing = ptr, ._typ = 398}; + return (v__ast__AsmArg){ ._v__ast__AsmAddressing = ptr, ._typ = 400}; } static inline v__ast__AsmArg v__ast__AsmAlias_to_sumtype_v__ast__AsmArg(v__ast__AsmAlias* x) { v__ast__AsmAlias* ptr = memdup(x, sizeof(v__ast__AsmAlias)); - return (v__ast__AsmArg){ ._v__ast__AsmAlias = ptr, ._typ = 399}; + return (v__ast__AsmArg){ ._v__ast__AsmAlias = ptr, ._typ = 401}; } static inline v__ast__Expr v__ast__ConcatExpr_to_sumtype_v__ast__Expr(v__ast__ConcatExpr* x) { v__ast__ConcatExpr* ptr = memdup(x, sizeof(v__ast__ConcatExpr)); - return (v__ast__Expr){ ._v__ast__ConcatExpr = ptr, ._typ = 262}; + return (v__ast__Expr){ ._v__ast__ConcatExpr = ptr, ._typ = 264}; } static inline v__ast__Expr v__ast__ChanInit_to_sumtype_v__ast__Expr(v__ast__ChanInit* x) { v__ast__ChanInit* ptr = memdup(x, sizeof(v__ast__ChanInit)); - return (v__ast__Expr){ ._v__ast__ChanInit = ptr, ._typ = 256}; + return (v__ast__Expr){ ._v__ast__ChanInit = ptr, ._typ = 258}; } static inline v__ast__Expr v__ast__StringInterLiteral_to_sumtype_v__ast__Expr(v__ast__StringInterLiteral* x) { v__ast__StringInterLiteral* ptr = memdup(x, sizeof(v__ast__StringInterLiteral)); - return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 291}; + return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 293}; } static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 324, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; + return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 326, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; } static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); - return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 325, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; + return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 327, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; } static inline v__ast__TypeInfo v__ast__Enum_to_sumtype_v__ast__TypeInfo(v__ast__Enum* x) { v__ast__Enum* ptr = memdup(x, sizeof(v__ast__Enum)); - return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 447}; + return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 449}; } static inline v__ast__TypeDecl v__ast__SumTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__SumTypeDecl* x) { v__ast__SumTypeDecl* ptr = memdup(x, sizeof(v__ast__SumTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__SumTypeDecl = ptr, ._typ = 244, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__SumTypeDecl = ptr, ._typ = 246, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, comments))}; } static inline v__ast__TypeDecl v__ast__FnTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__FnTypeDecl* x) { v__ast__FnTypeDecl* ptr = memdup(x, sizeof(v__ast__FnTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__FnTypeDecl = ptr, ._typ = 243, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__FnTypeDecl = ptr, ._typ = 245, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, comments))}; } static inline v__ast__TypeDecl v__ast__AliasTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__AliasTypeDecl* x) { v__ast__AliasTypeDecl* ptr = memdup(x, sizeof(v__ast__AliasTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__AliasTypeDecl = ptr, ._typ = 242, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__AliasTypeDecl = ptr, ._typ = 244, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, comments))}; } static inline v__ast__TypeInfo v__ast__Alias_to_sumtype_v__ast__TypeInfo(v__ast__Alias* x) { v__ast__Alias* ptr = memdup(x, sizeof(v__ast__Alias)); - return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 433}; + return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 435}; } static inline v__ast__Node v__ast__File_to_sumtype_v__ast__Node(v__ast__File* x) { @@ -13186,15 +12874,15 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return "None__"; if (sidx == _IError_Error_index) return "Error"; if (sidx == _IError_MessageError_index) return "MessageError"; - if (sidx == _IError_os__FileNotOpenedError_index) return "os.FileNotOpenedError"; - if (sidx == _IError_os__SizeOfTypeIs0Error_index) return "os.SizeOfTypeIs0Error"; - if (sidx == _IError_os__ExecutableNotFoundError_index) return "os.ExecutableNotFoundError"; + if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_flag__UnkownFlagError_index) return "flag.UnkownFlagError"; if (sidx == _IError_flag__ArgsCountError_index) return "flag.ArgsCountError"; if (sidx == _IError_semver__InvalidComparatorFormatError_index) return "semver.InvalidComparatorFormatError"; if (sidx == _IError_semver__EmptyInputError_index) return "semver.EmptyInputError"; if (sidx == _IError_semver__InvalidVersionFormatError_index) return "semver.InvalidVersionFormatError"; - if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; + if (sidx == _IError_os__FileNotOpenedError_index) return "os.FileNotOpenedError"; + if (sidx == _IError_os__SizeOfTypeIs0Error_index) return "os.SizeOfTypeIs0Error"; + if (sidx == _IError_os__ExecutableNotFoundError_index) return "os.ExecutableNotFoundError"; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return "v.gen.c.UnsupportedAssertCtempTransform"; return "unknown IError"; } @@ -13203,16 +12891,16 @@ static int v_typeof_interface_idx_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return 65610; if (sidx == _IError_Error_index) return 75; if (sidx == _IError_MessageError_index) return 76; + if (sidx == _IError_time__TimeParseError_index) return 224; + if (sidx == _IError_flag__UnkownFlagError_index) return 66095; + if (sidx == _IError_flag__ArgsCountError_index) return 66096; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66107; + if (sidx == _IError_semver__EmptyInputError_index) return 66109; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66110; if (sidx == _IError_os__FileNotOpenedError_index) return 65649; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65650; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65663; - if (sidx == _IError_flag__UnkownFlagError_index) return 66098; - if (sidx == _IError_flag__ArgsCountError_index) return 66099; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66109; - if (sidx == _IError_semver__EmptyInputError_index) return 66111; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66112; - if (sidx == _IError_time__TimeParseError_index) return 222; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 501; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 503; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -13221,91 +12909,89 @@ static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ } static int v_typeof_interface_idx_rand__PRNG(int sidx) { /* rand.PRNG */ - if (sidx == _rand__PRNG_rand__wyrand__WyRandRNG_index) return 65738; + if (sidx == _rand__PRNG_rand__wyrand__WyRandRNG_index) return 65740; return 198; } static char * v_typeof_sumtype_v__ast__TypeDecl(int sidx) { /* v.ast.TypeDecl */ switch(sidx) { - case 245: return "v.ast.TypeDecl"; - case 242: return "v.ast.AliasTypeDecl"; - case 243: return "v.ast.FnTypeDecl"; - case 244: return "v.ast.SumTypeDecl"; + case 247: return "v.ast.TypeDecl"; + case 244: return "v.ast.AliasTypeDecl"; + case 245: return "v.ast.FnTypeDecl"; + case 246: return "v.ast.SumTypeDecl"; default: return "unknown v.ast.TypeDecl"; } } static int v_typeof_sumtype_idx_v__ast__TypeDecl(int sidx) { /* v.ast.TypeDecl */ switch(sidx) { - case 245: return 245; - case 242: return 242; - case 243: return 243; + case 247: return 247; case 244: return 244; - default: return 245; + case 245: return 245; + case 246: return 246; + default: return 247; } } static char * v_typeof_sumtype_v__ast__Expr(int sidx) { /* v.ast.Expr */ switch(sidx) { - case 297: return "v.ast.Expr"; - case 246: return "v.ast.AnonFn"; - case 247: return "v.ast.ArrayDecompose"; - case 248: return "v.ast.ArrayInit"; - case 249: return "v.ast.AsCast"; - case 250: return "v.ast.Assoc"; - case 251: return "v.ast.AtExpr"; - case 252: return "v.ast.BoolLiteral"; - case 253: return "v.ast.CTempVar"; - case 254: return "v.ast.CallExpr"; - case 255: return "v.ast.CastExpr"; - case 256: return "v.ast.ChanInit"; - case 257: return "v.ast.CharLiteral"; - case 258: return "v.ast.Comment"; - case 259: return "v.ast.ComptimeCall"; - case 260: return "v.ast.ComptimeSelector"; - case 261: return "v.ast.ComptimeType"; - case 262: return "v.ast.ConcatExpr"; - case 263: return "v.ast.DumpExpr"; - case 264: return "v.ast.EmptyExpr"; - case 265: return "v.ast.EnumVal"; - case 266: return "v.ast.FloatLiteral"; - case 267: return "v.ast.GoExpr"; - case 268: return "v.ast.Ident"; - case 269: return "v.ast.IfExpr"; - case 270: return "v.ast.IfGuardExpr"; - case 271: return "v.ast.IndexExpr"; - case 272: return "v.ast.InfixExpr"; - case 273: return "v.ast.IntegerLiteral"; - case 274: return "v.ast.IsRefType"; - case 275: return "v.ast.Likely"; - case 276: return "v.ast.LockExpr"; - case 277: return "v.ast.MapInit"; - case 278: return "v.ast.MatchExpr"; - case 279: return "v.ast.NodeError"; - case 280: return "v.ast.None"; - case 281: return "v.ast.OffsetOf"; - case 282: return "v.ast.OrExpr"; - case 283: return "v.ast.ParExpr"; - case 284: return "v.ast.PostfixExpr"; - case 285: return "v.ast.PrefixExpr"; - case 286: return "v.ast.RangeExpr"; - case 287: return "v.ast.SelectExpr"; - case 288: return "v.ast.SelectorExpr"; - case 289: return "v.ast.SizeOf"; - case 290: return "v.ast.SqlExpr"; - case 291: return "v.ast.StringInterLiteral"; - case 292: return "v.ast.StringLiteral"; - case 293: return "v.ast.StructInit"; - case 294: return "v.ast.TypeNode"; - case 295: return "v.ast.TypeOf"; - case 296: return "v.ast.UnsafeExpr"; + case 299: return "v.ast.Expr"; + case 248: return "v.ast.AnonFn"; + case 249: return "v.ast.ArrayDecompose"; + case 250: return "v.ast.ArrayInit"; + case 251: return "v.ast.AsCast"; + case 252: return "v.ast.Assoc"; + case 253: return "v.ast.AtExpr"; + case 254: return "v.ast.BoolLiteral"; + case 255: return "v.ast.CTempVar"; + case 256: return "v.ast.CallExpr"; + case 257: return "v.ast.CastExpr"; + case 258: return "v.ast.ChanInit"; + case 259: return "v.ast.CharLiteral"; + case 260: return "v.ast.Comment"; + case 261: return "v.ast.ComptimeCall"; + case 262: return "v.ast.ComptimeSelector"; + case 263: return "v.ast.ComptimeType"; + case 264: return "v.ast.ConcatExpr"; + case 265: return "v.ast.DumpExpr"; + case 266: return "v.ast.EmptyExpr"; + case 267: return "v.ast.EnumVal"; + case 268: return "v.ast.FloatLiteral"; + case 269: return "v.ast.GoExpr"; + case 270: return "v.ast.Ident"; + case 271: return "v.ast.IfExpr"; + case 272: return "v.ast.IfGuardExpr"; + case 273: return "v.ast.IndexExpr"; + case 274: return "v.ast.InfixExpr"; + case 275: return "v.ast.IntegerLiteral"; + case 276: return "v.ast.IsRefType"; + case 277: return "v.ast.Likely"; + case 278: return "v.ast.LockExpr"; + case 279: return "v.ast.MapInit"; + case 280: return "v.ast.MatchExpr"; + case 281: return "v.ast.NodeError"; + case 282: return "v.ast.None"; + case 283: return "v.ast.OffsetOf"; + case 284: return "v.ast.OrExpr"; + case 285: return "v.ast.ParExpr"; + case 286: return "v.ast.PostfixExpr"; + case 287: return "v.ast.PrefixExpr"; + case 288: return "v.ast.RangeExpr"; + case 289: return "v.ast.SelectExpr"; + case 290: return "v.ast.SelectorExpr"; + case 291: return "v.ast.SizeOf"; + case 292: return "v.ast.SqlExpr"; + case 293: return "v.ast.StringInterLiteral"; + case 294: return "v.ast.StringLiteral"; + case 295: return "v.ast.StructInit"; + case 296: return "v.ast.TypeNode"; + case 297: return "v.ast.TypeOf"; + case 298: return "v.ast.UnsafeExpr"; default: return "unknown v.ast.Expr"; } } static int v_typeof_sumtype_idx_v__ast__Expr(int sidx) { /* v.ast.Expr */ switch(sidx) { - case 297: return 297; - case 246: return 246; - case 247: return 247; + case 299: return 299; case 248: return 248; case 249: return 249; case 250: return 250; @@ -13355,48 +13041,48 @@ static int v_typeof_sumtype_idx_v__ast__Expr(int sidx) { /* v.ast.Expr */ case 294: return 294; case 295: return 295; case 296: return 296; - default: return 297; + case 297: return 297; + case 298: return 298; + default: return 299; } } static char * v_typeof_sumtype_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ switch(sidx) { - case 322: return "v.ast.Stmt"; - case 298: return "v.ast.AsmStmt"; - case 299: return "v.ast.AssertStmt"; - case 300: return "v.ast.AssignStmt"; - case 301: return "v.ast.Block"; - case 302: return "v.ast.BranchStmt"; - case 303: return "v.ast.ComptimeFor"; - case 304: return "v.ast.ConstDecl"; - case 305: return "v.ast.DeferStmt"; - case 306: return "v.ast.EmptyStmt"; - case 307: return "v.ast.EnumDecl"; - case 308: return "v.ast.ExprStmt"; + case 324: return "v.ast.Stmt"; + case 300: return "v.ast.AsmStmt"; + case 301: return "v.ast.AssertStmt"; + case 302: return "v.ast.AssignStmt"; + case 303: return "v.ast.Block"; + case 304: return "v.ast.BranchStmt"; + case 305: return "v.ast.ComptimeFor"; + case 306: return "v.ast.ConstDecl"; + case 307: return "v.ast.DeferStmt"; + case 308: return "v.ast.EmptyStmt"; + case 309: return "v.ast.EnumDecl"; + case 310: return "v.ast.ExprStmt"; case 185: return "v.ast.FnDecl"; - case 309: return "v.ast.ForCStmt"; - case 310: return "v.ast.ForInStmt"; - case 311: return "v.ast.ForStmt"; - case 312: return "v.ast.GlobalDecl"; - case 313: return "v.ast.GotoLabel"; - case 314: return "v.ast.GotoStmt"; - case 315: return "v.ast.HashStmt"; - case 316: return "v.ast.Import"; - case 317: return "v.ast.InterfaceDecl"; - case 318: return "v.ast.Module"; - case 279: return "v.ast.NodeError"; - case 319: return "v.ast.Return"; - case 320: return "v.ast.SqlStmt"; - case 321: return "v.ast.StructDecl"; - case 245: return "v.ast.TypeDecl"; + case 311: return "v.ast.ForCStmt"; + case 312: return "v.ast.ForInStmt"; + case 313: return "v.ast.ForStmt"; + case 314: return "v.ast.GlobalDecl"; + case 315: return "v.ast.GotoLabel"; + case 316: return "v.ast.GotoStmt"; + case 317: return "v.ast.HashStmt"; + case 318: return "v.ast.Import"; + case 319: return "v.ast.InterfaceDecl"; + case 320: return "v.ast.Module"; + case 281: return "v.ast.NodeError"; + case 321: return "v.ast.Return"; + case 322: return "v.ast.SqlStmt"; + case 323: return "v.ast.StructDecl"; + case 247: return "v.ast.TypeDecl"; default: return "unknown v.ast.Stmt"; } } static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ switch(sidx) { - case 322: return 322; - case 298: return 298; - case 299: return 299; + case 324: return 324; case 300: return 300; case 301: return 301; case 302: return 302; @@ -13406,9 +13092,9 @@ static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ case 306: return 306; case 307: return 307; case 308: return 308; - case 185: return 185; case 309: return 309; case 310: return 310; + case 185: return 185; case 311: return 311; case 312: return 312; case 313: return 313; @@ -13417,84 +13103,86 @@ static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ case 316: return 316; case 317: return 317; case 318: return 318; - case 279: return 279; case 319: return 319; case 320: return 320; + case 281: return 281; case 321: return 321; - case 245: return 245; - default: return 322; + case 322: return 322; + case 323: return 323; + case 247: return 247; + default: return 324; } } static char * v_typeof_sumtype_v__ast__ScopeObject(int sidx) { /* v.ast.ScopeObject */ switch(sidx) { - case 327: return "v.ast.ScopeObject"; - case 323: return "v.ast.AsmRegister"; - case 324: return "v.ast.ConstField"; - case 325: return "v.ast.GlobalField"; - case 326: return "v.ast.Var"; + case 329: return "v.ast.ScopeObject"; + case 325: return "v.ast.AsmRegister"; + case 326: return "v.ast.ConstField"; + case 327: return "v.ast.GlobalField"; + case 328: return "v.ast.Var"; default: return "unknown v.ast.ScopeObject"; } } static int v_typeof_sumtype_idx_v__ast__ScopeObject(int sidx) { /* v.ast.ScopeObject */ switch(sidx) { - case 327: return 327; - case 323: return 323; - case 324: return 324; + case 329: return 329; case 325: return 325; case 326: return 326; - default: return 327; + case 327: return 327; + case 328: return 328; + default: return 329; } } static char * v_typeof_sumtype_v__ast__Node(int sidx) { /* v.ast.Node */ switch(sidx) { - case 337: return "v.ast.Node"; - case 328: return "v.ast.CallArg"; - case 324: return "v.ast.ConstField"; - case 329: return "v.ast.EmptyNode"; - case 330: return "v.ast.EnumField"; - case 297: return "v.ast.Expr"; + case 339: return "v.ast.Node"; + case 330: return "v.ast.CallArg"; + case 326: return "v.ast.ConstField"; + case 331: return "v.ast.EmptyNode"; + case 332: return "v.ast.EnumField"; + case 299: return "v.ast.Expr"; case 176: return "v.ast.File"; - case 325: return "v.ast.GlobalField"; - case 331: return "v.ast.IfBranch"; - case 332: return "v.ast.MatchBranch"; - case 279: return "v.ast.NodeError"; - case 333: return "v.ast.Param"; - case 327: return "v.ast.ScopeObject"; - case 334: return "v.ast.SelectBranch"; - case 322: return "v.ast.Stmt"; - case 335: return "v.ast.StructField"; - case 336: return "v.ast.StructInitField"; + case 327: return "v.ast.GlobalField"; + case 333: return "v.ast.IfBranch"; + case 334: return "v.ast.MatchBranch"; + case 281: return "v.ast.NodeError"; + case 335: return "v.ast.Param"; + case 329: return "v.ast.ScopeObject"; + case 336: return "v.ast.SelectBranch"; + case 324: return "v.ast.Stmt"; + case 337: return "v.ast.StructField"; + case 338: return "v.ast.StructInitField"; default: return "unknown v.ast.Node"; } } static int v_typeof_sumtype_idx_v__ast__Node(int sidx) { /* v.ast.Node */ switch(sidx) { - case 337: return 337; - case 328: return 328; - case 324: return 324; - case 329: return 329; + case 339: return 339; case 330: return 330; - case 297: return 297; - case 176: return 176; - case 325: return 325; + case 326: return 326; case 331: return 331; case 332: return 332; - case 279: return 279; - case 333: return 333; + case 299: return 299; + case 176: return 176; case 327: return 327; + case 333: return 333; case 334: return 334; - case 322: return 322; + case 281: return 281; case 335: return 335; + case 329: return 329; case 336: return 336; - default: return 337; + case 324: return 324; + case 337: return 337; + case 338: return 338; + default: return 339; } } static char * v_typeof_sumtype_v__ast__ComptTimeConstValue(int sidx) { /* v.ast.ComptTimeConstValue */ switch(sidx) { - case 351: return "v.ast.ComptTimeConstValue"; - case 264: return "v.ast.EmptyExpr"; + case 353: return "v.ast.ComptTimeConstValue"; + case 266: return "v.ast.EmptyExpr"; case 15: return "f32"; case 16: return "f64"; case 6: return "i16"; @@ -13513,8 +13201,8 @@ static char * v_typeof_sumtype_v__ast__ComptTimeConstValue(int sidx) { /* v.ast. static int v_typeof_sumtype_idx_v__ast__ComptTimeConstValue(int sidx) { /* v.ast.ComptTimeConstValue */ switch(sidx) { - case 351: return 351; - case 264: return 264; + case 353: return 353; + case 266: return 266; case 15: return 15; case 16: return 16; case 6: return 6; @@ -13527,37 +13215,37 @@ static int v_typeof_sumtype_idx_v__ast__ComptTimeConstValue(int sidx) { /* v.ast case 12: return 12; case 13: return 13; case 10: return 10; - default: return 351; + default: return 353; } } static char * v_typeof_sumtype_v__ast__IdentInfo(int sidx) { /* v.ast.IdentInfo */ switch(sidx) { - case 379: return "v.ast.IdentInfo"; - case 377: return "v.ast.IdentFn"; - case 378: return "v.ast.IdentVar"; + case 381: return "v.ast.IdentInfo"; + case 379: return "v.ast.IdentFn"; + case 380: return "v.ast.IdentVar"; default: return "unknown v.ast.IdentInfo"; } } static int v_typeof_sumtype_idx_v__ast__IdentInfo(int sidx) { /* v.ast.IdentInfo */ switch(sidx) { + case 381: return 381; case 379: return 379; - case 377: return 377; - case 378: return 378; - default: return 379; + case 380: return 380; + default: return 381; } } static char * v_typeof_sumtype_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ switch(sidx) { - case 396: return "v.ast.AsmArg"; - case 398: return "v.ast.AsmAddressing"; - case 399: return "v.ast.AsmAlias"; - case 400: return "v.ast.AsmDisp"; - case 323: return "v.ast.AsmRegister"; - case 252: return "v.ast.BoolLiteral"; - case 257: return "v.ast.CharLiteral"; - case 266: return "v.ast.FloatLiteral"; - case 273: return "v.ast.IntegerLiteral"; + case 398: return "v.ast.AsmArg"; + case 400: return "v.ast.AsmAddressing"; + case 401: return "v.ast.AsmAlias"; + case 402: return "v.ast.AsmDisp"; + case 325: return "v.ast.AsmRegister"; + case 254: return "v.ast.BoolLiteral"; + case 259: return "v.ast.CharLiteral"; + case 268: return "v.ast.FloatLiteral"; + case 275: return "v.ast.IntegerLiteral"; case 20: return "string"; default: return "unknown v.ast.AsmArg"; } @@ -13565,58 +13253,58 @@ static char * v_typeof_sumtype_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ static int v_typeof_sumtype_idx_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ switch(sidx) { - case 396: return 396; case 398: return 398; - case 399: return 399; case 400: return 400; - case 323: return 323; - case 252: return 252; - case 257: return 257; - case 266: return 266; - case 273: return 273; + case 401: return 401; + case 402: return 402; + case 325: return 325; + case 254: return 254; + case 259: return 259; + case 268: return 268; + case 275: return 275; case 20: return 20; - default: return 396; + default: return 398; } } static char * v_typeof_sumtype_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 448: return "v.ast.TypeInfo"; - case 431: return "v.ast.Aggregate"; - case 433: return "v.ast.Alias"; - case 413: return "v.ast.Array"; - case 441: return "v.ast.ArrayFixed"; - case 442: return "v.ast.Chan"; - case 447: return "v.ast.Enum"; - case 445: return "v.ast.FnType"; - case 446: return "v.ast.GenericInst"; - case 436: return "v.ast.Interface"; - case 414: return "v.ast.Map"; - case 444: return "v.ast.MultiReturn"; - case 418: return "v.ast.Struct"; - case 437: return "v.ast.SumType"; - case 443: return "v.ast.Thread"; + case 450: return "v.ast.TypeInfo"; + case 433: return "v.ast.Aggregate"; + case 435: return "v.ast.Alias"; + case 415: return "v.ast.Array"; + case 443: return "v.ast.ArrayFixed"; + case 444: return "v.ast.Chan"; + case 449: return "v.ast.Enum"; + case 447: return "v.ast.FnType"; + case 448: return "v.ast.GenericInst"; + case 438: return "v.ast.Interface"; + case 416: return "v.ast.Map"; + case 446: return "v.ast.MultiReturn"; + case 420: return "v.ast.Struct"; + case 439: return "v.ast.SumType"; + case 445: return "v.ast.Thread"; default: return "unknown v.ast.TypeInfo"; } } static int v_typeof_sumtype_idx_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 448: return 448; - case 431: return 431; + case 450: return 450; case 433: return 433; - case 413: return 413; - case 441: return 441; - case 442: return 442; - case 447: return 447; - case 445: return 445; - case 446: return 446; - case 436: return 436; - case 414: return 414; - case 444: return 444; - case 418: return 418; - case 437: return 437; + case 435: return 435; + case 415: return 415; case 443: return 443; - default: return 448; + case 444: return 444; + case 449: return 449; + case 447: return 447; + case 448: return 448; + case 438: return 438; + case 416: return 416; + case 446: return 446; + case 420: return 420; + case 439: return 439; + case 445: return 445; + default: return 450; } } static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ @@ -13624,21 +13312,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 496; + return 498; } 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 497; + return 499; } 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 498; + return 500; } 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"; @@ -13647,9 +13335,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 536; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66025; - return 534; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 533; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66027; + return 531; } // << typeof() support for sum types @@ -13880,7 +13568,8 @@ f32 strings__dice_coefficient(string s1, string s2) { } string a = (s1.len > s2.len ? (s1) : (s2)); string b = (string__eq(a, s1) ? (s2) : (s1)); - Map_string_int first_bigrams = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int first_bigrams = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < a.len - 1; ++i) { string bigram = string_substr(a, i, i + 2); int q = (_IN_MAP(ADDR(string, bigram), ADDR(map, first_bigrams)) ? ((*(int*)map_get(ADDR(map, first_bigrams), &(string[]){bigram}, &(int[]){ 0 })) + 1) : (1)); @@ -14920,7 +14609,7 @@ _option_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool e _option_u64 _t2 = strconv__common_parse_uint(s, base, bit_size, error_on_non_digit, error_on_high_digit); if (_t2.state != 0) { /*or block*/ _option_i64 _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -14988,7 +14677,7 @@ _option_int strconv__atoi(string s) { _option_i64 _t6 = strconv__parse_int(s, 10, 0); if (_t6.state != 0) { /*or block*/ _option_int _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -19523,7 +19212,7 @@ _option_rune Array_u8_byterune(Array_u8 b) { _option_rune _t1 = Array_u8_utf8_to_utf32(b); if (_t1.state != 0) { /*or block*/ _option_rune _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -20284,9 +19973,9 @@ inline IError error_with_code(string message, int code) { return /*&IError*/I_MessageError_to_Interface_IError(((MessageError*)memdup(&(MessageError){.msg = message,.code = code,}, sizeof(MessageError)))); } -VV_LOCAL_SYMBOL void opt_ok(voidptr data, Option* option, int size) { +VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size) { { // Unsafe block - *option = ((Option){.state = 0,.err = _const_none__,}); + *option = ((_option){.state = 0,.err = _const_none__,}); vmemcpy(((u8*)(&option->err)) + sizeof(IError), data, size); } } @@ -22533,105 +22222,105 @@ string charptr_vstring_literal_with_len(charptr cp, int len) { } string StrIntpType_str(StrIntpType x) { + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; switch (x) { case StrIntpType__si_no_str: { - return _SLIT("no_str"); + _t2 = _SLIT("no_str"); break; } case StrIntpType__si_c: { - return _SLIT("c"); + _t2 = _SLIT("c"); break; } case StrIntpType__si_u8: { - return _SLIT("u8"); + _t2 = _SLIT("u8"); break; } case StrIntpType__si_i8: { - return _SLIT("i8"); + _t2 = _SLIT("i8"); break; } case StrIntpType__si_u16: { - return _SLIT("u16"); + _t2 = _SLIT("u16"); break; } case StrIntpType__si_i16: { - return _SLIT("i16"); + _t2 = _SLIT("i16"); break; } case StrIntpType__si_u32: { - return _SLIT("u32"); + _t2 = _SLIT("u32"); break; } case StrIntpType__si_i32: { - return _SLIT("i32"); + _t2 = _SLIT("i32"); break; } case StrIntpType__si_u64: { - return _SLIT("u64"); + _t2 = _SLIT("u64"); break; } case StrIntpType__si_i64: { - return _SLIT("i64"); + _t2 = _SLIT("i64"); break; } case StrIntpType__si_f32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_f64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_g32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_g64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_e32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_e64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_s: { - return _SLIT("s"); + _t2 = _SLIT("s"); break; } case StrIntpType__si_p: { - return _SLIT("p"); + _t2 = _SLIT("p"); break; } case StrIntpType__si_vp: { - return _SLIT("vp"); + _t2 = _SLIT("vp"); break; } } - ; - return (string){.str=(byteptr)"", .is_lit=1}; + return _t2; } // Attr: [inline] @@ -23527,6 +23216,4605 @@ inline void ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag) { } } +strings__textscanner__TextScanner strings__textscanner__new(string input) { + strings__textscanner__TextScanner _t1 = ((strings__textscanner__TextScanner){.input = input,.ilen = input.len,.pos = 0,}); + return _t1; +} + +// Attr: [unsafe] +void strings__textscanner__TextScanner_free(strings__textscanner__TextScanner* ss) { + string_free(&ss->input); +} + +// Attr: [inline] +inline int strings__textscanner__TextScanner_remaining(strings__textscanner__TextScanner* ss) { + int _t1 = ss->ilen - ss->pos; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_next(strings__textscanner__TextScanner* ss) { + if (ss->pos < ss->ilen) { + int opos = ss->pos; + ss->pos++; + int _t1 = ss->input.str[ opos]; + return _t1; + } + int _t2 = -1; + return _t2; +} + +// Attr: [inline] +inline void strings__textscanner__TextScanner_skip(strings__textscanner__TextScanner* ss) { + if (ss->pos + 1 < ss->ilen) { + ss->pos++; + } +} + +// Attr: [inline] +inline void strings__textscanner__TextScanner_skip_n(strings__textscanner__TextScanner* ss, int n) { + ss->pos += n; + if (ss->pos > ss->ilen) { + ss->pos = ss->ilen; + } +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_peek(strings__textscanner__TextScanner* ss) { + if (ss->pos < ss->ilen) { + int _t1 = ss->input.str[ ss->pos]; + return _t1; + } + int _t2 = -1; + return _t2; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_peek_n(strings__textscanner__TextScanner* ss, int n) { + if (ss->pos + n < ss->ilen) { + int _t1 = ss->input.str[ ss->pos + n]; + return _t1; + } + int _t2 = -1; + return _t2; +} + +// Attr: [inline] +inline void strings__textscanner__TextScanner_back(strings__textscanner__TextScanner* ss) { + if (ss->pos > 0) { + ss->pos--; + } +} + +void strings__textscanner__TextScanner_back_n(strings__textscanner__TextScanner* ss, int n) { + ss->pos -= n; + if (ss->pos < 0) { + ss->pos = 0; + } + if (ss->pos > ss->ilen) { + ss->pos = ss->ilen; + } +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_peek_back(strings__textscanner__TextScanner* ss) { + int _t1 = strings__textscanner__TextScanner_peek_back_n(ss, 1); + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScanner* ss, int n) { + int offset = n + 1; + if (ss->pos >= offset) { + int _t1 = ss->input.str[ ss->pos - offset]; + return _t1; + } + int _t2 = -1; + return _t2; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss) { + if (ss->pos > 0) { + int _t1 = ss->input.str[ ss->pos - 1]; + return _t1; + } + int _t2 = -1; + return _t2; +} + +void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss) { + ss->pos = 0; +} + +void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss) { + ss->pos = ss->ilen; +} + +Array_string os__cmdline__options(Array_string args, string param) { + Array_string flags = __new_array_with_default(0, 0, sizeof(string), 0); + for (int i = 0; i < args.len; ++i) { + string v = ((string*)args.data)[i]; + if (string__eq(v, param)) { + if (i + 1 < args.len) { + array_push((array*)&flags, _MOV((string[]){ string_clone((*(string*)/*ee elem_sym */array_get(args, i + 1))) })); + } + } + } + Array_string _t2 = flags; + return _t2; +} + +string os__cmdline__option(Array_string args, string param, string def) { + bool found = false; + for (int _t1 = 0; _t1 < args.len; ++_t1) { + string arg = ((string*)args.data)[_t1]; + if (found) { + string _t2 = arg; + return _t2; + } else if (string__eq(param, arg)) { + found = true; + } + } + string _t3 = def; + return _t3; +} + +Array_string os__cmdline__options_before(Array_string args, Array_string what) { + Array_string args_before = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t1 = 0; _t1 < args.len; ++_t1) { + string a = ((string*)args.data)[_t1]; + if (Array_string_contains(what, a)) { + break; + } + array_push((array*)&args_before, _MOV((string[]){ string_clone(a) })); + } + Array_string _t3 = args_before; + return _t3; +} + +Array_string os__cmdline__options_after(Array_string args, Array_string what) { + bool found = false; + Array_string args_after = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t1 = 0; _t1 < args.len; ++_t1) { + string a = ((string*)args.data)[_t1]; + if (Array_string_contains(what, a)) { + found = true; + continue; + } + if (found) { + array_push((array*)&args_after, _MOV((string[]){ string_clone(a) })); + } + } + Array_string _t3 = args_after; + return _t3; +} + +Array_string os__cmdline__only_non_options(Array_string args) { + Array_string _t2 = {0}; + Array_string _t2_orig = args; + int _t2_len = _t2_orig.len; + _t2 = __new_array(0, _t2_len, sizeof(string)); + + for (int _t3 = 0; _t3 < _t2_len; ++_t3) { + string it = ((string*) _t2_orig.data)[_t3]; + if (!string_starts_with(it, _SLIT("-"))) { + array_push((array*)&_t2, &it); + } + } + Array_string _t1 =_t2; + return _t1; +} + +Array_string os__cmdline__only_options(Array_string args) { + Array_string _t2 = {0}; + Array_string _t2_orig = args; + int _t2_len = _t2_orig.len; + _t2 = __new_array(0, _t2_len, sizeof(string)); + + for (int _t3 = 0; _t3 < _t2_len; ++_t3) { + string it = ((string*) _t2_orig.data)[_t3]; + if (string_starts_with(it, _SLIT("-"))) { + array_push((array*)&_t2, &it); + } + } + Array_string _t1 =_t2; + return _t1; +} + +v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map) { + v__token__KeywordsMatcher km = ((v__token__KeywordsMatcher){.len_min = 9999,.len_max = -1,.words = {0},}); + for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { + km.words[v_fixed_index(i, 20)] = __new_array_with_default(0, 0, sizeof(v__token__WIndex), 0); + } + int _t2 = kw_map.key_values.len; + for (int _t1 = 0; _t1 < _t2; ++_t1 ) { + int _t3 = kw_map.key_values.len - _t2; + _t2 = kw_map.key_values.len; + if (_t3 < 0) { + _t1 = -1; + continue; + } + if (!DenseArray_has_index(&kw_map.key_values, _t1)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&kw_map.key_values, _t1); + k = string_clone(k); + v__token__Kind v = (*(v__token__Kind*)DenseArray_value(&kw_map.key_values, _t1)); + v__token__KeywordsMatcher_add_word(&km, k, ((int)(v))); + } + for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { + if (km.words[v_fixed_index(i, 20)].len > 0) { + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) + { + print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); + Array_v__token__WIndex _t4 = km.words[v_fixed_index(i, 20)]; + for (int _t5 = 0; _t5 < _t4.len; ++_t5) { + v__token__WIndex w = ((v__token__WIndex*)_t4.data)[_t5]; + print( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = w.word}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); + } + println(_SLIT("")); + } + #endif + } + } + v__token__KeywordsMatcher _t6 = km; + return _t6; +} +v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw_map) { + v__token__KeywordsMatcher km = ((v__token__KeywordsMatcher){.len_min = 9999,.len_max = -1,.words = {0},}); + for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { + km.words[v_fixed_index(i, 20)] = __new_array_with_default(0, 0, sizeof(v__token__WIndex), 0); + } + int _t2 = kw_map.key_values.len; + for (int _t1 = 0; _t1 < _t2; ++_t1 ) { + int _t3 = kw_map.key_values.len - _t2; + _t2 = kw_map.key_values.len; + if (_t3 < 0) { + _t1 = -1; + continue; + } + if (!DenseArray_has_index(&kw_map.key_values, _t1)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&kw_map.key_values, _t1); + k = string_clone(k); + int v = (*(int*)DenseArray_value(&kw_map.key_values, _t1)); + v__token__KeywordsMatcher_add_word(&km, k, ((int)(v))); + } + for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { + if (km.words[v_fixed_index(i, 20)].len > 0) { + qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); + #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) + { + print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); + Array_v__token__WIndex _t4 = km.words[v_fixed_index(i, 20)]; + for (int _t5 = 0; _t5 < _t4.len; ++_t5) { + v__token__WIndex w = ((v__token__WIndex*)_t4.data)[_t5]; + print( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = w.word}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); + } + println(_SLIT("")); + } + #endif + } + } + v__token__KeywordsMatcher _t6 = km; + return _t6; +} + +VV_LOCAL_SYMBOL void v__token__KeywordsMatcher_add_word(v__token__KeywordsMatcher* km, string word, int kind) { + if (word.len >= _const_v__token__max_keyword_len) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("increase max_keyword_len to > "), /*100 &int*/0xfe07, {.d_i32 = word.len}}, {_SLIT0, 0, { .d_c = 0 }}}))); + VUNREACHABLE(); + } + if (km->len_max < word.len) { + km->len_max = word.len; + } + if (word.len < km->len_min) { + km->len_min = word.len; + } + array_push((array*)&km->words[v_fixed_index(word.len, 20)], _MOV((v__token__WIndex[]){ ((v__token__WIndex){.word = word,.index = kind,}) })); +} + +// Attr: [direct_array_access] +int v__token__KeywordsMatcher_find(v__token__KeywordsMatcher* km, string word) { + int wlen = word.len; + if (wlen < km->len_min || wlen > km->len_max) { + int _t1 = -1; + return _t1; + } + int list_len = km->words[wlen].len; + if (list_len == 0) { + int _t2 = -1; + return _t2; + } + int lo = 0; + int hi = list_len - 1; + for (;;) { + if (!(lo <= hi)) break; + int mid = lo + (hi - lo) / 2; + int cmp = string_compare(((v__token__WIndex*)km->words[wlen].data)[mid].word, word); + + if (cmp == (0)) { + int _t3 = ((v__token__WIndex*)km->words[wlen].data)[mid].index; + return _t3; + } + else if (cmp == (-1)) { + lo = mid + 1; + } + else if (cmp == (1)) { + hi = mid - 1; + } + else { + }; + } + int _t4 = -1; + return _t4; +} + +// Attr: [unsafe] +void v__token__Pos_free(v__token__Pos* p) { +} + +string v__token__Pos_line_str(v__token__Pos p) { + string _t1 = str_intp(5, _MOV((StrIntpData[]){{_SLIT("{l: "), /*100 &int*/0xafe27, {.d_i32 = p.line_nr + 1}}, {_SLIT(", c: "), /*100 &int*/0x6fe27, {.d_i32 = p.col}}, {_SLIT(", p: "), /*100 &int*/0xafe27, {.d_i32 = p.pos}}, {_SLIT(", ll: "), /*100 &int*/0xafe27, {.d_i32 = p.last_line + 1}}, {_SLIT("}"), 0, { .d_c = 0 }}})); + return _t1; +} + +v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end) { + v__token__Pos _t1 = ((v__token__Pos){.len = end.pos - pos.pos + end.len,pos.line_nr,pos.pos,pos.col,.last_line = end.last_line,}); + return _t1; +} + +v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line) { + v__token__Pos _t1 = ((v__token__Pos){.len = end.pos - pos.pos + end.len,.line_nr = pos.line_nr,.pos = pos.pos,.col = pos.col,.last_line = last_line - 1,}); + return _t1; +} + +void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line) { + pos->last_line = last_line - 1; +} + +// Attr: [inline] +inline v__token__Pos v__token__Token_pos(v__token__Token* tok) { + v__token__Pos _t1 = ((v__token__Pos){.len = tok->len,.line_nr = tok->line_nr - 1,.pos = tok->pos,.col = tok->col - 1,.last_line = tok->line_nr - 1,}); + return _t1; +} + +VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void) { + Map_string_v__token__Kind res = new_map(sizeof(string), sizeof(v__token__Kind), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + for (int t = ((int)(v__token__Kind__keyword_beg)) + 1; t < ((int)(v__token__Kind__keyword_end)); ++t) { + string key = (*(string*)/*ee elem_sym */array_get(_const_v__token__token_str, t)); + map_set(&res, &(string[]){key}, &(v__token__Kind[]) { ((v__token__Kind)(t)) }); + } + Map_string_v__token__Kind _t1 = res; + return _t1; +} + +VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void) { + Array_string s = __new_array_with_default(((int)(v__token__Kind___end_)), 0, sizeof(string), &(string[]){_SLIT("")}); + array_set(&s, v__token__Kind__unknown, &(string[]) { _SLIT("unknown") }); + array_set(&s, v__token__Kind__eof, &(string[]) { _SLIT("eof") }); + array_set(&s, v__token__Kind__name, &(string[]) { _SLIT("name") }); + array_set(&s, v__token__Kind__number, &(string[]) { _SLIT("number") }); + array_set(&s, v__token__Kind__string, &(string[]) { _SLIT("string") }); + array_set(&s, v__token__Kind__chartoken, &(string[]) { _SLIT("char") }); + array_set(&s, v__token__Kind__plus, &(string[]) { _SLIT("+") }); + array_set(&s, v__token__Kind__minus, &(string[]) { _SLIT("-") }); + array_set(&s, v__token__Kind__mul, &(string[]) { _SLIT("*") }); + array_set(&s, v__token__Kind__div, &(string[]) { _SLIT("/") }); + array_set(&s, v__token__Kind__mod, &(string[]) { _SLIT("%") }); + array_set(&s, v__token__Kind__xor, &(string[]) { _SLIT("^") }); + array_set(&s, v__token__Kind__bit_not, &(string[]) { _SLIT("~") }); + array_set(&s, v__token__Kind__pipe, &(string[]) { _SLIT("|") }); + array_set(&s, v__token__Kind__hash, &(string[]) { _SLIT("#") }); + array_set(&s, v__token__Kind__amp, &(string[]) { _SLIT("&") }); + array_set(&s, v__token__Kind__inc, &(string[]) { _SLIT("++") }); + array_set(&s, v__token__Kind__dec, &(string[]) { _SLIT("--") }); + array_set(&s, v__token__Kind__and, &(string[]) { _SLIT("&&") }); + array_set(&s, v__token__Kind__logical_or, &(string[]) { _SLIT("||") }); + array_set(&s, v__token__Kind__not, &(string[]) { _SLIT("!") }); + array_set(&s, v__token__Kind__dot, &(string[]) { _SLIT(".") }); + array_set(&s, v__token__Kind__dotdot, &(string[]) { _SLIT("..") }); + array_set(&s, v__token__Kind__ellipsis, &(string[]) { _SLIT("...") }); + array_set(&s, v__token__Kind__comma, &(string[]) { _SLIT(",") }); + array_set(&s, v__token__Kind__not_in, &(string[]) { _SLIT("!in") }); + array_set(&s, v__token__Kind__not_is, &(string[]) { _SLIT("!is") }); + array_set(&s, v__token__Kind__semicolon, &(string[]) { _SLIT(";") }); + array_set(&s, v__token__Kind__colon, &(string[]) { _SLIT(":") }); + array_set(&s, v__token__Kind__arrow, &(string[]) { _SLIT("<-") }); + array_set(&s, v__token__Kind__assign, &(string[]) { _SLIT("=") }); + array_set(&s, v__token__Kind__decl_assign, &(string[]) { _SLIT(":=") }); + array_set(&s, v__token__Kind__plus_assign, &(string[]) { _SLIT("+=") }); + array_set(&s, v__token__Kind__minus_assign, &(string[]) { _SLIT("-=") }); + array_set(&s, v__token__Kind__mult_assign, &(string[]) { _SLIT("*=") }); + array_set(&s, v__token__Kind__div_assign, &(string[]) { _SLIT("/=") }); + array_set(&s, v__token__Kind__xor_assign, &(string[]) { _SLIT("^=") }); + array_set(&s, v__token__Kind__mod_assign, &(string[]) { _SLIT("%=") }); + array_set(&s, v__token__Kind__or_assign, &(string[]) { _SLIT("|=") }); + array_set(&s, v__token__Kind__and_assign, &(string[]) { _SLIT("&=") }); + array_set(&s, v__token__Kind__right_shift_assign, &(string[]) { _SLIT(">>=") }); + array_set(&s, v__token__Kind__unsigned_right_shift_assign, &(string[]) { _SLIT(">>>=") }); + array_set(&s, v__token__Kind__left_shift_assign, &(string[]) { _SLIT("<<=") }); + array_set(&s, v__token__Kind__lcbr, &(string[]) { _SLIT("{") }); + array_set(&s, v__token__Kind__rcbr, &(string[]) { _SLIT("}") }); + array_set(&s, v__token__Kind__lpar, &(string[]) { _SLIT("(") }); + array_set(&s, v__token__Kind__rpar, &(string[]) { _SLIT(")") }); + array_set(&s, v__token__Kind__lsbr, &(string[]) { _SLIT("[") }); + array_set(&s, v__token__Kind__nilsbr, &(string[]) { _SLIT("#[") }); + array_set(&s, v__token__Kind__rsbr, &(string[]) { _SLIT("]") }); + array_set(&s, v__token__Kind__eq, &(string[]) { _SLIT("==") }); + array_set(&s, v__token__Kind__ne, &(string[]) { _SLIT("!=") }); + array_set(&s, v__token__Kind__gt, &(string[]) { _SLIT(">") }); + array_set(&s, v__token__Kind__lt, &(string[]) { _SLIT("<") }); + array_set(&s, v__token__Kind__ge, &(string[]) { _SLIT(">=") }); + array_set(&s, v__token__Kind__le, &(string[]) { _SLIT("<=") }); + array_set(&s, v__token__Kind__question, &(string[]) { _SLIT("?") }); + array_set(&s, v__token__Kind__left_shift, &(string[]) { _SLIT("<<") }); + array_set(&s, v__token__Kind__right_shift, &(string[]) { _SLIT(">>") }); + array_set(&s, v__token__Kind__unsigned_right_shift, &(string[]) { _SLIT(">>>") }); + array_set(&s, v__token__Kind__comment, &(string[]) { _SLIT("comment") }); + array_set(&s, v__token__Kind__nl, &(string[]) { _SLIT("NLL") }); + array_set(&s, v__token__Kind__dollar, &(string[]) { _SLIT("$") }); + array_set(&s, v__token__Kind__at, &(string[]) { _SLIT("@") }); + array_set(&s, v__token__Kind__str_dollar, &(string[]) { _SLIT("$2") }); + array_set(&s, v__token__Kind__key_assert, &(string[]) { _SLIT("assert") }); + array_set(&s, v__token__Kind__key_struct, &(string[]) { _SLIT("struct") }); + array_set(&s, v__token__Kind__key_if, &(string[]) { _SLIT("if") }); + array_set(&s, v__token__Kind__key_else, &(string[]) { _SLIT("else") }); + array_set(&s, v__token__Kind__key_asm, &(string[]) { _SLIT("asm") }); + array_set(&s, v__token__Kind__key_return, &(string[]) { _SLIT("return") }); + array_set(&s, v__token__Kind__key_module, &(string[]) { _SLIT("module") }); + array_set(&s, v__token__Kind__key_sizeof, &(string[]) { _SLIT("sizeof") }); + array_set(&s, v__token__Kind__key_isreftype, &(string[]) { _SLIT("isreftype") }); + array_set(&s, v__token__Kind__key_likely, &(string[]) { _SLIT("_likely_") }); + array_set(&s, v__token__Kind__key_unlikely, &(string[]) { _SLIT("_unlikely_") }); + array_set(&s, v__token__Kind__key_go, &(string[]) { _SLIT("go") }); + array_set(&s, v__token__Kind__key_goto, &(string[]) { _SLIT("goto") }); + array_set(&s, v__token__Kind__key_const, &(string[]) { _SLIT("const") }); + array_set(&s, v__token__Kind__key_mut, &(string[]) { _SLIT("mut") }); + array_set(&s, v__token__Kind__key_shared, &(string[]) { _SLIT("shared") }); + array_set(&s, v__token__Kind__key_lock, &(string[]) { _SLIT("lock") }); + array_set(&s, v__token__Kind__key_rlock, &(string[]) { _SLIT("rlock") }); + array_set(&s, v__token__Kind__key_type, &(string[]) { _SLIT("type") }); + array_set(&s, v__token__Kind__key_for, &(string[]) { _SLIT("for") }); + array_set(&s, v__token__Kind__key_fn, &(string[]) { _SLIT("fn") }); + array_set(&s, v__token__Kind__key_true, &(string[]) { _SLIT("true") }); + array_set(&s, v__token__Kind__key_false, &(string[]) { _SLIT("false") }); + array_set(&s, v__token__Kind__key_continue, &(string[]) { _SLIT("continue") }); + array_set(&s, v__token__Kind__key_break, &(string[]) { _SLIT("break") }); + array_set(&s, v__token__Kind__key_import, &(string[]) { _SLIT("import") }); + array_set(&s, v__token__Kind__key_unsafe, &(string[]) { _SLIT("unsafe") }); + array_set(&s, v__token__Kind__key_typeof, &(string[]) { _SLIT("typeof") }); + array_set(&s, v__token__Kind__key_dump, &(string[]) { _SLIT("dump") }); + array_set(&s, v__token__Kind__key_enum, &(string[]) { _SLIT("enum") }); + array_set(&s, v__token__Kind__key_interface, &(string[]) { _SLIT("interface") }); + array_set(&s, v__token__Kind__key_pub, &(string[]) { _SLIT("pub") }); + array_set(&s, v__token__Kind__key_in, &(string[]) { _SLIT("in") }); + array_set(&s, v__token__Kind__key_atomic, &(string[]) { _SLIT("atomic") }); + array_set(&s, v__token__Kind__key_orelse, &(string[]) { _SLIT("or") }); + array_set(&s, v__token__Kind__key_global, &(string[]) { _SLIT("__global") }); + array_set(&s, v__token__Kind__key_union, &(string[]) { _SLIT("union") }); + array_set(&s, v__token__Kind__key_static, &(string[]) { _SLIT("static") }); + array_set(&s, v__token__Kind__key_volatile, &(string[]) { _SLIT("volatile") }); + array_set(&s, v__token__Kind__key_as, &(string[]) { _SLIT("as") }); + array_set(&s, v__token__Kind__key_defer, &(string[]) { _SLIT("defer") }); + array_set(&s, v__token__Kind__key_match, &(string[]) { _SLIT("match") }); + array_set(&s, v__token__Kind__key_select, &(string[]) { _SLIT("select") }); + array_set(&s, v__token__Kind__key_none, &(string[]) { _SLIT("none") }); + array_set(&s, v__token__Kind__key_offsetof, &(string[]) { _SLIT("__offsetof") }); + array_set(&s, v__token__Kind__key_is, &(string[]) { _SLIT("is") }); + array_set(&s, v__token__Kind__keyword_beg, &(string[]) { _SLIT("keyword_beg") }); + array_set(&s, v__token__Kind__keyword_end, &(string[]) { _SLIT("keyword_end") }); + array_set(&s, v__token__Kind__str_inter, &(string[]) { _SLIT("str_inter") }); + #if defined(CUSTOM_DEFINE_debug_build_token_str) + { + for (int k = 0; k < s.len; ++k) { + string v = ((string*)s.data)[k]; + if ((v).len == 0) { + eprintln( str_intp(5, _MOV((StrIntpData[]){{_SLIT(">>> "), /*115 &string*/0xfe10, {.d_s = _SLIT("v.token")}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = _SLIT("build_token_str")}}, {_SLIT(" missing k: "), /*100 &int*/0xfe07, {.d_i32 = k}}, {_SLIT(" | ."), /*115 &string*/0xfe10, {.d_s = v__token__kind_to_string(((v__token__Kind)(k)))}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + } + } + #endif + Array_string _t1 = s; + return _t1; +} + +// Attr: [inline] +inline bool v__token__is_key(string key) { + bool _t1 = ((int)((*(v__token__Kind*)map_get(ADDR(map, _const_v__token__keywords), &(string[]){key}, &(v__token__Kind[]){ 0 })))) > 0; + return _t1; +} + +// Attr: [inline] +inline bool v__token__is_decl(v__token__Kind t) { + bool _t1 = (t == v__token__Kind__key_enum || t == v__token__Kind__key_interface || t == v__token__Kind__key_fn || t == v__token__Kind__key_struct || t == v__token__Kind__key_type || t == v__token__Kind__key_const || t == v__token__Kind__key_pub || t == v__token__Kind__eof); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_assign(v__token__Kind t) { + bool _t1 = Array_v__token__Kind_contains(_const_v__token__assign_tokens, t); + return _t1; +} + +// Attr: [inline] +inline string v__token__Kind_str(v__token__Kind t) { + string _t1 = (*(string*)/*ee elem_sym */array_get(_const_v__token__token_str, ((int)(t)))); + return _t1; +} + +string v__token__Token_str(v__token__Token t) { + string s = v__token__Kind_str(t.kind); + if (s.len == 0) { + eprintln(_SLIT("missing token kind string")); + } else if (!u8_is_letter(string_at(s, 0))) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("token `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("`"), 0, { .d_c = 0 }}})); + return _t1; + } + if (v__token__is_key(t.lit)) { + s = _SLIT("keyword"); + } + if ((t.lit).len != 0) { + s = /*f*/string__plus(s, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = t.lit}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); + } + string _t2 = s; + return _t2; +} + +string v__token__Token_debug(v__token__Token t) { + string ks = v__token__kind_to_string(t.kind); + string s = ((t.lit).len == 0 ? (v__token__Kind_str(t.kind)) : (t.lit)); + string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("tok: ."), /*115 &string*/0x18fe10, {.d_s = ks}}, {_SLIT(" | lit: `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("`"), 0, { .d_c = 0 }}})); + return _t1; +} + +Array_v__token__Precedence v__token__build_precedences(void) { + Array_v__token__Precedence p = __new_array_with_default(((int)(v__token__Kind___end_)), 0, sizeof(v__token__Precedence), 0); + array_set(&p, v__token__Kind__lsbr, &(v__token__Precedence[]) { v__token__Precedence__index }); + array_set(&p, v__token__Kind__nilsbr, &(v__token__Precedence[]) { v__token__Precedence__index }); + array_set(&p, v__token__Kind__dot, &(v__token__Precedence[]) { v__token__Precedence__call }); + array_set(&p, v__token__Kind__inc, &(v__token__Precedence[]) { v__token__Precedence__postfix }); + array_set(&p, v__token__Kind__dec, &(v__token__Precedence[]) { v__token__Precedence__postfix }); + array_set(&p, v__token__Kind__question, &(v__token__Precedence[]) { v__token__Precedence__postfix }); + array_set(&p, v__token__Kind__mul, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__div, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__mod, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__left_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__right_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__unsigned_right_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__amp, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__arrow, &(v__token__Precedence[]) { v__token__Precedence__product }); + array_set(&p, v__token__Kind__plus, &(v__token__Precedence[]) { v__token__Precedence__sum }); + array_set(&p, v__token__Kind__minus, &(v__token__Precedence[]) { v__token__Precedence__sum }); + array_set(&p, v__token__Kind__pipe, &(v__token__Precedence[]) { v__token__Precedence__sum }); + array_set(&p, v__token__Kind__xor, &(v__token__Precedence[]) { v__token__Precedence__sum }); + array_set(&p, v__token__Kind__eq, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__ne, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__lt, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__le, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__gt, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__ge, &(v__token__Precedence[]) { v__token__Precedence__eq }); + array_set(&p, v__token__Kind__assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__plus_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__minus_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__div_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__mod_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__or_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__and_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__left_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__right_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__unsigned_right_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__mult_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__xor_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); + array_set(&p, v__token__Kind__key_in, &(v__token__Precedence[]) { v__token__Precedence__in_as }); + array_set(&p, v__token__Kind__not_in, &(v__token__Precedence[]) { v__token__Precedence__in_as }); + array_set(&p, v__token__Kind__key_as, &(v__token__Precedence[]) { v__token__Precedence__in_as }); + array_set(&p, v__token__Kind__key_is, &(v__token__Precedence[]) { v__token__Precedence__in_as }); + array_set(&p, v__token__Kind__not_is, &(v__token__Precedence[]) { v__token__Precedence__in_as }); + array_set(&p, v__token__Kind__logical_or, &(v__token__Precedence[]) { v__token__Precedence__cond }); + array_set(&p, v__token__Kind__and, &(v__token__Precedence[]) { v__token__Precedence__cond }); + Array_v__token__Precedence _t1 = p; + return _t1; +} + +// Attr: [inline] +inline int v__token__Token_precedence(v__token__Token tok) { + int _t1 = ((int)((*(v__token__Precedence*)/*ee elem_sym */array_get(_const_v__token__precedences, tok.kind)))); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Token_is_scalar(v__token__Token tok) { + bool _t1 = (tok.kind == v__token__Kind__number || tok.kind == v__token__Kind__string); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Token_is_unary(v__token__Token tok) { + bool _t1 = (tok.kind == v__token__Kind__plus || tok.kind == v__token__Kind__minus || tok.kind == v__token__Kind__not || tok.kind == v__token__Kind__bit_not || tok.kind == v__token__Kind__mul || tok.kind == v__token__Kind__amp || tok.kind == v__token__Kind__arrow); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_relational(v__token__Kind tok) { + bool _t1 = (tok == v__token__Kind__lt || tok == v__token__Kind__le || tok == v__token__Kind__gt || tok == v__token__Kind__ge || tok == v__token__Kind__eq || tok == v__token__Kind__ne); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_start_of_type(v__token__Kind k) { + bool _t1 = (k == v__token__Kind__name || k == v__token__Kind__lpar || k == v__token__Kind__amp || k == v__token__Kind__lsbr || k == v__token__Kind__question || k == v__token__Kind__key_shared || k == v__token__Kind__not); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_prefix(v__token__Kind kind) { + bool _t1 = (kind == v__token__Kind__minus || kind == v__token__Kind__amp || kind == v__token__Kind__mul || kind == v__token__Kind__not || kind == v__token__Kind__bit_not); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_infix(v__token__Kind kind) { + bool _t1 = (kind == v__token__Kind__plus || kind == v__token__Kind__minus || kind == v__token__Kind__mod || kind == v__token__Kind__mul || kind == v__token__Kind__div || kind == v__token__Kind__eq || kind == v__token__Kind__ne || kind == v__token__Kind__gt || kind == v__token__Kind__lt || kind == v__token__Kind__key_in || kind == v__token__Kind__key_as || kind == v__token__Kind__ge || kind == v__token__Kind__le || kind == v__token__Kind__logical_or || kind == v__token__Kind__xor || kind == v__token__Kind__not_in || kind == v__token__Kind__key_is || kind == v__token__Kind__not_is || kind == v__token__Kind__and || kind == v__token__Kind__dot || kind == v__token__Kind__pipe || kind == v__token__Kind__amp || kind == v__token__Kind__left_shift || kind == v__token__Kind__right_shift || kind == v__token__Kind__unsigned_right_shift || kind == v__token__Kind__arrow); + return _t1; +} + +// Attr: [inline] +inline bool v__token__Kind_is_postfix(v__token__Kind kind) { + bool _t1 = (kind == v__token__Kind__inc || kind == v__token__Kind__dec || kind == v__token__Kind__question); + return _t1; +} + +string v__token__kind_to_string(v__token__Kind k) { + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (k) { + case v__token__Kind__unknown: + { + _t2 = _SLIT("unknown"); + break; + } + case v__token__Kind__eof: + { + _t2 = _SLIT("eof"); + break; + } + case v__token__Kind__name: + { + _t2 = _SLIT("name"); + break; + } + case v__token__Kind__number: + { + _t2 = _SLIT("number"); + break; + } + case v__token__Kind__string: + { + _t2 = _SLIT("string"); + break; + } + case v__token__Kind__str_inter: + { + _t2 = _SLIT("str_inter"); + break; + } + case v__token__Kind__chartoken: + { + _t2 = _SLIT("chartoken"); + break; + } + case v__token__Kind__plus: + { + _t2 = _SLIT("plus"); + break; + } + case v__token__Kind__minus: + { + _t2 = _SLIT("minus"); + break; + } + case v__token__Kind__mul: + { + _t2 = _SLIT("mul"); + break; + } + case v__token__Kind__div: + { + _t2 = _SLIT("div"); + break; + } + case v__token__Kind__mod: + { + _t2 = _SLIT("mod"); + break; + } + case v__token__Kind__xor: + { + _t2 = _SLIT("xor"); + break; + } + case v__token__Kind__pipe: + { + _t2 = _SLIT("pipe"); + break; + } + case v__token__Kind__inc: + { + _t2 = _SLIT("inc"); + break; + } + case v__token__Kind__dec: + { + _t2 = _SLIT("dec"); + break; + } + case v__token__Kind__and: + { + _t2 = _SLIT("and"); + break; + } + case v__token__Kind__logical_or: + { + _t2 = _SLIT("logical_or"); + break; + } + case v__token__Kind__not: + { + _t2 = _SLIT("not"); + break; + } + case v__token__Kind__bit_not: + { + _t2 = _SLIT("bit_not"); + break; + } + case v__token__Kind__question: + { + _t2 = _SLIT("question"); + break; + } + case v__token__Kind__comma: + { + _t2 = _SLIT("comma"); + break; + } + case v__token__Kind__semicolon: + { + _t2 = _SLIT("semicolon"); + break; + } + case v__token__Kind__colon: + { + _t2 = _SLIT("colon"); + break; + } + case v__token__Kind__arrow: + { + _t2 = _SLIT("arrow"); + break; + } + case v__token__Kind__amp: + { + _t2 = _SLIT("amp"); + break; + } + case v__token__Kind__hash: + { + _t2 = _SLIT("hash"); + break; + } + case v__token__Kind__dollar: + { + _t2 = _SLIT("dollar"); + break; + } + case v__token__Kind__at: + { + _t2 = _SLIT("at"); + break; + } + case v__token__Kind__str_dollar: + { + _t2 = _SLIT("str_dollar"); + break; + } + case v__token__Kind__left_shift: + { + _t2 = _SLIT("left_shift"); + break; + } + case v__token__Kind__right_shift: + { + _t2 = _SLIT("right_shift"); + break; + } + case v__token__Kind__unsigned_right_shift: + { + _t2 = _SLIT("unsigned_right_shift"); + break; + } + case v__token__Kind__not_in: + { + _t2 = _SLIT("not_in"); + break; + } + case v__token__Kind__not_is: + { + _t2 = _SLIT("not_is"); + break; + } + case v__token__Kind__assign: + { + _t2 = _SLIT("assign"); + break; + } + case v__token__Kind__decl_assign: + { + _t2 = _SLIT("decl_assign"); + break; + } + case v__token__Kind__plus_assign: + { + _t2 = _SLIT("plus_assign"); + break; + } + case v__token__Kind__minus_assign: + { + _t2 = _SLIT("minus_assign"); + break; + } + case v__token__Kind__div_assign: + { + _t2 = _SLIT("div_assign"); + break; + } + case v__token__Kind__mult_assign: + { + _t2 = _SLIT("mult_assign"); + break; + } + case v__token__Kind__xor_assign: + { + _t2 = _SLIT("xor_assign"); + break; + } + case v__token__Kind__mod_assign: + { + _t2 = _SLIT("mod_assign"); + break; + } + case v__token__Kind__or_assign: + { + _t2 = _SLIT("or_assign"); + break; + } + case v__token__Kind__and_assign: + { + _t2 = _SLIT("and_assign"); + break; + } + case v__token__Kind__right_shift_assign: + { + _t2 = _SLIT("right_shift_assign"); + break; + } + case v__token__Kind__left_shift_assign: + { + _t2 = _SLIT("left_shift_assign"); + break; + } + case v__token__Kind__unsigned_right_shift_assign: + { + _t2 = _SLIT("unsigned_right_shift_assign"); + break; + } + case v__token__Kind__lcbr: + { + _t2 = _SLIT("lcbr"); + break; + } + case v__token__Kind__rcbr: + { + _t2 = _SLIT("rcbr"); + break; + } + case v__token__Kind__lpar: + { + _t2 = _SLIT("lpar"); + break; + } + case v__token__Kind__rpar: + { + _t2 = _SLIT("rpar"); + break; + } + case v__token__Kind__lsbr: + { + _t2 = _SLIT("lsbr"); + break; + } + case v__token__Kind__nilsbr: + { + _t2 = _SLIT("nilsbr"); + break; + } + case v__token__Kind__rsbr: + { + _t2 = _SLIT("rsbr"); + break; + } + case v__token__Kind__eq: + { + _t2 = _SLIT("eq"); + break; + } + case v__token__Kind__ne: + { + _t2 = _SLIT("ne"); + break; + } + case v__token__Kind__gt: + { + _t2 = _SLIT("gt"); + break; + } + case v__token__Kind__lt: + { + _t2 = _SLIT("lt"); + break; + } + case v__token__Kind__ge: + { + _t2 = _SLIT("ge"); + break; + } + case v__token__Kind__le: + { + _t2 = _SLIT("le"); + break; + } + case v__token__Kind__comment: + { + _t2 = _SLIT("comment"); + break; + } + case v__token__Kind__nl: + { + _t2 = _SLIT("nl"); + break; + } + case v__token__Kind__dot: + { + _t2 = _SLIT("dot"); + break; + } + case v__token__Kind__dotdot: + { + _t2 = _SLIT("dotdot"); + break; + } + case v__token__Kind__ellipsis: + { + _t2 = _SLIT("ellipsis"); + break; + } + case v__token__Kind__keyword_beg: + { + _t2 = _SLIT("keyword_beg"); + break; + } + case v__token__Kind__key_as: + { + _t2 = _SLIT("key_as"); + break; + } + case v__token__Kind__key_asm: + { + _t2 = _SLIT("key_asm"); + break; + } + case v__token__Kind__key_assert: + { + _t2 = _SLIT("key_assert"); + break; + } + case v__token__Kind__key_atomic: + { + _t2 = _SLIT("key_atomic"); + break; + } + case v__token__Kind__key_break: + { + _t2 = _SLIT("key_break"); + break; + } + case v__token__Kind__key_const: + { + _t2 = _SLIT("key_const"); + break; + } + case v__token__Kind__key_continue: + { + _t2 = _SLIT("key_continue"); + break; + } + case v__token__Kind__key_defer: + { + _t2 = _SLIT("key_defer"); + break; + } + case v__token__Kind__key_else: + { + _t2 = _SLIT("key_else"); + break; + } + case v__token__Kind__key_enum: + { + _t2 = _SLIT("key_enum"); + break; + } + case v__token__Kind__key_false: + { + _t2 = _SLIT("key_false"); + break; + } + case v__token__Kind__key_for: + { + _t2 = _SLIT("key_for"); + break; + } + case v__token__Kind__key_fn: + { + _t2 = _SLIT("key_fn"); + break; + } + case v__token__Kind__key_global: + { + _t2 = _SLIT("key_global"); + break; + } + case v__token__Kind__key_go: + { + _t2 = _SLIT("key_go"); + break; + } + case v__token__Kind__key_goto: + { + _t2 = _SLIT("key_goto"); + break; + } + case v__token__Kind__key_if: + { + _t2 = _SLIT("key_if"); + break; + } + case v__token__Kind__key_import: + { + _t2 = _SLIT("key_import"); + break; + } + case v__token__Kind__key_in: + { + _t2 = _SLIT("key_in"); + break; + } + case v__token__Kind__key_interface: + { + _t2 = _SLIT("key_interface"); + break; + } + case v__token__Kind__key_is: + { + _t2 = _SLIT("key_is"); + break; + } + case v__token__Kind__key_match: + { + _t2 = _SLIT("key_match"); + break; + } + case v__token__Kind__key_module: + { + _t2 = _SLIT("key_module"); + break; + } + case v__token__Kind__key_mut: + { + _t2 = _SLIT("key_mut"); + break; + } + case v__token__Kind__key_shared: + { + _t2 = _SLIT("key_shared"); + break; + } + case v__token__Kind__key_lock: + { + _t2 = _SLIT("key_lock"); + break; + } + case v__token__Kind__key_rlock: + { + _t2 = _SLIT("key_rlock"); + break; + } + case v__token__Kind__key_none: + { + _t2 = _SLIT("key_none"); + break; + } + case v__token__Kind__key_return: + { + _t2 = _SLIT("key_return"); + break; + } + case v__token__Kind__key_select: + { + _t2 = _SLIT("key_select"); + break; + } + case v__token__Kind__key_sizeof: + { + _t2 = _SLIT("key_sizeof"); + break; + } + case v__token__Kind__key_isreftype: + { + _t2 = _SLIT("key_isreftype"); + break; + } + case v__token__Kind__key_likely: + { + _t2 = _SLIT("key_likely"); + break; + } + case v__token__Kind__key_unlikely: + { + _t2 = _SLIT("key_unlikely"); + break; + } + case v__token__Kind__key_offsetof: + { + _t2 = _SLIT("key_offsetof"); + break; + } + case v__token__Kind__key_struct: + { + _t2 = _SLIT("key_struct"); + break; + } + case v__token__Kind__key_true: + { + _t2 = _SLIT("key_true"); + break; + } + case v__token__Kind__key_type: + { + _t2 = _SLIT("key_type"); + break; + } + case v__token__Kind__key_typeof: + { + _t2 = _SLIT("key_typeof"); + break; + } + case v__token__Kind__key_dump: + { + _t2 = _SLIT("key_dump"); + break; + } + case v__token__Kind__key_orelse: + { + _t2 = _SLIT("key_orelse"); + break; + } + case v__token__Kind__key_union: + { + _t2 = _SLIT("key_union"); + break; + } + case v__token__Kind__key_pub: + { + _t2 = _SLIT("key_pub"); + break; + } + case v__token__Kind__key_static: + { + _t2 = _SLIT("key_static"); + break; + } + case v__token__Kind__key_volatile: + { + _t2 = _SLIT("key_volatile"); + break; + } + case v__token__Kind__key_unsafe: + { + _t2 = _SLIT("key_unsafe"); + break; + } + case v__token__Kind__keyword_end: + { + _t2 = _SLIT("keyword_end"); + break; + } + case v__token__Kind___end_: + { + _t2 = _SLIT("_end_"); + break; + } + } + string _t1 = _t2; + return _t1; +} + +_option_v__token__Kind v__token__kind_from_string(string s) { + _option_v__token__Kind _t2 = {0}; + + if (string__eq(s, _SLIT("unknown"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__unknown }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("eof"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__eof }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("name"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__name }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("number"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__number }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("string"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__string }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("str_inter"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__str_inter }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("chartoken"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__chartoken }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("plus"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__plus }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("minus"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__minus }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("mul"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__mul }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("div"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__div }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("mod"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__mod }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("xor"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__xor }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("pipe"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__pipe }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("inc"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__inc }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("dec"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__dec }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("and"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__and }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("logical_or"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__logical_or }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("not"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__not }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("bit_not"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__bit_not }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("question"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__question }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("comma"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__comma }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("semicolon"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__semicolon }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("colon"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__colon }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("arrow"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__arrow }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("amp"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__amp }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("hash"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__hash }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("dollar"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__dollar }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("at"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__at }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("str_dollar"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__str_dollar }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("left_shift"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__left_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("right_shift"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__right_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("unsigned_right_shift"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__unsigned_right_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("not_in"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__not_in }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("not_is"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__not_is }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("decl_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__decl_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("plus_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__plus_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("minus_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__minus_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("div_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__div_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("mult_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__mult_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("xor_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__xor_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("mod_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__mod_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("or_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__or_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("and_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__and_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("right_shift_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__right_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("left_shift_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__left_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("unsigned_right_shift_assign"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__unsigned_right_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("lcbr"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__lcbr }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("rcbr"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__rcbr }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("lpar"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__lpar }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("rpar"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__rpar }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("lsbr"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__lsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("nilsbr"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__nilsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("rsbr"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__rsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("eq"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__eq }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("ne"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__ne }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("gt"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__gt }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("lt"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__lt }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("ge"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__ge }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("le"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__le }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("comment"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__comment }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("nl"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__nl }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("dot"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__dot }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("dotdot"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__dotdot }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("ellipsis"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__ellipsis }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("keyword_beg"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__keyword_beg }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_as"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_as }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_asm"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_asm }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_assert"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_assert }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_atomic"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_atomic }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_break"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_break }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_const"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_const }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_continue"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_continue }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_defer"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_defer }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_else"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_else }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_enum"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_enum }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_false"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_false }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_for"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_for }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_fn"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_fn }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_global"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_global }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_go"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_go }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_goto"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_goto }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_if"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_if }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_import"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_import }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_in"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_in }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_interface"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_interface }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_is"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_is }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_match"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_match }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_module"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_module }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_mut"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_mut }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_shared"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_shared }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_lock"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_lock }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_rlock"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_rlock }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_none"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_none }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_return"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_return }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_select"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_select }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_sizeof"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_sizeof }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_isreftype"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_isreftype }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_likely"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_likely }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_unlikely"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_unlikely }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_offsetof"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_offsetof }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_struct"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_struct }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_true"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_true }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_type"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_type }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_typeof"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_typeof }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_dump"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_dump }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_orelse"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_orelse }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_union"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_union }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_pub"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_pub }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_static"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_static }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_volatile"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_volatile }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("key_unsafe"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_unsafe }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("keyword_end"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind__keyword_end }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else if (string__eq(s, _SLIT("_end_"))) { + opt_ok2(&(v__token__Kind[]) { v__token__Kind___end_ }, (_option*)(&_t2), sizeof(v__token__Kind)); + } + else { + _t2.state = 2; + _t2.err = _v_error(_SLIT("unknown")); + }_option_v__token__Kind _t1 = _t2; + return _t1; +} + +// Attr: [inline] +inline int v__mathutil__min_T_int(int a, int b) { + int _t1 = (a < b ? (a) : (b)); + return _t1; +} + +// Attr: [inline] +inline int v__mathutil__max_T_int(int a, int b) { + int _t1 = (a > b ? (a) : (b)); + return _t1; +} + +i64 time__portable_timegm(struct tm* t) { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if (month > 11) { + year += month / 12; + month %= 12; + } else if (month < 0) { + int years_diff = (11 - month) / 12; + year -= years_diff; + month += 12 * years_diff; + } + i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); + i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; + return _t1; +} + +int time__days_from_civil(int oy, int m, int d) { + int y = (m <= 2 ? (oy - 1) : (oy)); + int era = y / 400; + int yoe = y - era * 400; + int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; + int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + int _t1 = era * 146097 + doe - 719468; + return _t1; +} + +string time__Time_format(time__Time t) { + string _t1 = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss(time__Time t) { + string _t1 = str_intp(7, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss_milli(time__Time t) { + string _t1 = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss_micro(time__Time t) { + string _t1 = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmm(time__Time t) { + string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmmss(time__Time t) { + string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmm12(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; +} + +string time__Time_ymmdd(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_ddmmy(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); + return _t1; +} + +string time__Time_md(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); + return _t1; +} + +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { + if (n > 3 && n < 21) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t1; + } + int _t2 = n % 10; + + if (_t2 == (1)) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); + return _t3; + } + else if (_t2 == (2)) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); + return _t4; + } + else if (_t2 == (3)) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); + return _t5; + } + else { + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t6; + }; + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_custom_format(time__Time t, string s) { + Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); + for (int i = 0; i < s.len; ) { + for (int j = 4; j > 0; j--) { + if (i > s.len - j) { + continue; + } + if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { + array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); + i += (j - 1); + break; + } + } + i++; + } + strings__Builder sb = strings__new_builder(128); + for (int _t2 = 0; _t2 < tokens.len; ++_t2) { + string token = ((string*)tokens.data)[_t2]; + + if (string__eq(token, _SLIT("M"))) { + strings__Builder_write_string(&sb, int_str(t.month)); + } + else if (string__eq(token, _SLIT("MM"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Mo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); + } + else if (string__eq(token, _SLIT("MMM"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("MMMM"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); + } + else if (string__eq(token, _SLIT("D"))) { + strings__Builder_write_string(&sb, int_str(t.day)); + } + else if (string__eq(token, _SLIT("DD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Do"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); + } + else if (string__eq(token, _SLIT("DDD"))) { + strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); + } + else if (string__eq(token, _SLIT("DDDD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("DDDo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); + } + else if (string__eq(token, _SLIT("d"))) { + strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); + } + else if (string__eq(token, _SLIT("dd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); + } + else if (string__eq(token, _SLIT("ddd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("dddd"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); + } + else if (string__eq(token, _SLIT("YY"))) { + strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); + } + else if (string__eq(token, _SLIT("YYYY"))) { + strings__Builder_write_string(&sb, int_str(t.year)); + } + else if (string__eq(token, _SLIT("H"))) { + strings__Builder_write_string(&sb, int_str(t.hour)); + } + else if (string__eq(token, _SLIT("HH"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("h"))) { + strings__Builder_write_string(&sb, int_str((t.hour % 12))); + } + else if (string__eq(token, _SLIT("hh"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("m"))) { + strings__Builder_write_string(&sb, int_str(t.minute)); + } + else if (string__eq(token, _SLIT("mm"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("s"))) { + strings__Builder_write_string(&sb, int_str(t.second)); + } + else if (string__eq(token, _SLIT("ss"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("k"))) { + strings__Builder_write_string(&sb, int_str((t.hour + 1))); + } + else if (string__eq(token, _SLIT("kk"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("w"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1000f, {.d_f64 = time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("ww"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x8005002f, {.d_f64 = time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("wo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); + } + else if (string__eq(token, _SLIT("Q"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("QQ"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Qo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); + } + else if (string__eq(token, _SLIT("c"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("N"))) { + strings__Builder_write_string(&sb, _SLIT("AD")); + } + else if (string__eq(token, _SLIT("NN"))) { + strings__Builder_write_string(&sb, _SLIT("Anno Domini")); + } + else if (string__eq(token, _SLIT("Z"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("a"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("pm")); + } else { + strings__Builder_write_string(&sb, _SLIT("am")); + } + } + else if (string__eq(token, _SLIT("A"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("PM")); + } else { + strings__Builder_write_string(&sb, _SLIT("AM")); + } + } + else { + strings__Builder_write_string(&sb, token); + }; + } + string _t3 = strings__Builder_str(&sb); + return _t3; +} + +string time__Time_clean(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_clean12(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } + string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); + int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); + string _t3 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_time) { + case time__FormatTime__hhmm12: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmm24: + { + _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss12: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_milli: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_micro: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__no_time: + default: + { + _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatTime*/0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string _t2 = _t3; + return _t2; +} + +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + string _t1 = _SLIT(""); + return _t1; + } + string month = time__Time_smonth(&t); + string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_date) { + case time__FormatDate__ddmmyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__ddmmyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmdd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yyyymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__no_date: + default: + { + _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatDate*/0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string res = _t2; + string del = ((fmt_dlmtr == (time__FormatDelimiter__dot))? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen))? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash))? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space))? (_SLIT(" ")) : (_SLIT(""))); + res = string_replace(res, _SLIT("|"), del); + string _t3 = res; + return _t3; +} + +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } else { + string _t2 = time__Time_get_fmt_time_str(t, fmt_time); + return _t2; + } + } else { + if (fmt_time != time__FormatTime__no_time) { + string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + string tstr = time__Time_get_fmt_time_str(t, fmt_time); + string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dstr}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } else { + string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + return _t4; + } + } + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_utc_string(time__Time t) { + string day_str = time__Time_weekday_str(&t); + string month_str = time__Time_smonth(&t); + string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = day_str}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = month_str}}, {_SLIT(" "), /*100 &int*/0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); + string _t1 = utc_string; + return _t1; +} + +VV_LOCAL_SYMBOL f64 time__mceil(f64 x) { + if (x > 0) { + f64 _t1 = 1 + ((int)(x)); + return _t1; + } + if (x < 0) { + f64 _t2 = -((int)(-x)); + return _t2; + } + f64 _t3 = 0; + return _t3; +} + +// Attr: [inline] +inline bool time__Time__eq(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__lt(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); + return _t1; +} + +// Attr: [inline] +inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { + i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; + i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; + time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; + return _t1; +} + +_option_time__Time time__parse_rfc3339(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); + _option_time__Time _t2 = time__parse_iso8601(sn); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + } + + time__Time t = (*(time__Time*)_t2.data); + if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { + _option_time__Time _t3; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t3), sizeof(time__Time)); + return _t3; + } + _option_int _t4 = string_index(sn, _SLIT("T")); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(int*) _t4.data = -1; + } + + int t_i = (*(int*)_t4.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); + if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { + _option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); + if (_t5.state != 0) { /*or block*/ + _option_time__Time _t6; + memcpy(&_t6, &_t5, sizeof(_option)); + return _t6; + } + + multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); + int year = mr_1001.arg0; + int month = mr_1001.arg1; + int day = mr_1001.arg2; + t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); + _option_time__Time _t7; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t7), sizeof(time__Time)); + return _t7; + } + if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + _option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t8.state != 0) { /*or block*/ + _option_time__Time _t9; + memcpy(&_t9, &_t8, sizeof(_option)); + return _t9; + } + + multi_return_int_int_int_int_i64_bool mr_1383 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); + hour_ = mr_1383.arg0; + minute_ = mr_1383.arg1; + second_ = mr_1383.arg2; + microsecond_ = mr_1383.arg3; + unix_offset = mr_1383.arg4; + is_local_time = mr_1383.arg5; + t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); + if (is_local_time) { + _option_time__Time _t10; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t10), sizeof(time__Time)); + return _t10; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + _option_time__Time _t11; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t11), sizeof(time__Time)); + return _t11; + } + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +_option_time__Time time__parse(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t2 = string_index(s, _SLIT(" ")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t2.data); + string symd = string_substr(s, 0, pos); + Array_string ymd = string_split(symd, _SLIT("-")); + if (ymd.len != 3) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string shms = string_substr(s, pos, (s).len); + Array_string hms = string_split(shms, _SLIT(":")); + string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); + string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); + string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); + int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); + int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); + int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); + int ihour = string_int(hour_); + int iminute = string_int(minute_); + int isecond = string_int(second_); + if (iyear > 9999 || iyear < -9999) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (imonth > 12 || imonth < 1) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iday > 31 || iday < 1) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (ihour > 23 || ihour < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iminute > 59 || iminute < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (isecond > 59 || isecond < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + time__Time res = time__new_time(((time__Time){ + .year = iyear, + .month = imonth, + .day = iday, + .hour = ihour, + .minute = iminute, + .second = isecond, + .microsecond = 0, + ._v_unix = 0, + .is_local = 0, + })); + _option_time__Time _t11; + opt_ok2(&(time__Time[]) { res }, (_option*)(&_t11), sizeof(time__Time)); + return _t11; +} + +_option_time__Time time__parse_iso8601(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t2 = string_index(s, _SLIT("T")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(int*) _t2.data = -1; + } + + int t_i = (*(int*)_t2.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); + if (!(parts.len == 1 || parts.len == 2)) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t4.state != 0) { /*or block*/ + _option_time__Time _t5; + memcpy(&_t5, &_t4, sizeof(_option)); + return _t5; + } + + multi_return_int_int_int mr_3644 = (*(multi_return_int_int_int*)_t4.data); + int year = mr_3644.arg0; + int month = mr_3644.arg1; + int day = mr_3644.arg2; + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + if (parts.len == 2) { + _option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); + if (_t6.state != 0) { /*or block*/ + _option_time__Time _t7; + memcpy(&_t7, &_t6, sizeof(_option)); + return _t7; + } + + multi_return_int_int_int_int_i64_bool mr_3885 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); + hour_ = mr_3885.arg0; + minute_ = mr_3885.arg1; + second_ = mr_3885.arg2; + microsecond_ = mr_3885.arg3; + unix_offset = mr_3885.arg4; + is_local_time = mr_3885.arg5; + } + time__Time t = time__new_time(((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hour_, + .minute = minute_, + .second = second_, + .microsecond = microsecond_, + ._v_unix = 0, + .is_local = 0, + })); + if (is_local_time) { + _option_time__Time _t8; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t8), sizeof(time__Time)); + return _t8; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + _option_time__Time _t9; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t9), sizeof(time__Time)); + return _t9; +} + +_option_time__Time time__parse_rfc2822(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Array_string fields = string_split(s, _SLIT(" ")); + if (fields.len < 5) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t3.data); + int mm = pos / 3 + 1; + { // Unsafe block + u8* tmstr = malloc_noscan(s.len * 2); + int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); + _option_time__Time _t5 = time__parse(tos(tmstr, count)); + return _t5; + } + return (_option_time__Time){0}; +} + +VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s) { + int year = 0; + int month = 0; + int day = 0; + u8 dummy = ((u8)(0)); + int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); + if (count != 3) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (year > 9999) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (month > 12) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (day > 31) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_multi_return_int_int_int _t5; + opt_ok2(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (_option*)(&_t5), sizeof(multi_return_int_int_int)); + return _t5; +} + +VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + int nanosecond_ = 0; + rune plus_min_z = 'a'; + int offset_hour = 0; + int offset_minute = 0; + int count = 0; + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%9d%c", &hour_, &minute_, &second_, &nanosecond_, ((char*)(&plus_min_z))); + if (count == 5 && plus_min_z == 'Z') { + int ndigits = 0; + _option_int _t1; + if (_t1 = string_index(s, _SLIT(".")), _t1.state == 0) { + int pos = *(int*)_t1.data; + pos++; + for (; pos < s.len && u8_is_digit(string_at(s, pos)); pos++) { + ndigits++; + } + } + for (;;) { + if (!(ndigits < 9)) break; + nanosecond_ *= 10; + ndigits++; + } + microsecond_ = nanosecond_ / 1000; + } else { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + if (count < 4) { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + count++; + } + if (count < 4) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + } + bool is_local_time = plus_min_z == 'a' && count == 4; + bool is_utc = plus_min_z == 'Z' && count == 5; + if (!(count == 7 || is_local_time || is_utc)) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int unix_offset = 0; + if (offset_hour > 0) { + unix_offset += 3600 * offset_hour; + } + if (offset_minute > 0) { + unix_offset += 60 * offset_minute; + } + if (plus_min_z == '+') { + unix_offset *= -1; + } + _option_multi_return_int_int_int_int_i64_bool _t5; + opt_ok2(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (_option*)(&_t5), sizeof(multi_return_int_int_int_int_i64_bool)); + return _t5; +} + +string time__TimeParseError_msg(time__TimeParseError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), /*100 &int*/0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { + IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); + return _t1; +} + +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { + u64 initial = ((u64)(0U)); + if (opts.auto_start) { + initial = time__sys_mono_now(); + } + time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); + return _t1; +} + +void time__StopWatch_start(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; +} + +void time__StopWatch_restart(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; + t->elapsed = 0U; +} + +void time__StopWatch_stop(time__StopWatch* t) { + t->end = time__sys_mono_now(); +} + +void time__StopWatch_pause(time__StopWatch* t) { + if (t->start > 0U) { + if (t->end == 0U) { + t->elapsed += time__sys_mono_now() - t->start; + } else { + t->elapsed += t->end - t->start; + } + } + t->start = 0U; +} + +time__Duration time__StopWatch_elapsed(time__StopWatch t) { + if (t.start > 0U) { + if (t.end == 0U) { + time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); + return _t1; + } else { + time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); + return _t2; + } + } + time__Duration _t3 = ((((i64)(t.elapsed)))); + return _t3; +} + +time__Time time__now(void) { + #if defined(__APPLE__) + { + time__Time _t1 = time__darwin_now(); + return _t1; + } + #endif + #if defined(_WIN32) + { + time__Time _t2 = time__win_now(); + return _t2; + } + #endif + #if defined(__sun) + { + time__Time _t3 = time__solaris_now(); + return _t3; + } + #endif + #if defined(__linux__) || defined(__ANDROID__) + { + time__Time _t4 = time__linux_now(); + return _t4; + } + #endif + time_t t = time(0); + struct tm* now = localtime(&t); + time__Time _t5 = time__convert_ctime(*now, 0); + return _t5; +} + +time__Time time__utc(void) { + #if defined(__APPLE__) + { + time__Time _t1 = time__darwin_utc(); + return _t1; + } + #endif + #if defined(_WIN32) + { + time__Time _t2 = time__win_utc(); + return _t2; + } + #endif + #if defined(__sun) + { + time__Time _t3 = time__solaris_utc(); + return _t3; + } + #endif + #if defined(__linux__) || defined(__ANDROID__) + { + time__Time _t4 = time__linux_utc(); + return _t4; + } + #endif + time_t t = time(0); + time(&t); + time__Time _t5 = time__unix2(((i64)(t)), 0); + return _t5; +} + +time__Time time__new_time(time__Time t) { + if (t._v_unix != 0) { + time__Time _t1 = t; + return _t1; + } + struct tm tt = ((struct tm){ + .tm_sec = t.second, + .tm_min = t.minute, + .tm_hour = t.hour, + .tm_mday = t.day, + .tm_mon = t.month - 1, + .tm_year = t.year - 1900, + .tm_wday = 0, + .tm_yday = 0, + .tm_isdst = 0, + }); + i64 utime = time__make_unix_time(tt); + time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); + return _t2; +} + +i64 time__ticks(void) { + #if defined(_WIN32) + { + i64 _t1 = GetTickCount(); + return _t1; + } + #else + { + struct timeval ts = ((struct timeval){.tv_sec = 0,.tv_usec = 0,}); + gettimeofday(&ts, 0); + i64 _t2 = ((i64)(ts.tv_sec * ((u64)(1000U)) + (ts.tv_usec / ((u64)(1000U))))); + return _t2; + } + #endif + return 0; +} + +string time__Time_str(time__Time t) { + string _t1 = time__Time_format_ss(t); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { + time__Time _t1 = ((time__Time){ + .year = t.tm_year + 1900, + .month = t.tm_mon + 1, + .day = t.tm_mday, + .hour = t.tm_hour, + .minute = t.tm_min, + .second = t.tm_sec, + .microsecond = microsecond, + ._v_unix = time__make_unix_time(t), + .is_local = true, + }); + return _t1; +} + +string time__Time_strftime(time__Time t, string fmt) { + struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}, sizeof(struct tm))); + #if defined(_WIN32) + { + tm = gmtime(((voidptr)(&t._v_unix))); + } + #else + { + gmtime_r(((voidptr)(&t._v_unix)), tm); + } + #endif + Array_fixed_C__char_1024 buf = {0}; + char* fmt_c = ((char*)(fmt.str)); + strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); + string _t1 = cstring_to_vstring(((char*)(&buf[0]))); + return _t1; +} + +string time__Time_smonth(time__Time* t) { + if (t->month <= 0 || t->month > 12) { + string _t1 = _SLIT("---"); + return _t1; + } + int i = t->month - 1; + string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); + return _t2; +} + +// Attr: [inline] +inline i64 time__Time_unix_time(time__Time* t) { + i64 _t1 = t->_v_unix; + return _t1; +} + +// Attr: [inline] +inline i64 time__Time_unix_time_milli(time__Time* t) { + i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); + return _t1; +} + +time__Time time__Time_add(time__Time* t, time__Duration d) { + i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); + i64 _v_unix = microseconds / 1000000; + i64 micro = microseconds % 1000000; + time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); + return _t1; +} + +time__Time time__Time_add_seconds(time__Time* t, int seconds) { + time__Time _t1 = time__Time_add(t, seconds * _const_time__second); + return _t1; +} + +time__Time time__Time_add_days(time__Time* t, int days) { + time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); + return _t1; +} + +time__Duration time__since(time__Time t) { + time__Duration _t1 = time__Time__minus(time__now(), t); + return _t1; +} + +string time__Time_relative(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + string prefix = _SLIT(""); + string suffix = _SLIT(""); + if (secs < 0) { + secs *= -1; + prefix = _SLIT("in "); + } else { + suffix = _SLIT(" ago"); + } + if (secs < _const_time__seconds_per_minute / 2) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < _const_time__seconds_per_hour) { + i64 m = secs / _const_time__seconds_per_minute; + if (m == 1) { + string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (secs < _const_time__seconds_per_hour * 24) { + i64 h = secs / _const_time__seconds_per_hour; + if (h == 1) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t4; + } + string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t5; + } + if (secs < _const_time__seconds_per_hour * 24 * 7) { + i64 d = secs / _const_time__seconds_per_hour / 24; + if (d == 1) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t7; + } + if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { + if (string__eq(prefix, _SLIT("in "))) { + string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t8; + } + string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t9; + } + i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; + if (y == 1) { + string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t10; + } + string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t11; +} + +string time__Time_relative_short(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + string prefix = _SLIT(""); + string suffix = _SLIT(""); + if (secs < 0) { + secs *= -1; + prefix = _SLIT("in "); + } else { + suffix = _SLIT(" ago"); + } + if (secs < _const_time__seconds_per_minute / 2) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < _const_time__seconds_per_hour) { + i64 m = secs / _const_time__seconds_per_minute; + if (m == 1) { + string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (secs < _const_time__seconds_per_hour * 24) { + i64 h = secs / _const_time__seconds_per_hour; + if (h == 1) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t4; + } + string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t5; + } + if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { + i64 d = secs / _const_time__seconds_per_hour / 24; + if (d == 1) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t7; + } + i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; + if (y == 1) { + string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t8; + } + string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t9; +} + +int time__day_of_week(int y, int m, int d) { + Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 0, 3, 2, 5, 0, 3, 5, 1, 4, + 6, 2, 4})); + int sy = y; + if (m < 3) { + sy = sy - 1; + } + int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; + return _t1; +} + +int time__Time_day_of_week(time__Time* t) { + int _t1 = time__day_of_week(t->year, t->month, t->day); + return _t1; +} + +string time__Time_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); + return _t1; +} + +string time__Time_long_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); + return _t1; +} + +bool time__is_leap_year(int year) { + bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); + return _t1; +} + +_option_int time__days_in_month(int month, int year) { + if (month > 12 || month < 1) { + return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), /*100 &int*/0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); + int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; + _option_int _t2; + opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); + return _t2; +} + +string time__Time_debug(time__Time* t) { + string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), /*100 &int*/0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), /*100 &int*/0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), /*100 &int*/0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), /*100 &int*/0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), /*100 &int*/0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), /*100 &int*/0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), /*100 &int*/0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), /*100 &i64*/0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t1; +} + +// TypeDecl +i64 time__Duration_nanoseconds(time__Duration d) { + i64 _t1 = ((i64)(d)); + return _t1; +} + +i64 time__Duration_microseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / _const_time__microsecond; + return _t1; +} + +i64 time__Duration_milliseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / _const_time__millisecond; + return _t1; +} + +f64 time__Duration_seconds(time__Duration d) { + i64 sec = d / _const_time__second; + i64 nsec = d % _const_time__second; + f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / _const_time__second; + return _t1; +} + +f64 time__Duration_minutes(time__Duration d) { + i64 min = d / _const_time__minute; + i64 nsec = d % _const_time__minute; + f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / _const_time__minute; + return _t1; +} + +f64 time__Duration_hours(time__Duration d) { + i64 hr = d / _const_time__hour; + i64 nsec = d % _const_time__hour; + f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / _const_time__hour; + return _t1; +} + +string time__Duration_str(time__Duration d) { + if (time__Duration_alias_eq(d, _const_time__infinite)) { + string _t1 = _SLIT("inf"); + return _t1; + } + i64 t = ((i64)(d)); + i64 hr = t / _const_time__hour; + t -= hr * _const_time__hour; + i64 min = t / _const_time__minute; + t -= min * _const_time__minute; + i64 sec = t / _const_time__second; + t -= sec * _const_time__second; + i64 ms = t / _const_time__millisecond; + t -= ms * _const_time__millisecond; + i64 us = t / _const_time__microsecond; + t -= us * _const_time__microsecond; + i64 ns = t; + if (hr > 0) { + string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = hr}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + if (min > 0) { + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (sec > 0) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); + return _t4; + } + if (ms > 0) { + string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ms}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); + return _t5; + } + if (us > 0) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = us}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); + return _t7; +} + +int time__offset(void) { + time__Time t = time__utc(); + time__Time local = time__Time_local(&t); + int _t1 = ((int)(local._v_unix - t._v_unix)); + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void) { + u64 _t1 = 0U; + return _t1; +} + +time__Time time__darwin_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__darwin_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { + i64 _t1 = ((i64)(timegm(&t))); + return _t1; +} + +time__Time time__Time_local(time__Time* t) { + if (t->is_local) { + time__Time _t1 = *t; + return _t1; + } + struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); + localtime_r(((voidptr)(&t->_v_unix)), &loc_tm); + time__Time _t2 = time__convert_ctime(loc_tm, t->microsecond); + return _t2; +} + +u64 time__sys_mono_now(void) { + #if defined(__APPLE__) + { + u64 _t1 = time__sys_mono_now_darwin(); + return _t1; + } + #else + { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_MONOTONIC, &ts); + u64 _t2 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); + return _t2; + } + #endif + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_MONOTONIC, &ts); + u64 _t1 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__linux_now(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); + localtime_r(((voidptr)(&ts.tv_sec)), &loc_tm); + time__Time _t1 = time__convert_ctime(loc_tm, ((int)(ts.tv_nsec / 1000))); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__linux_utc(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + time__Time _t1 = time__unix2(((i64)(ts.tv_sec)), ((int)(ts.tv_nsec / 1000))); + return _t1; +} + +time__Time time__win_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__win_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +struct timespec time__Duration_timespec(time__Duration d) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + clock_gettime(CLOCK_REALTIME, &ts); + i64 d_sec = d / _const_time__second; + i64 d_nsec = d % _const_time__second; + ts.tv_sec += d_sec; + ts.tv_nsec += d_nsec; + if (ts.tv_nsec > ((i64)(_const_time__second))) { + ts.tv_nsec -= ((i64)(_const_time__second)); + ts.tv_sec++; + } + struct timespec _t1 = ts; + return _t1; +} + +struct timespec time__zero_timespec(void) { + struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + struct timespec _t1 = ts; + return _t1; +} + +void time__sleep(time__Duration duration) { + struct timespec req = ((struct timespec){.tv_sec = duration / _const_time__second,.tv_nsec = duration % _const_time__second,}); + struct timespec rem = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); + for (;;) { + if (!(nanosleep(&req, &rem) < 0)) break; + if (errno == EINTR) { + req = rem; + } else { + break; + } + } +} + +int time__Duration_sys_milliseconds(time__Duration d) { + if (d > INT32_MAX * _const_time__millisecond) { + int _t1 = -1; + return _t1; + } else if (d <= 0) { + int _t2 = 0; + return _t2; + } else { + int _t3 = ((int)(d / _const_time__millisecond)); + return _t3; + } + return 0; +} + +time__Time time__unix(i64 abs) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); + int year = mr_472.arg0; + int month = mr_472.arg1; + int day = mr_472.arg2; + multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_528.arg0; + int min = mr_528.arg1; + int sec = mr_528.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = 0, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +time__Time time__unix2(i64 abs, int microsecond) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); + int year = mr_1020.arg0; + int month = mr_1020.arg1; + int day = mr_1020.arg2; + multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_1076.arg0; + int min = mr_1076.arg1; + int sec = mr_1076.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = microsecond, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { + i64 day_offset = day_offset_; + day_offset += 719468; + int era = 0; + if (day_offset >= 0) { + era = ((int)(day_offset / _const_time__days_per_400_years)); + } else { + era = ((int)((day_offset - _const_time__days_per_400_years - 1) / _const_time__days_per_400_years)); + } + i64 doe = day_offset - era * _const_time__days_per_400_years; + i64 yoe = (doe - doe / (_const_time__days_per_4_years - 1) + doe / _const_time__days_per_100_years - doe / (_const_time__days_per_400_years - 1)) / _const_time__days_in_year; + int y = ((int)(yoe + era * 400)); + i64 doy = doe - (_const_time__days_in_year * yoe + yoe / 4 - yoe / 100); + i64 mp = (5 * doy + 2) / 153; + int d = ((int)(doy - (153 * mp + 2) / 5 + 1)); + int m = ((int)(mp)); + if (mp < 10) { + m += 3; + } else { + m -= 9; + } + if (m <= 2) { + y += 1; + } + return (multi_return_int_int_int){.arg0=y, .arg1=m, .arg2=d}; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { + i64 second_offset = second_offset_; + if (second_offset < 0) { + second_offset += _const_time__seconds_per_day; + } + i64 hour_ = second_offset / _const_time__seconds_per_hour; + second_offset %= _const_time__seconds_per_hour; + i64 min = second_offset / _const_time__seconds_per_minute; + second_offset %= _const_time__seconds_per_minute; + return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; +} + +void v__dotgraph__start_digraph(void) { + println(_SLIT("digraph G {")); + atexit((voidptr) anon_fn_6b9593b3d6ef610a__82); +} + +v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { + v__dotgraph__DotGraph* res = ((v__dotgraph__DotGraph*)memdup(&(v__dotgraph__DotGraph){.sb = strings__new_builder(1024),}, sizeof(v__dotgraph__DotGraph))); + v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" subgraph cluster_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); + v__dotgraph__DotGraph_writeln(res, _SLIT("\tedge [fontname=\"Helvetica\",fontsize=\"10\",labelfontname=\"Helvetica\",labelfontsize=\"10\",style=\"solid\",color=\"black\"];")); + v__dotgraph__DotGraph_writeln(res, _SLIT("\tnode [fontname=\"Helvetica\",fontsize=\"10\",style=\"filled\",fontcolor=\"black\",fillcolor=\"white\",color=\"black\",shape=\"box\"];")); + v__dotgraph__DotGraph_writeln(res, _SLIT("\trankdir=\"LR\";")); + v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tcolor=\""), /*115 &string*/0xfe10, {.d_s = color}}, {_SLIT("\";"), 0, { .d_c = 0 }}}))); + v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tlabel=\""), /*115 &string*/0xfe10, {.d_s = label}}, {_SLIT("\";"), 0, { .d_c = 0 }}}))); + v__dotgraph__DotGraph* _t1 = res; + return _t1; +} + +void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line) { + strings__Builder_writeln(&d->sb, line); +} + +void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d) { + strings__Builder_writeln(&d->sb, _SLIT(" }")); + println(strings__Builder_str(&d->sb)); +} + +void v__dotgraph__DotGraph_new_node(v__dotgraph__DotGraph* d, string nlabel, v__dotgraph__NewNodeConfig cfg) { + string nname = cfg.name2node_fn(nlabel, cfg.ctx); + if ((cfg.node_name).len != 0) { + nname = cfg.node_name; + } + if (cfg.should_highlight) { + v__dotgraph__DotGraph_writeln(d, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nname}}, {_SLIT(" [label=\""), /*115 &string*/0xfe10, {.d_s = nlabel}}, {_SLIT("\",color=\"blue\",height=0.2,width=0.4,fillcolor=\"#00FF00\",tooltip=\""), /*115 &string*/0xfe10, {.d_s = cfg.tooltip}}, {_SLIT("\",shape=oval];"), 0, { .d_c = 0 }}}))); + } else { + v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nname}}, {_SLIT(" [shape=\"box\",label=\""), /*115 &string*/0xfe10, {.d_s = nlabel}}, {_SLIT("\"];"), 0, { .d_c = 0 }}}))); + } +} + +void v__dotgraph__DotGraph_new_edge(v__dotgraph__DotGraph* d, string source, string target, v__dotgraph__NewEdgeConfig cfg) { + string nsource = cfg.name2node_fn(source, cfg.ctx); + string ntarget = cfg.name2node_fn(target, cfg.ctx); + if (cfg.should_highlight) { + v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nsource}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = ntarget}}, {_SLIT(" [color=\"blue\"];"), 0, { .d_c = 0 }}}))); + } else { + v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nsource}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = ntarget}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + } +} + +// TypeDecl +string v__dotgraph__node_name(string name, voidptr context) { + string _t1 = string_replace(name, _SLIT("."), _SLIT("_")); + return _t1; +} + +// Attr: [inline] +inline u64 hash__wyhash_c(u8* key, u64 len, u64 seed) { + u64 _t1 = wyhash(key, len, seed, ((u64*)(_wyp))); + return _t1; +} + +// Attr: [inline] +inline u64 hash__wyhash64_c(u64 a, u64 b) { + u64 _t1 = wyhash64(a, b); + return _t1; +} + +// Attr: [inline] +inline u64 hash__sum64_string(string key, u64 seed) { + u64 _t1 = hash__wyhash_c(key.str, ((u64)(key.len)), seed); + return _t1; +} + +// Attr: [inline] +inline u64 hash__sum64(Array_u8 key, u64 seed) { + u64 _t1 = hash__wyhash_c(((u8*)(key.data)), ((u64)(key.len)), seed); + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k) { + u64 _t1 = ((v >> k) | (v << (64 - k))); + return _t1; +} + +// Attr: [inline] +inline u64 hash__wymum(u64 a, u64 b) { + u32 mask32 = ((u32)(4294967295U)); + u64 x0 = (a & mask32); + u64 x1 = a >> 32U; + u64 y0 = (b & mask32); + u64 y1 = b >> 32U; + u64 w0 = x0 * y0; + u64 t = x1 * y0 + (w0 >> 32U); + u64 w1 = (t & mask32); + u64 w2 = t >> 32U; + w1 += x0 * y1; + u64 hi = x1 * y1 + w2 + (w1 >> 32U); + u64 lo = a * b; + u64 _t1 = (hi ^ lo); + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k) { + { // Unsafe block + u64 _t1 = (((((u64)(p[0])) << 16U) | (((u64)(p[k >> 1U])) << 8U)) | ((u64)(p[k - 1U]))); + return _t1; + } + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p) { + { // Unsafe block + u64 _t1 = (((((u32)(p[0])) | (((u32)(p[1])) << ((u32)(8U)))) | (((u32)(p[2])) << ((u32)(16U)))) | (((u32)(p[3])) << ((u32)(24U)))); + return _t1; + } + return 0; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p) { + { // Unsafe block + u64 _t1 = (((((((((u64)(p[0])) | (((u64)(p[1])) << 8U)) | (((u64)(p[2])) << 16U)) | (((u64)(p[3])) << 24U)) | (((u64)(p[4])) << 32U)) | (((u64)(p[5])) << 40U)) | (((u64)(p[6])) << 48U)) | (((u64)(p[7])) << 56U)); + return _t1; + } + return 0; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline u32 hash__fnv1a__sum32_string(string data) { + u32 hash = _const_hash__fnv1a__fnv32_offset_basis; + for (int i = 0; i < data.len; ++i) { + hash = ((hash ^ ((u32)(data.str[ i])))) * _const_hash__fnv1a__fnv32_prime; + } + u32 _t1 = hash; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline u32 hash__fnv1a__sum32(Array_u8 data) { + u32 hash = _const_hash__fnv1a__fnv32_offset_basis; + for (int i = 0; i < data.len; ++i) { + hash = ((hash ^ ((u32)(((u8*)data.data)[i])))) * _const_hash__fnv1a__fnv32_prime; + } + u32 _t1 = hash; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +// Attr: [unsafe] +inline u32 hash__fnv1a__sum32_bytes(u8* data, int data_len) { + u32 hash = _const_hash__fnv1a__fnv32_offset_basis; + for (int i = 0; i < data_len; ++i) { + hash = ((hash ^ ((u32)(data[i])))) * _const_hash__fnv1a__fnv32_prime; + } + u32 _t1 = hash; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline u64 hash__fnv1a__sum64_string(string data) { + u64 hash = _const_hash__fnv1a__fnv64_offset_basis; + for (int i = 0; i < data.len; ++i) { + hash = ((hash ^ ((u64)(data.str[ i])))) * _const_hash__fnv1a__fnv64_prime; + } + u64 _t1 = hash; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +inline u64 hash__fnv1a__sum64(Array_u8 data) { + u64 hash = _const_hash__fnv1a__fnv64_offset_basis; + for (int i = 0; i < data.len; ++i) { + hash = ((hash ^ ((u64)(((u8*)data.data)[i])))) * _const_hash__fnv1a__fnv64_prime; + } + u64 _t1 = hash; + return _t1; +} + +// Attr: [direct_array_access] +// Attr: [inline] +// Attr: [unsafe] +inline u64 hash__fnv1a__sum64_bytes(u8* data, int data_len) { + u64 hash = _const_hash__fnv1a__fnv64_offset_basis; + for (int i = 0; i < data_len; ++i) { + hash = ((hash ^ ((u64)(data[i])))) * _const_hash__fnv1a__fnv64_prime; + } + u64 _t1 = hash; + return _t1; +} + +VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unknown flag `"), /*115 &string*/0xfe10, {.d_s = err.flag}}, {_SLIT("`"), 0, { .d_c = 0 }}})); + return _t1; +} + +VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err) { + if (err.want == 0) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Expected no arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; + } else if (err.got > err.want) { + string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Expected at most "), /*100 &int*/0xfe07, {.d_i32 = err.want}}, {_SLIT(" arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } else { + string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Expected at least "), /*100 &int*/0xfe07, {.d_i32 = err.want}}, {_SLIT(" arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + return (string){.str=(byteptr)"", .is_lit=1}; +} + +// Attr: [unsafe] +VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f) { + { // Unsafe block + string_free(&f->name); + string_free(&f->usage); + string_free(&f->val_desc); + } +} + +string flag__Flag_str(flag__Flag f) { + string _t1 = string__plus(string__plus(string__plus(string__plus(_SLIT(" flag:\n"), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" name: "), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" abbr: `"), /*115 &string*/0xfe10, {.d_s = u8_ascii_str(f.abbr)}}, {_SLIT("`\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" usag: "), /*115 &string*/0xfe10, {.d_s = f.usage}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" desc: "), /*115 &string*/0xfe10, {.d_s = f.val_desc}}, {_SLIT0, 0, { .d_c = 0 }}}))); + return _t1; +} + +string Array_flag__Flag_str(Array_flag__Flag af) { + Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); + array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT("\n []Flag = [")) })); + for (int _t2 = 0; _t2 < af.len; ++_t2) { + flag__Flag f = ((flag__Flag*)af.data)[_t2]; + array_push((array*)&res, _MOV((string[]){ string_clone(flag__Flag_str(f)) })); + } + array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(" ]")) })); + string _t5 = Array_string_join(res, _SLIT("\n")); + return _t5; +} + +// Attr: [unsafe] +VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f) { + { // Unsafe block + for (int _t1 = 0; _t1 < f->args.len; ++_t1) { + string a = ((string*)f->args.data)[_t1]; + string_free(&a); + } + array_free(&f->args); + for (int _t2 = 0; _t2 < f->flags.len; ++_t2) { + flag__Flag flag = ((flag__Flag*)f->flags.data)[_t2]; + flag__Flag_free(&flag); + } + array_free(&f->flags); + string_free(&f->application_name); + string_free(&f->application_version); + string_free(&f->application_description); + string_free(&f->args_description); + } +} + +flag__FlagParser* flag__new_flag_parser(Array_string args) { + Array_string original_args = array_clone_to_depth(&args, 0); + int idx_dashdash = Array_string_index(args, _SLIT("--")); + Array_string all_before_dashdash = array_clone_to_depth(&args, 0); + Array_string all_after_dashdash = __new_array_with_default(0, 0, sizeof(string), 0); + if (idx_dashdash >= 0) { + array_trim(&all_before_dashdash, idx_dashdash); + if (idx_dashdash < original_args.len) { + Array_string _t1; + all_after_dashdash = (_t1 = original_args, array_slice(_t1, idx_dashdash + 1, _t1.len)); + } + } + flag__FlagParser* _t2 = ((flag__FlagParser*)memdup(&(flag__FlagParser){.original_args = original_args,.idx_dashdash = idx_dashdash,.all_after_dashdash = all_after_dashdash,.usage_examples = __new_array(0, 0, sizeof(string)),.default_help_label = _SLIT("display this help and exit"),.default_version_label = _SLIT("output version information and exit"),.args = all_before_dashdash,.max_free_args = _const_flag__max_args_number,.flags = __new_array(0, 0, sizeof(flag__Flag)),.application_name = (string){.str=(byteptr)"", .is_lit=1},.application_version = (string){.str=(byteptr)"", .is_lit=1},.application_description = (string){.str=(byteptr)"", .is_lit=1},.min_free_args = 0,.args_description = (string){.str=(byteptr)"", .is_lit=1},.allow_unknown_args = 0,.footers = __new_array(0, 0, sizeof(string)),}, sizeof(flag__FlagParser))); + return _t2; +} + +void flag__FlagParser_usage_example(flag__FlagParser* fs, string example) { + array_push((array*)&fs->usage_examples, _MOV((string[]){ string_clone(example) })); +} + +void flag__FlagParser_footer(flag__FlagParser* fs, string footer) { + array_push((array*)&fs->footers, _MOV((string[]){ string_clone(footer) })); +} + +void flag__FlagParser_application(flag__FlagParser* fs, string name) { + fs->application_name = name; +} + +void flag__FlagParser_version(flag__FlagParser* fs, string vers) { + fs->application_version = vers; +} + +void flag__FlagParser_description(flag__FlagParser* fs, string desc) { + if (fs->application_description.len == 0) { + fs->application_description = desc; + } else { + fs->application_description = /*f*/string__plus(fs->application_description, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = desc}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } +} + +void flag__FlagParser_skip_executable(flag__FlagParser* fs) { + array_delete(&fs->args, 0); +} + +void flag__FlagParser_allow_unknown_args(flag__FlagParser* fs) { + fs->allow_unknown_args = true; +} + +VV_LOCAL_SYMBOL void flag__FlagParser_add_flag(flag__FlagParser* fs, string name, u8 abbr, string usage, string desc) { + array_push((array*)&fs->flags, _MOV((flag__Flag[]){ ((flag__Flag){.name = name,.abbr = abbr,.usage = usage,.val_desc = desc,}) })); +} + +// Attr: [manualfree] +VV_LOCAL_SYMBOL Array_string flag__FlagParser_parse_value(flag__FlagParser* fs, string longhand, u8 shorthand) { +bool flag__FlagParser_parse_value_defer_0 = false; +string full; +bool flag__FlagParser_parse_value_defer_1 = false; +Array_int to_delete; + full = str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT0, 0, { .d_c = 0 }}})); + flag__FlagParser_parse_value_defer_0 = true; + Array_string found_entries = __new_array_with_default(0, 0, sizeof(string), 0); + to_delete = __new_array_with_default(0, 0, sizeof(int), 0); + flag__FlagParser_parse_value_defer_1 = true; + bool should_skip_one = false; + for (int i = 0; i < fs->args.len; ++i) { + string arg = ((string*)fs->args.data)[i]; + if (should_skip_one) { + should_skip_one = false; + continue; + } + if (arg.len == 0 || string_at(arg, 0) != '-') { + continue; + } + if ((arg.len == 2 && string_at(arg, 0) == '-' && string_at(arg, 1) == shorthand) || string__eq(arg, full)) { + if (i + 1 >= fs->args.len) { + Array_string _t1 = __new_array_with_default(0, 0, sizeof(string), 0); + // Defer begin + if (flag__FlagParser_parse_value_defer_1) { + array_free(&to_delete); + } + // Defer end + // Defer begin + if (flag__FlagParser_parse_value_defer_0) { + string_free(&full); + } + // Defer end + return _t1; + } + string nextarg = (*(string*)/*ee elem_sym */array_get(fs->args, i + 1)); + if (nextarg.len > 2) { + string nextarg_rest = string_substr(nextarg, 0, 2); + if (string__eq(nextarg_rest, _SLIT("--"))) { + string_free(&nextarg_rest); + Array_string _t2 = __new_array_with_default(0, 0, sizeof(string), 0); + // Defer begin + if (flag__FlagParser_parse_value_defer_1) { + array_free(&to_delete); + } + // Defer end + // Defer begin + if (flag__FlagParser_parse_value_defer_0) { + string_free(&full); + } + // Defer end + return _t2; + } + string_free(&nextarg_rest); + } + array_push((array*)&found_entries, _MOV((string[]){ string_clone((*(string*)/*ee elem_sym */array_get(fs->args, i + 1))) })); + array_push((array*)&to_delete, _MOV((int[]){ i })); + array_push((array*)&to_delete, _MOV((int[]){ i + 1 })); + should_skip_one = true; + continue; + } + if (arg.len > full.len + 1 && string__eq(string_substr(arg, 0, full.len + 1), str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = full}}, {_SLIT("="), 0, { .d_c = 0 }}})))) { + array_push((array*)&found_entries, _MOV((string[]){ string_clone(string_substr(arg, full.len + 1, (arg).len)) })); + array_push((array*)&to_delete, _MOV((int[]){ i })); + continue; + } + } + for (int i = 0; i < to_delete.len; ++i) { + int del = ((int*)to_delete.data)[i]; + array_delete(&fs->args, del - i); + } + Array_string _t8 = found_entries; + // Defer begin + if (flag__FlagParser_parse_value_defer_1) { + array_free(&to_delete); + } + // Defer end + // Defer begin + if (flag__FlagParser_parse_value_defer_0) { + string_free(&full); + } + // Defer end + return _t8; +} + +VV_LOCAL_SYMBOL _option_string flag__FlagParser_parse_bool_value(flag__FlagParser* fs, string longhand, u8 shorthand) { + { + string full = str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT0, 0, { .d_c = 0 }}})); + for (int i = 0; i < fs->args.len; ++i) { + string arg = ((string*)fs->args.data)[i]; + if (arg.len == 0) { + continue; + } + if (string_at(arg, 0) != '-') { + continue; + } + if ((arg.len == 2 && string_at(arg, 0) == '-' && string_at(arg, 1) == shorthand) || string__eq(arg, full)) { + if (fs->args.len > i + 1 && ((string__eq((*(string*)/*ee elem_sym */array_get(fs->args, i + 1)), _SLIT("true")) || string__eq((*(string*)/*ee elem_sym */array_get(fs->args, i + 1)), _SLIT("false"))))) { + string val = (*(string*)/*ee elem_sym */array_get(fs->args, i + 1)); + array_delete(&fs->args, i + 1); + array_delete(&fs->args, i); + _option_string _t1; + opt_ok2(&(string[]) { val }, (_option*)(&_t1), sizeof(string)); + return _t1; + } else { + array_delete(&fs->args, i); + _option_string _t2; + opt_ok2(&(string[]) { _SLIT("true") }, (_option*)(&_t2), sizeof(string)); + return _t2; + } + } + if (arg.len > full.len + 1 && string__eq(string_substr(arg, 0, full.len + 1), str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = full}}, {_SLIT("="), 0, { .d_c = 0 }}})))) { + string val = string_substr(arg, full.len + 1, (arg).len); + array_delete(&fs->args, i); + _option_string _t3; + opt_ok2(&(string[]) { val }, (_option*)(&_t3), sizeof(string)); + return _t3; + } + if (arg.len > 1 && string_at(arg, 0) == '-' && string_at(arg, 1) != '-' && string_index_u8(arg, shorthand) != -1) { + _option_string _t4; + opt_ok2(&(string[]) { _SLIT("true") }, (_option*)(&_t4), sizeof(string)); + return _t4; + } + } + } + return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT("' not found"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +_option_bool flag__FlagParser_bool_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { + bool res = false; + { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + _option_string _t1 = flag__FlagParser_parse_bool_value(fs, name, abbr); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_bool){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + string parsed = (*(string*)_t1.data); + res = string__eq(parsed, _SLIT("true")); + } + _option_bool _t3; + opt_ok2(&(bool[]) { res }, (_option*)(&_t3), sizeof(bool)); + return _t3; +} + +bool flag__FlagParser_bool(flag__FlagParser* fs, string name, u8 abbr, bool bdefault, string usage) { + _option_bool _t1 = flag__FlagParser_bool_opt(fs, name, abbr, usage); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + bool _t2 = bdefault; + return _t2; + } + + bool value = (*(bool*)_t1.data); + bool _t3 = value; + return _t3; +} + +Array_int flag__FlagParser_int_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); + Array_int value = __new_array_with_default(0, 0, sizeof(int), 0); + for (int _t1 = 0; _t1 < parsed.len; ++_t1) { + string val = ((string*)parsed.data)[_t1]; + array_push((array*)&value, _MOV((int[]){ string_int(val) })); + } + Array_int _t3 = value; + return _t3; +} + +_option_int flag__FlagParser_int_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { + int res = 0; + { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); + if (parsed.len == 0) { + return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string parsed0 = (*(string*)/*ee elem_sym */array_get(parsed, 0)); + res = string_int(parsed0); + } + _option_int _t2; + opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); + return _t2; +} + +int flag__FlagParser_int(flag__FlagParser* fs, string name, u8 abbr, int idefault, string usage) { + _option_int _t1 = flag__FlagParser_int_opt(fs, name, abbr, usage); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + int _t2 = idefault; + return _t2; + } + + int value = (*(int*)_t1.data); + int _t3 = value; + return _t3; +} + +Array_f64 flag__FlagParser_float_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); + Array_f64 value = __new_array_with_default(0, 0, sizeof(f64), 0); + for (int _t1 = 0; _t1 < parsed.len; ++_t1) { + string val = ((string*)parsed.data)[_t1]; + array_push((array*)&value, _MOV((f64[]){ string_f64(val) })); + } + Array_f64 _t3 = value; + return _t3; +} + +_option_f64 flag__FlagParser_float_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { + f64 res = 0.0; + { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); + if (parsed.len == 0) { + return (_option_f64){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + res = string_f64((*(string*)/*ee elem_sym */array_get(parsed, 0))); + } + _option_f64 _t2; + opt_ok2(&(f64[]) { res }, (_option*)(&_t2), sizeof(f64)); + return _t2; +} + +f64 flag__FlagParser_float(flag__FlagParser* fs, string name, u8 abbr, f64 fdefault, string usage) { + _option_f64 _t1 = flag__FlagParser_float_opt(fs, name, abbr, usage); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + f64 _t2 = fdefault; + return _t2; + } + + f64 value = (*(f64*)_t1.data); + f64 _t3 = value; + return _t3; +} + +Array_string flag__FlagParser_string_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string _t1 = flag__FlagParser_parse_value(fs, name, abbr); + return _t1; +} + +_option_string flag__FlagParser_string_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { + string res = _SLIT(""); + { + flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); + Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); + if (parsed.len == 0) { + return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + res = (*(string*)/*ee elem_sym */array_get(parsed, 0)); + } + _option_string _t2; + opt_ok2(&(string[]) { res }, (_option*)(&_t2), sizeof(string)); + return _t2; +} + +string flag__FlagParser_string(flag__FlagParser* fs, string name, u8 abbr, string sdefault, string usage) { + _option_string _t1 = flag__FlagParser_string_opt(fs, name, abbr, usage); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + string _t2 = sdefault; + return _t2; + } + + string value = (*(string*)_t1.data); + string _t3 = value; + return _t3; +} + +_option_void flag__FlagParser_limit_free_args_to_at_least(flag__FlagParser* fs, int n) { + if (n > _const_flag__max_args_number) { + return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args_to_at_least expect n to be smaller than "), /*100 &int literal*/0xfe07, {.d_i32 = _const_flag__max_args_number}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (n <= 0) { + return (_option_void){ .state=2, .err=_v_error(_SLIT("flag.limit_free_args_to_at_least expect n to be a positive number")), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + fs->min_free_args = n; + return (_option_void){0}; +} + +_option_void flag__FlagParser_limit_free_args_to_exactly(flag__FlagParser* fs, int n) { + if (n > _const_flag__max_args_number) { + return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args_to_exactly expect n to be smaller than "), /*100 &int literal*/0xfe07, {.d_i32 = _const_flag__max_args_number}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (n < 0) { + return (_option_void){ .state=2, .err=_v_error(_SLIT("flag.limit_free_args_to_exactly expect n to be a non negative number")), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + fs->min_free_args = n; + fs->max_free_args = n; + return (_option_void){0}; +} + +_option_void flag__FlagParser_limit_free_args(flag__FlagParser* fs, int min, int max) { + if (min > max) { + return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args expect min < max, got "), /*100 &int*/0xfe07, {.d_i32 = min}}, {_SLIT(" >= "), /*100 &int*/0xfe07, {.d_i32 = max}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + fs->min_free_args = min; + fs->max_free_args = max; + return (_option_void){0}; +} + +void flag__FlagParser_arguments_description(flag__FlagParser* fs, string description) { + fs->args_description = description; +} + +string flag__FlagParser_usage(flag__FlagParser* fs) { + bool positive_min_arg = (fs->min_free_args > 0); + bool positive_max_arg = (fs->max_free_args > 0 && fs->max_free_args != _const_flag__max_args_number); + bool no_arguments = (fs->min_free_args == 0 && fs->max_free_args == 0); + string adesc = (fs->args_description.len > 0 ? (fs->args_description) : (_SLIT("[ARGS]"))); + if (no_arguments) { + adesc = _SLIT(""); + } + Array_string use = __new_array_with_default(0, 0, sizeof(string), 0); + if ((fs->application_version).len != 0) { + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fs->application_version}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_flag__underline}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + if (fs->usage_examples.len == 0) { + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Usage: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" [options] "), /*115 &string*/0xfe10, {.d_s = adesc}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } else { + for (int i = 0; i < fs->usage_examples.len; ++i) { + string example = ((string*)fs->usage_examples.data)[i]; + if (i == 0) { + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Usage: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = example}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } else { + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" or: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = example}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + } + } + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); + if ((fs->application_description).len != 0) { + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Description: "), /*115 &string*/0xfe10, {.d_s = fs->application_description}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); + } + if (positive_min_arg || positive_max_arg || no_arguments) { + if (no_arguments) { + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("This application does not expect any arguments")) })); + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); + } else { + Array_string s = __new_array_with_default(0, 0, sizeof(string), 0); + if (positive_min_arg) { + array_push((array*)&s, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("at least "), /*100 &int*/0xfe07, {.d_i32 = fs->min_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + if (positive_max_arg) { + array_push((array*)&s, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("at most "), /*100 &int*/0xfe07, {.d_i32 = fs->max_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + if (positive_min_arg && positive_max_arg && fs->min_free_args == fs->max_free_args) { + s = new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){ str_intp(2, _MOV((StrIntpData[]){{_SLIT("exactly "), /*100 &int*/0xfe07, {.d_i32 = fs->min_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))})); + } + string sargs = Array_string_join(s, _SLIT(" and ")); + array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("The arguments should be "), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(" in number."), 0, { .d_c = 0 }}}))) })); + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); + } + } + if (fs->flags.len > 0) { + array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("Options:")) })); + for (int _t16 = 0; _t16 < fs->flags.len; ++_t16) { + flag__Flag f = ((flag__Flag*)fs->flags.data)[_t16]; + Array_string onames = __new_array_with_default(0, 0, sizeof(string), 0); + if (f.abbr != 0) { + array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*115 &string*/0xfe10, {.d_s = u8_ascii_str(f.abbr)}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + if ((f.name).len != 0) { + if (!string_contains(f.val_desc, _SLIT(""))) { + array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = f.val_desc}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } else { + array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); + } + } + string option_names = string__plus(_SLIT(" "), Array_string_join(onames, _SLIT(", "))); + string xspace = _SLIT(""); + if (option_names.len > _const_flag__space.len - 2) { + xspace = str_intp(2, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = _const_flag__space}}, {_SLIT0, 0, { .d_c = 0 }}})); + } else { + xspace = string_substr(_const_flag__space, option_names.len, (_const_flag__space).len); + } + string fdesc = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = option_names}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = xspace}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = f.usage}}, {_SLIT0, 0, { .d_c = 0 }}})); + array_push((array*)&use, _MOV((string[]){ string_clone(fdesc) })); + } + } + for (int _t21 = 0; _t21 < fs->footers.len; ++_t21) { + string footer = ((string*)fs->footers.data)[_t21]; + array_push((array*)&use, _MOV((string[]){ string_clone(footer) })); + } + string _t23 = string_replace(Array_string_join(use, _SLIT("\n")), _SLIT("- ,"), _SLIT(" ")); + return _t23; +} + +VV_LOCAL_SYMBOL _option_flag__Flag flag__FlagParser_find_existing_flag(flag__FlagParser* fs, string fname) { + for (int _t1 = 0; _t1 < fs->flags.len; ++_t1) { + flag__Flag f = ((flag__Flag*)fs->flags.data)[_t1]; + if (string__eq(f.name, fname)) { + _option_flag__Flag _t2; + opt_ok2(&(flag__Flag[]) { f }, (_option*)(&_t2), sizeof(flag__Flag)); + return _t2; + } + } + return (_option_flag__Flag){ .state=2, .err=_v_error(_SLIT("no such flag")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +VV_LOCAL_SYMBOL void flag__FlagParser_handle_builtin_options(flag__FlagParser* fs) { + bool show_version = false; + bool show_help = false; + _option_flag__Flag _t1 = flag__FlagParser_find_existing_flag(fs, _SLIT("help")); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + show_help = flag__FlagParser_bool(fs, _SLIT("help"), 'h', false, fs->default_help_label); + } + + (*(flag__Flag*)_t1.data); + _option_flag__Flag _t2 = flag__FlagParser_find_existing_flag(fs, _SLIT("version")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + show_version = flag__FlagParser_bool(fs, _SLIT("version"), 0, false, fs->default_version_label); + } + + (*(flag__Flag*)_t2.data); + if (show_help) { + println(flag__FlagParser_usage(fs)); + _v_exit(0); + VUNREACHABLE(); + } + if (show_version) { + println( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fs->application_version}}, {_SLIT0, 0, { .d_c = 0 }}}))); + _v_exit(0); + VUNREACHABLE(); + } +} + +_option_Array_string flag__FlagParser_finalize(flag__FlagParser* fs) { + flag__FlagParser_handle_builtin_options(fs); + Array_string remaining = array_clone_to_depth(&fs->args, 0); + if (!fs->allow_unknown_args) { + for (int _t1 = 0; _t1 < remaining.len; ++_t1) { + string a = ((string*)remaining.data)[_t1]; + if ((a.len >= 2 && string__eq(string_substr(a, 0, 2), _SLIT("--"))) || (a.len == 2 && string_at(a, 0) == '-')) { + return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__UnkownFlagError_to_Interface_IError(((flag__UnkownFlagError*)memdup(&(flag__UnkownFlagError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.flag = a,}, sizeof(flag__UnkownFlagError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + } + } + if (remaining.len < fs->min_free_args && fs->min_free_args > 0) { + return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = fs->min_free_args,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (remaining.len > fs->max_free_args && fs->max_free_args > 0) { + return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = fs->max_free_args,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (remaining.len > 0 && fs->max_free_args == 0 && fs->min_free_args == 0) { + return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = 0,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _PUSH_MANY(&remaining, (fs->all_after_dashdash), _t6, Array_string); + _option_Array_string _t7; + opt_ok2(&(Array_string[]) { remaining }, (_option*)(&_t7), sizeof(Array_string)); + return _t7; +} + +Array_string flag__FlagParser_remaining_parameters(flag__FlagParser* fs) { + _option_Array_string _t2 = flag__FlagParser_finalize(fs); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + eprintln(IError_name_table[err._typ]._method_msg(err._object)); + println(flag__FlagParser_usage(fs)); + _v_exit(1); + VUNREACHABLE(); + ; + } + + Array_string _t1 = (*(Array_string*)_t2.data); + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL bool semver__version_satisfies(semver__Version ver, string input) { + _option_semver__Range _t1 = semver__parse_range(input); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + bool _t2 = false; + return _t2; + } + + semver__Range range = (*(semver__Range*)_t1.data); + bool _t3 = semver__Range_satisfies(range, ver); + return _t3; +} + +VV_LOCAL_SYMBOL bool semver__compare_eq(semver__Version v1, semver__Version v2) { + bool _t1 = v1.major == v2.major && v1.minor == v2.minor && v1.patch == v2.patch && string__eq(v1.prerelease, v2.prerelease); + return _t1; +} + +VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2) { + if (v1.major < v2.major) { + bool _t1 = false; + return _t1; + } + if (v1.major > v2.major) { + bool _t2 = true; + return _t2; + } + if (v1.minor < v2.minor) { + bool _t3 = false; + return _t3; + } + if (v1.minor > v2.minor) { + bool _t4 = true; + return _t4; + } + bool _t5 = v1.patch > v2.patch; + return _t5; +} + +VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2) { + if (v1.major > v2.major) { + bool _t1 = false; + return _t1; + } + if (v1.major < v2.major) { + bool _t2 = true; + return _t2; + } + if (v1.minor > v2.minor) { + bool _t3 = false; + return _t3; + } + if (v1.minor < v2.minor) { + bool _t4 = true; + return _t4; + } + bool _t5 = v1.patch < v2.patch; + return _t5; +} + +VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2) { + if (semver__compare_eq(v1, v2)) { + bool _t1 = true; + return _t1; + } + bool _t2 = semver__compare_gt(v1, v2); + return _t2; +} + +VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2) { + if (semver__compare_eq(v1, v2)) { + bool _t1 = true; + return _t1; + } + bool _t2 = semver__compare_lt(v1, v2); + return _t2; +} + +VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input) { + string raw_version = input; + string prerelease = _SLIT(""); + string metadata = _SLIT(""); + _option_int _t1 = string_last_index(raw_version, _SLIT("+")); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + *(int*) _t1.data = -1; + } + + int plus_idx = (*(int*)_t1.data); + if (plus_idx > 0) { + metadata = string_substr(raw_version, (plus_idx + 1), (raw_version).len); + raw_version = string_substr(raw_version, 0, plus_idx); + } + _option_int _t2 = string_index(raw_version, _SLIT("-")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(int*) _t2.data = -1; + } + + int hyphen_idx = (*(int*)_t2.data); + if (hyphen_idx > 0) { + prerelease = string_substr(raw_version, (hyphen_idx + 1), (raw_version).len); + raw_version = string_substr(raw_version, 0, hyphen_idx); + } + Array_string raw_ints = string_split(raw_version, _SLIT(".")); + semver__RawVersion _t3 = ((semver__RawVersion){.prerelease = prerelease,.metadata = metadata,.raw_ints = raw_ints,}); + return _t3; +} + +VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver) { + if (ver.raw_ints.len != 3) { + bool _t1 = false; + return _t1; + } + bool _t2 = semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_major))) && semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_minor))) && semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_patch))) && semver__is_valid_string(ver.prerelease) && semver__is_valid_string(ver.metadata); + return _t2; +} + +VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ) { + bool _t1 = typ >= ver.raw_ints.len - 1; + return _t1; +} + +VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVersion raw_ver) { + semver__RawVersion ver = semver__RawVersion_complete(raw_ver); + if (!semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_major)))) { + return (_option_semver__Version){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid major version: "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(ver.raw_ints)}}, {_SLIT("[ver_major]"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_semver__Version _t2; + opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(ver) }, (_option*)(&_t2), sizeof(semver__Version)); + return _t2; +} + +VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver) { + Array_string raw_ints = raw_ver.raw_ints; + for (;;) { + if (!(raw_ints.len < 3)) break; + array_push((array*)&raw_ints, _MOV((string[]){ string_clone(_SLIT("0")) })); + } + semver__RawVersion _t2 = ((semver__RawVersion){.prerelease = raw_ver.prerelease,.metadata = raw_ver.metadata,.raw_ints = raw_ints,}); + return _t2; +} + +VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver) { + if (!semver__RawVersion_is_valid(raw_ver)) { + return (_option_semver__Version){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_semver__Version _t2; + opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(raw_ver) }, (_option*)(&_t2), sizeof(semver__Version)); + return _t2; +} + +VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver) { + semver__Version _t1 = ((semver__Version){.major = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_major))),.minor = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_minor))),.patch = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_patch))),.prerelease = raw_ver.prerelease,.metadata = raw_ver.metadata,}); + return _t1; +} + +VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver) { + bool final_result = false; + for (int _t1 = 0; _t1 < r.comparator_sets.len; ++_t1) { + semver__ComparatorSet set = ((semver__ComparatorSet*)r.comparator_sets.data)[_t1]; + final_result = final_result || semver__ComparatorSet_satisfies(set, ver); + } + bool _t2 = final_result; + return _t2; +} + +VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver) { + for (int _t1 = 0; _t1 < set.comparators.len; ++_t1) { + semver__Comparator comp = ((semver__Comparator*)set.comparators.data)[_t1]; + if (!semver__Comparator_satisfies(comp, ver)) { + bool _t2 = false; + return _t2; + } + } + bool _t3 = true; + return _t3; +} + +VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver) { + if (c.op == semver__Operator__gt) { + bool _t1 = semver__Version_gt(ver, c.ver); + return _t1; + } + if (c.op == semver__Operator__lt) { + bool _t2 = semver__Version_lt(ver, c.ver); + return _t2; + } + if (c.op == semver__Operator__ge) { + bool _t3 = semver__Version_ge(ver, c.ver); + return _t3; + } + if (c.op == semver__Operator__le) { + bool _t4 = semver__Version_le(ver, c.ver); + return _t4; + } + if (c.op == semver__Operator__eq) { + bool _t5 = semver__Version_eq(ver, c.ver); + return _t5; + } + bool _t6 = false; + return _t6; +} + +VV_LOCAL_SYMBOL _option_semver__Range semver__parse_range(string input) { + Array_string raw_comparator_sets = string_split(input, _const_semver__comparator_set_sep); + Array_semver__ComparatorSet comparator_sets = __new_array_with_default(0, 0, sizeof(semver__ComparatorSet), 0); + for (int _t1 = 0; _t1 < raw_comparator_sets.len; ++_t1) { + string raw_comp_set = ((string*)raw_comparator_sets.data)[_t1]; + if (semver__can_expand(raw_comp_set)) { + _option_semver__ComparatorSet _t2 = semver__expand_comparator_set(raw_comp_set); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (_option_semver__Range){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__ComparatorSet s = (*(semver__ComparatorSet*)_t2.data); + array_push((array*)&comparator_sets, _MOV((semver__ComparatorSet[]){ s })); + } else { + _option_semver__ComparatorSet _t5 = semver__parse_comparator_set(raw_comp_set); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; + return (_option_semver__Range){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__ComparatorSet s = (*(semver__ComparatorSet*)_t5.data); + array_push((array*)&comparator_sets, _MOV((semver__ComparatorSet[]){ s })); + } + } + _option_semver__Range _t8; + opt_ok2(&(semver__Range[]) { ((semver__Range){.comparator_sets = comparator_sets,}) }, (_option*)(&_t8), sizeof(semver__Range)); + return _t8; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__parse_comparator_set(string input) { + Array_string raw_comparators = string_split(input, _const_semver__comparator_sep); + if (raw_comparators.len > 2) { + return (_option_semver__ComparatorSet){ .state=2, .err=/*&IError*/I_semver__InvalidComparatorFormatError_to_Interface_IError(((semver__InvalidComparatorFormatError*)memdup(&(semver__InvalidComparatorFormatError){.MessageError = ((MessageError){.msg = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid format of comparator set for input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}})),.code = 0,}),}, sizeof(semver__InvalidComparatorFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Array_semver__Comparator comparators = __new_array_with_default(0, 0, sizeof(semver__Comparator), 0); + for (int _t2 = 0; _t2 < raw_comparators.len; ++_t2) { + string raw_comp = ((string*)raw_comparators.data)[_t2]; + _option_semver__Comparator _t3 = semver__parse_comparator(raw_comp); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + return (_option_semver__ComparatorSet){ .state=2, .err=/*&IError*/I_semver__InvalidComparatorFormatError_to_Interface_IError(((semver__InvalidComparatorFormatError*)memdup(&(semver__InvalidComparatorFormatError){.MessageError = ((MessageError){.msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Invalid comparator \""), /*115 &string*/0xfe10, {.d_s = raw_comp}}, {_SLIT("\" in input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}})),.code = 0,}),}, sizeof(semver__InvalidComparatorFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Comparator c = (*(semver__Comparator*)_t3.data); + array_push((array*)&comparators, _MOV((semver__Comparator[]){ c })); + } + _option_semver__ComparatorSet _t6; + opt_ok2(&(semver__ComparatorSet[]) { ((semver__ComparatorSet){.comparators = comparators,}) }, (_option*)(&_t6), sizeof(semver__ComparatorSet)); + return _t6; +} + +VV_LOCAL_SYMBOL _option_semver__Comparator semver__parse_comparator(string input) { + semver__Operator op = semver__Operator__eq; + string raw_version = _SLIT(""); + if (string_starts_with(input, _SLIT(">="))) { + op = semver__Operator__ge; + raw_version = string_substr(input, 2, (input).len); + } else if (string_starts_with(input, _SLIT("<="))) { + op = semver__Operator__le; + raw_version = string_substr(input, 2, (input).len); + } else if (string_starts_with(input, _SLIT(">"))) { + op = semver__Operator__gt; + raw_version = string_substr(input, 1, (input).len); + } else if (string_starts_with(input, _SLIT("<"))) { + op = semver__Operator__lt; + raw_version = string_substr(input, 1, (input).len); + } else if (string_starts_with(input, _SLIT("="))) { + raw_version = string_substr(input, 1, (input).len); + } else { + raw_version = input; + } + _option_semver__Version _t1 = semver__coerce_version(raw_version); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_semver__Comparator){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version version = (*(semver__Version*)_t1.data); + _option_semver__Comparator _t3; + opt_ok2(&(semver__Comparator[]) { ((semver__Comparator){.ver = version,.op = op,}) }, (_option*)(&_t3), sizeof(semver__Comparator)); + return _t3; +} + +VV_LOCAL_SYMBOL _option_semver__Version semver__parse_xrange(string input) { + semver__RawVersion raw_ver = semver__RawVersion_complete(semver__parse(input)); + for (int _t1 = 0; _t1 < _const_semver__versions.len; ++_t1) { + int typ = ((int*)_const_semver__versions.data)[_t1]; + if (string_index_any((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, typ)), _const_semver__x_range_symbols) == -1) { + continue; + } + + if (typ == (_const_semver__ver_major)) { + array_set(&raw_ver.raw_ints, _const_semver__ver_major, &(string[]) { _SLIT("0") }); + array_set(&raw_ver.raw_ints, _const_semver__ver_minor, &(string[]) { _SLIT("0") }); + array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); + } + else if (typ == (_const_semver__ver_minor)) { + array_set(&raw_ver.raw_ints, _const_semver__ver_minor, &(string[]) { _SLIT("0") }); + array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); + } + else if (typ == (_const_semver__ver_patch)) { + array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); + } + else { + }; + } + if (!semver__RawVersion_is_valid(raw_ver)) { + return (_option_semver__Version){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_semver__Version _t3; + opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(raw_ver) }, (_option*)(&_t3), sizeof(semver__Version)); + return _t3; +} + +VV_LOCAL_SYMBOL bool semver__can_expand(string input) { + bool _t1 = string_at(input, 0) == '~' || string_at(input, 0) == '^' || string_contains(input, _const_semver__hyphen_range_sep) || string_index_any(input, _const_semver__x_range_symbols) > -1; + return _t1; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_comparator_set(string input) { + u8 _t1 = string_at(input, 0); + + if (_t1 == ('~')) { + _option_semver__ComparatorSet _t2 = semver__expand_tilda(string_substr(input, 1, (input).len)); + return _t2; + } + else if (_t1 == ('^')) { + _option_semver__ComparatorSet _t3 = semver__expand_caret(string_substr(input, 1, (input).len)); + return _t3; + } + else { + }; + if (string_contains(input, _const_semver__hyphen_range_sep)) { + _option_semver__ComparatorSet _t4 = semver__expand_hyphen(input); + return _t4; + } + _option_semver__ComparatorSet _t5 = semver__expand_xrange(input); + return _t5; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_tilda(string raw_version) { + _option_semver__Version _t1 = semver__coerce_version(raw_version); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version min_ver = (*(semver__Version*)_t1.data); + semver__Version max_ver = min_ver; + if (min_ver.minor == 0 && min_ver.patch == 0) { + max_ver = semver__Version_increment(min_ver, semver__Increment__major); + } else { + max_ver = semver__Version_increment(min_ver, semver__Increment__minor); + } + _option_semver__ComparatorSet _t3; + opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); + return _t3; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_caret(string raw_version) { + _option_semver__Version _t1 = semver__coerce_version(raw_version); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version min_ver = (*(semver__Version*)_t1.data); + semver__Version max_ver = min_ver; + if (min_ver.major == 0) { + max_ver = semver__Version_increment(min_ver, semver__Increment__minor); + } else { + max_ver = semver__Version_increment(min_ver, semver__Increment__major); + } + _option_semver__ComparatorSet _t3; + opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); + return _t3; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_hyphen(string raw_range) { + Array_string raw_versions = string_split(raw_range, _const_semver__hyphen_range_sep); + if (raw_versions.len != 2) { + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_semver__Version _t2 = semver__coerce_version((*(string*)/*ee elem_sym */array_get(raw_versions, 0))); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version min_ver = (*(semver__Version*)_t2.data); + semver__RawVersion raw_max_ver = semver__parse((*(string*)/*ee elem_sym */array_get(raw_versions, 1))); + if (semver__RawVersion_is_missing(raw_max_ver, _const_semver__ver_major)) { + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_semver__Version _t5 = semver__RawVersion_coerce(raw_max_ver); + if (_t5.state != 0) { /*or block*/ + IError err = _t5.err; + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version max_ver = (*(semver__Version*)_t5.data); + if (semver__RawVersion_is_missing(raw_max_ver, _const_semver__ver_minor)) { + max_ver = semver__Version_increment(max_ver, semver__Increment__minor); + _option_semver__ComparatorSet _t7; + opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t7), sizeof(semver__ComparatorSet)); + return _t7; + } + _option_semver__ComparatorSet _t8; + opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_le(min_ver, max_ver) }, (_option*)(&_t8), sizeof(semver__ComparatorSet)); + return _t8; +} + +VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_xrange(string raw_range) { + _option_semver__Version _t1 = semver__parse_xrange(raw_range); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version min_ver = (*(semver__Version*)_t1.data); + if (min_ver.major == 0) { + Array_semver__Comparator comparators = new_array_from_c_array(1, 1, sizeof(semver__Comparator), _MOV((semver__Comparator[1]){((semver__Comparator){.ver = min_ver,.op = semver__Operator__ge,})})); + _option_semver__ComparatorSet _t3; + opt_ok2(&(semver__ComparatorSet[]) { ((semver__ComparatorSet){.comparators = comparators,}) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); + return _t3; + } + semver__Version max_ver = min_ver; + if (min_ver.minor == 0) { + max_ver = semver__Version_increment(min_ver, semver__Increment__major); + } else { + max_ver = semver__Version_increment(min_ver, semver__Increment__minor); + } + _option_semver__ComparatorSet _t4; + opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t4), sizeof(semver__ComparatorSet)); + return _t4; +} + +VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_lt(semver__Version min, semver__Version max) { + Array_semver__Comparator comparators = new_array_from_c_array(2, 2, sizeof(semver__Comparator), _MOV((semver__Comparator[2]){((semver__Comparator){.ver = min,.op = semver__Operator__ge,}), ((semver__Comparator){.ver = max,.op = semver__Operator__lt,})})); + semver__ComparatorSet _t1 = ((semver__ComparatorSet){.comparators = comparators,}); + return _t1; +} + +VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_le(semver__Version min, semver__Version max) { + Array_semver__Comparator comparators = new_array_from_c_array(2, 2, sizeof(semver__Comparator), _MOV((semver__Comparator[2]){((semver__Comparator){.ver = min,.op = semver__Operator__ge,}), ((semver__Comparator){.ver = max,.op = semver__Operator__le,})})); + semver__ComparatorSet _t1 = ((semver__ComparatorSet){.comparators = comparators,}); + return _t1; +} + +string semver__EmptyInputError_msg(semver__EmptyInputError err) { + string _t1 = _SLIT("Empty input"); + return _t1; +} + +string semver__InvalidVersionFormatError_msg(semver__InvalidVersionFormatError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid version format for input \""), /*115 &string*/0xfe10, {.d_s = err.input}}, {_SLIT("\""), 0, { .d_c = 0 }}})); + return _t1; +} + +_option_semver__Version semver__from(string input) { + if (input.len == 0) { + return (_option_semver__Version){ .state=2, .err=/*&IError*/I_semver__EmptyInputError_to_Interface_IError(((semver__EmptyInputError*)memdup(&(semver__EmptyInputError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(semver__EmptyInputError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + semver__RawVersion raw_version = semver__parse(input); + _option_semver__Version _t2 = semver__RawVersion_validate(raw_version); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (_option_semver__Version){ .state=2, .err=/*&IError*/I_semver__InvalidVersionFormatError_to_Interface_IError(((semver__InvalidVersionFormatError*)memdup(&(semver__InvalidVersionFormatError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.input = input,}, sizeof(semver__InvalidVersionFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version version = (*(semver__Version*)_t2.data); + _option_semver__Version _t4; + opt_ok2(&(semver__Version[]) { version }, (_option*)(&_t4), sizeof(semver__Version)); + return _t4; +} + +semver__Version semver__build(int major, int minor, int patch) { + semver__Version _t1 = ((semver__Version){.major = major,.minor = minor,.patch = patch,.prerelease = _SLIT(""),.metadata = _SLIT(""),}); + return _t1; +} + +semver__Version semver__Version_increment(semver__Version ver, semver__Increment typ) { + semver__Version _t1 = semver__increment_version(ver, typ); + return _t1; +} + +bool semver__Version_satisfies(semver__Version ver, string input) { + bool _t1 = semver__version_satisfies(ver, input); + return _t1; +} + +bool semver__Version_eq(semver__Version v1, semver__Version v2) { + bool _t1 = semver__compare_eq(v1, v2); + return _t1; +} + +bool semver__Version_gt(semver__Version v1, semver__Version v2) { + bool _t1 = semver__compare_gt(v1, v2); + return _t1; +} + +bool semver__Version_lt(semver__Version v1, semver__Version v2) { + bool _t1 = semver__compare_lt(v1, v2); + return _t1; +} + +bool semver__Version_ge(semver__Version v1, semver__Version v2) { + bool _t1 = semver__compare_ge(v1, v2); + return _t1; +} + +bool semver__Version_le(semver__Version v1, semver__Version v2) { + bool _t1 = semver__compare_le(v1, v2); + return _t1; +} + +string semver__Version_str(semver__Version ver) { + string common_string = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = ver.major}}, {_SLIT("."), /*100 &int*/0xfe07, {.d_i32 = ver.minor}}, {_SLIT("."), /*100 &int*/0xfe07, {.d_i32 = ver.patch}}, {_SLIT0, 0, { .d_c = 0 }}})); + string prerelease_string = (ver.prerelease.len > 0 ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*115 &string*/0xfe10, {.d_s = ver.prerelease}}, {_SLIT0, 0, { .d_c = 0 }}}))) : (_SLIT(""))); + string metadata_string = (ver.metadata.len > 0 ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*115 &string*/0xfe10, {.d_s = ver.metadata}}, {_SLIT0, 0, { .d_c = 0 }}}))) : (_SLIT(""))); + string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = common_string}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prerelease_string}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = metadata_string}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +_option_semver__Version semver__coerce(string input) { + _option_semver__Version _t1 = semver__coerce_version(input); + return _t1; +} + +bool semver__is_valid(string input) { + bool _t1 = semver__is_version_valid(input); + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL bool semver__is_version_valid(string input) { + semver__RawVersion raw_ver = semver__parse(input); + bool _t1 = semver__RawVersion_is_valid(raw_ver); + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input) { + semver__RawVersion raw_ver = semver__parse(input); + _option_semver__Version _t1 = semver__RawVersion_coerce(raw_ver); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + return (_option_semver__Version){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid version for input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + semver__Version ver = (*(semver__Version*)_t1.data); + _option_semver__Version _t3; + opt_ok2(&(semver__Version[]) { ver }, (_option*)(&_t3), sizeof(semver__Version)); + return _t3; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ) { + int major = ver.major; + int minor = ver.minor; + int patch = ver.patch; + + if (typ == (semver__Increment__major)) { + major++; + minor = 0; + patch = 0; + } + else if (typ == (semver__Increment__minor)) { + minor++; + patch = 0; + } + else if (typ == (semver__Increment__patch)) { + patch++; + }; + semver__Version _t1 = ((semver__Version){.major = major,.minor = minor,.patch = patch,.prerelease = ver.prerelease,.metadata = ver.metadata,}); + return _t1; +} + +VV_LOCAL_SYMBOL bool semver__is_valid_string(string input) { + for (int _t1 = 0; _t1 < input.len; ++_t1) { + u8 c = input.str[_t1]; + if (!(u8_is_letter(c) || u8_is_digit(c) || c == '.' || c == '-')) { + bool _t2 = false; + return _t2; + } + } + bool _t3 = true; + return _t3; +} + +VV_LOCAL_SYMBOL bool semver__is_valid_number(string input) { + for (int _t1 = 0; _t1 < input.len; ++_t1) { + u8 c = input.str[_t1]; + if (!u8_is_digit(c)) { + bool _t2 = false; + return _t2; + } + } + bool _t3 = true; + return _t3; +} + +#if defined(_WIN32) +#else +#endif +#if defined(__linux__) + #if defined(__TINYC__) + #if defined(__V_amd64) +#elif defined(__V_arm64) +#endif +#endif +#endif +bool sync__stdatomic__add_u64(u64* ptr, int delta) { + u64 res = atomic_fetch_add_u64(((voidptr)(ptr)), delta); + bool _t1 = res == 0U; + return _t1; +} + +bool sync__stdatomic__sub_u64(u64* ptr, int delta) { + u64 res = atomic_fetch_sub_u64(((voidptr)(ptr)), delta); + bool _t1 = res == 0U; + return _t1; +} + +bool sync__stdatomic__add_i64(i64* ptr, int delta) { + u64 res = atomic_fetch_add_u64(((voidptr)(ptr)), delta); + bool _t1 = res == 0U; + return _t1; +} + +bool sync__stdatomic__sub_i64(i64* ptr, int delta) { + u64 res = atomic_fetch_sub_u64(((voidptr)(ptr)), delta); + bool _t1 = res == 0U; + return _t1; +} + +void sync__stdatomic__store_u64(u64* ptr, u64 val) { + atomic_store_u64(((voidptr)(ptr)), val); +} + +u64 sync__stdatomic__load_u64(u64* ptr) { + u64 _t1 = atomic_load_u64(((voidptr)(ptr))); + return _t1; +} + +void sync__stdatomic__store_i64(i64* ptr, i64 val) { + atomic_store_u64(((voidptr)(ptr)), val); +} + +i64 sync__stdatomic__load_i64(i64* ptr) { + i64 _t1 = ((i64)(atomic_load_u64(((voidptr)(ptr))))); + return _t1; +} + +#if !defined(_WIN32) && !defined(__ANDROID__) +#endif Array_string os__args_after(string cut_word) { if (_const_os__args.len == 0) { Array_string _t1 = __new_array_with_default(0, 0, sizeof(string), 0); @@ -23710,7 +27998,8 @@ VV_LOCAL_SYMBOL char** os__unix_environ(void) { } Map_string_string os__environ(void) { - Map_string_string res = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_string res = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; #if defined(_WIN32) { u16* estrings = GetEnvironmentStringsW(); @@ -23888,7 +28177,7 @@ _option_os__File os__open(string path) { _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("rb")); if (_t1.state != 0) { /*or block*/ _option_os__File _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -23903,7 +28192,7 @@ _option_os__File os__create(string path) { _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("wb")); if (_t1.state != 0) { /*or block*/ _option_os__File _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -23938,7 +28227,7 @@ _option_int os__File_read(os__File* f, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -23982,7 +28271,7 @@ _option_int os__File_write_string(os__File* f, string s) { _option_void _t1 = os__File_write_full_buffer(f, s.str, ((usize)(s.len))); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_int _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -24194,7 +28483,7 @@ _option_int os__File_read_bytes_into(os__File* f, u64 pos, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -24214,7 +28503,7 @@ _option_int os__File_read_bytes_into(os__File* f, u64 pos, Array_u8* buf) { _option_int _t5 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t5.state != 0) { /*or block*/ _option_int _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -24237,7 +28526,7 @@ _option_int os__File_read_bytes_into(os__File* f, u64 pos, Array_u8* buf) { _option_int _t8 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t8.state != 0) { /*or block*/ _option_int _t9; - memcpy(&_t9, &_t8, sizeof(Option)); + memcpy(&_t9, &_t8, sizeof(_option)); return _t9; } @@ -24275,7 +28564,7 @@ _option_int os__File_read_from(os__File* f, u64 pos, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -24291,7 +28580,7 @@ _option_int os__File_read_from(os__File* f, u64 pos, Array_u8* buf) { _option_int _t5 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t5.state != 0) { /*or block*/ _option_int _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -24386,7 +28675,7 @@ bool os__is_abs_path(string path) { } #if defined(_WIN32) { - bool _t2 = os__is_device_path(path) || os__is_drive_rooted(path) || os__is_normal_path(path); + bool _t2 = os__is_unc_path(path) || os__is_drive_rooted(path) || os__is_normal_path(path); return _t2; } #endif @@ -24394,6 +28683,141 @@ bool os__is_abs_path(string path) { return _t3; } +string os__abs_path(string path) { + string wd = os__getwd(); + if (path.len == 0) { + string _t1 = wd; + return _t1; + } + string npath = os__norm_path(path); + if (string__eq(npath, _const_os__dot_str)) { + string _t2 = wd; + return _t2; + } + if (!os__is_abs_path(npath)) { + strings__Builder sb = strings__new_builder(npath.len); + strings__Builder_write_string(&sb, wd); + strings__Builder_write_string(&sb, _const_os__path_separator); + strings__Builder_write_string(&sb, npath); + string _t3 = os__norm_path(strings__Builder_str(&sb)); + return _t3; + } + string _t4 = npath; + return _t4; +} + +// Attr: [direct_array_access] +string os__norm_path(string path) { + if (path.len == 0) { + string _t1 = _const_os__dot_str; + return _t1; + } + bool rooted = os__is_abs_path(path); + string volume = os__get_volume(path); + int volume_len = volume.len; + string cpath = os__clean_path(string_substr(path, volume_len, (path).len)); + if (cpath.len == 0 && volume_len == 0) { + string _t2 = _const_os__dot_str; + return _t2; + } + Array_string spath = string_split(cpath, _const_os__path_separator); + if (!Array_string_contains(spath, _const_os__dot_dot)) { + string _t3 = (volume_len != 0 ? (string__plus(volume, cpath)) : (cpath)); + return _t3; + } + int spath_len = spath.len; + strings__Builder sb = strings__new_builder(cpath.len); + if (rooted) { + strings__Builder_write_string(&sb, _const_os__path_separator); + } + Array_string new_path = __new_array_with_default(0, spath_len, sizeof(string), 0); + int backlink_count = 0; + for (int i = spath_len - 1; i >= 0; i--) { + string part = ((string*)spath.data)[i]; + if (string__eq(part, _const_os__empty_str)) { + continue; + } + if (string__eq(part, _const_os__dot_dot)) { + backlink_count++; + continue; + } + if (backlink_count != 0) { + backlink_count--; + continue; + } + array_prepend(&new_path, &(string[]){part}); + } + if (backlink_count != 0 && !rooted) { + for (int i = 0; i < backlink_count; ++i) { + strings__Builder_write_string(&sb, _const_os__dot_dot); + if (new_path.len == 0 && i == backlink_count - 1) { + break; + } + strings__Builder_write_string(&sb, _const_os__path_separator); + } + } + strings__Builder_write_string(&sb, Array_string_join(new_path, _const_os__path_separator)); + string res = strings__Builder_str(&sb); + if (res.len == 0) { + if (volume_len != 0) { + string _t4 = volume; + return _t4; + } + if (!rooted) { + string _t5 = _const_os__dot_str; + return _t5; + } + string _t6 = _const_os__path_separator; + return _t6; + } + if (volume_len != 0) { + string _t7 = string__plus(volume, res); + return _t7; + } + string _t8 = res; + return _t8; +} + +VV_LOCAL_SYMBOL string os__clean_path(string path) { + if (path.len == 0) { + string _t1 = _const_os__empty_str; + return _t1; + } + strings__Builder sb = strings__new_builder(path.len); + strings__textscanner__TextScanner sc = strings__textscanner__new(path); + for (;;) { + if (!(strings__textscanner__TextScanner_next(&sc) != -1)) break; + u8 curr = ((u8)(strings__textscanner__TextScanner_current(&sc))); + int back = strings__textscanner__TextScanner_peek_back(&sc); + int peek = strings__textscanner__TextScanner_peek(&sc); + if (back != -1 && os__is_slash(((u8)(back))) && os__is_slash(curr)) { + continue; + } + if ((back == -1 || os__is_slash(((u8)(back)))) && curr == _const_os__dot && (peek == -1 || os__is_slash(((u8)(peek))))) { + if (peek != -1 && os__is_slash(((u8)(peek)))) { + strings__textscanner__TextScanner_skip_n(&sc, 1); + } + continue; + } + #if defined(_WIN32) + { + if (curr == _const_os__fslash) { + strings__Builder_write_u8(&sb, _const_os__bslash); + continue; + } + } + #endif + strings__Builder_write_u8(&sb, ((u8)(strings__textscanner__TextScanner_current(&sc)))); + } + string res = strings__Builder_str(&sb); + if (res.len > 1 && os__is_slash(string_at(res, res.len - 1))) { + string _t2 = string_substr(res, 0, res.len - 1); + return _t2; + } + string _t3 = res; + return _t3; +} + VV_LOCAL_SYMBOL int os__win_volume_len(string path) { int plen = path.len; if (plen < 2) { @@ -24404,7 +28828,7 @@ VV_LOCAL_SYMBOL int os__win_volume_len(string path) { int _t2 = 2; return _t2; } - if (path.len >= 5 && os__starts_w_slash_slash(path) && !os__is_slash(string_at(path, 2))) { + if (plen >= 5 && os__starts_w_slash_slash(path) && !os__is_slash(string_at(path, 2))) { for (int i = 3; i < plen; i++) { if (os__is_slash(string_at(path, i))) { if (i + 1 >= plen || os__is_slash(string_at(path, i + 1))) { @@ -24426,6 +28850,26 @@ VV_LOCAL_SYMBOL int os__win_volume_len(string path) { return _t5; } +VV_LOCAL_SYMBOL string os__get_volume(string path) { + #if !defined(_WIN32) + { + string _t1 = _const_os__empty_str; + return _t1; + } + #endif + string volume = string_substr(path, 0, os__win_volume_len(path)); + if (volume.len == 0) { + string _t2 = _const_os__empty_str; + return _t2; + } + if (string_at(volume, 0) == _const_os__fslash) { + string _t3 = string_replace(volume, _SLIT("/"), _SLIT("\\")); + return _t3; + } + string _t4 = volume; + return _t4; +} + VV_LOCAL_SYMBOL bool os__is_slash(u8 b) { #if defined(_WIN32) { @@ -24437,7 +28881,7 @@ VV_LOCAL_SYMBOL bool os__is_slash(u8 b) { return _t2; } -VV_LOCAL_SYMBOL bool os__is_device_path(string path) { +VV_LOCAL_SYMBOL bool os__is_unc_path(string path) { bool _t1 = os__win_volume_len(path) >= 5 && os__starts_w_slash_slash(path); return _t1; } @@ -24530,7 +28974,7 @@ FILE* fp; _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("rb")); if (_t1.state != 0) { /*or block*/ _option_Array_u8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -24596,7 +29040,7 @@ FILE* fp; _option_FILE_ptr _t1 = os__vfopen(path, mode); if (_t1.state != 0) { /*or block*/ _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26143,7 +30587,7 @@ _option_void os__write_file_array(string path, array buffer) { _option_os__File _t1 = os__create(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26151,7 +30595,7 @@ _option_void os__write_file_array(string path, array buffer) { _option_void _t3 = os__File_write_full_buffer(&f, buffer.data, ((usize)(buffer.len * buffer.element_size))); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -26167,7 +30611,7 @@ _option_Array_string os__glob(Array_string patterns) { _option_void _t2 = os__native_glob_pattern(pattern, &/*arr*/matches); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_Array_string _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26217,7 +30661,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_void _t2 = os__rm(adjusted_path); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_void _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26229,7 +30673,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_void _t5 = os__cp(source_path, adjusted_path); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -26240,7 +30684,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_bool _t7 = os__mkdir(dest_path); if (_t7.state != 0) { /*or block*/ _option_void _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -26252,7 +30696,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_Array_string _t10 = os__ls(source_path); if (_t10.state != 0) { /*or block*/ _option_void _t11; - memcpy(&_t11, &_t10, sizeof(Option)); + memcpy(&_t11, &_t10, sizeof(_option)); return _t11; } @@ -26266,7 +30710,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_bool _t13 = os__mkdir(dp); if (_t13.state != 0) { /*or block*/ _option_void _t14; - memcpy(&_t14, &_t13, sizeof(Option)); + memcpy(&_t14, &_t13, sizeof(_option)); return _t14; } @@ -26295,7 +30739,7 @@ _option_void os__mv_by_cp(string source, string target) { _option_void _t1 = os__cp(source, target); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26303,7 +30747,7 @@ _option_void os__mv_by_cp(string source, string target) { _option_void _t3 = os__rm(source); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -26316,7 +30760,7 @@ _option_Array_string os__read_lines(string path) { _option_string _t1 = os__read_file(path); if (_t1.state != 0) { /*or block*/ _option_Array_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26432,7 +30876,7 @@ _option_void os__rmdir_all(string path) { _option_Array_string _t1 = os__ls(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26740,7 +31184,7 @@ _option_Array_string os__user_names(void) { _option_Array_string _t3 = os__read_lines(_SLIT("/etc/passwd")); if (_t3.state != 0) { /*or block*/ _option_Array_string _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -26797,7 +31241,7 @@ _option_void os__write_file(string path, string text) { _option_os__File _t1 = os__create(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26805,7 +31249,7 @@ _option_void os__write_file(string path, string text) { _option_void _t3 = os__File_write_full_buffer(&f, text.str, ((usize)(text.len))); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -27723,7 +32167,7 @@ string tmp_perm_check; } // Defer end _option_bool _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -28324,3063 +32768,283 @@ _option_void os__open_uri(string uri) { } // TypeDecl -strings__textscanner__TextScanner strings__textscanner__new(string input) { - strings__textscanner__TextScanner _t1 = ((strings__textscanner__TextScanner){.input = input,.ilen = input.len,.pos = 0,}); +v__depgraph__OrderedDepMap v__depgraph__new_ordered_dependency_map(void) { + v__depgraph__OrderedDepMap res = ((v__depgraph__OrderedDepMap){.keys = __new_array(0, 0, sizeof(string)),.data = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}); + ArrayFlags_set(&res.keys.flags, ArrayFlags__noslices); + v__depgraph__OrderedDepMap _t1 = res; return _t1; } -// Attr: [unsafe] -void strings__textscanner__TextScanner_free(strings__textscanner__TextScanner* ss) { - string_free(&ss->input); -} - -// Attr: [inline] -inline int strings__textscanner__TextScanner_remaining(strings__textscanner__TextScanner* ss) { - int _t1 = ss->ilen - ss->pos; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_next(strings__textscanner__TextScanner* ss) { - if (ss->pos < ss->ilen) { - int opos = ss->pos; - ss->pos++; - int _t1 = ss->input.str[ opos]; - return _t1; +void v__depgraph__OrderedDepMap_set(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { + if (!_IN_MAP(ADDR(string, name), ADDR(map, o->data))) { + array_push((array*)&o->keys, _MOV((string[]){ string_clone(name) })); } - int _t2 = -1; - return _t2; + map_set(&o->data, &(string[]){name}, &(Array_string[]) { deps }); } -// Attr: [inline] -inline void strings__textscanner__TextScanner_skip(strings__textscanner__TextScanner* ss) { - if (ss->pos + 1 < ss->ilen) { - ss->pos++; - } -} - -// Attr: [inline] -inline void strings__textscanner__TextScanner_skip_n(strings__textscanner__TextScanner* ss, int n) { - ss->pos += n; - if (ss->pos > ss->ilen) { - ss->pos = ss->ilen; - } -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_peek(strings__textscanner__TextScanner* ss) { - if (ss->pos < ss->ilen) { - int _t1 = ss->input.str[ ss->pos]; - return _t1; - } - int _t2 = -1; - return _t2; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_peek_n(strings__textscanner__TextScanner* ss, int n) { - if (ss->pos + n < ss->ilen) { - int _t1 = ss->input.str[ ss->pos + n]; - return _t1; - } - int _t2 = -1; - return _t2; -} - -// Attr: [inline] -inline void strings__textscanner__TextScanner_back(strings__textscanner__TextScanner* ss) { - if (ss->pos > 0) { - ss->pos--; - } -} - -void strings__textscanner__TextScanner_back_n(strings__textscanner__TextScanner* ss, int n) { - ss->pos -= n; - if (ss->pos < 0) { - ss->pos = 0; - } - if (ss->pos > ss->ilen) { - ss->pos = ss->ilen; - } -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_peek_back(strings__textscanner__TextScanner* ss) { - int _t1 = strings__textscanner__TextScanner_peek_back_n(ss, 1); - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScanner* ss, int n) { - int offset = n + 1; - if (ss->pos >= offset) { - int _t1 = ss->input.str[ ss->pos - offset]; - return _t1; - } - int _t2 = -1; - return _t2; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss) { - if (ss->pos > 0) { - int _t1 = ss->input.str[ ss->pos - 1]; - return _t1; - } - int _t2 = -1; - return _t2; -} - -void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss) { - ss->pos = 0; -} - -void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss) { - ss->pos = ss->ilen; -} - -Array_string os__cmdline__options(Array_string args, string param) { - Array_string flags = __new_array_with_default(0, 0, sizeof(string), 0); - for (int i = 0; i < args.len; ++i) { - string v = ((string*)args.data)[i]; - if (string__eq(v, param)) { - if (i + 1 < args.len) { - array_push((array*)&flags, _MOV((string[]){ string_clone((*(string*)/*ee elem_sym */array_get(args, i + 1))) })); - } +void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { + Array_string d = v__depgraph__OrderedDepMap_get(o, name); + for (int _t1 = 0; _t1 < deps.len; ++_t1) { + string dep = ((string*)deps.data)[_t1]; + if (!Array_string_contains(d, dep)) { + array_push((array*)&d, _MOV((string[]){ string_clone(dep) })); + } else { } } - Array_string _t2 = flags; - return _t2; + v__depgraph__OrderedDepMap_set(o, name, d); } -string os__cmdline__option(Array_string args, string param, string def) { - bool found = false; - for (int _t1 = 0; _t1 < args.len; ++_t1) { - string arg = ((string*)args.data)[_t1]; - if (found) { - string _t2 = arg; - return _t2; - } else if (string__eq(param, arg)) { - found = true; - } +Array_string v__depgraph__OrderedDepMap_get(v__depgraph__OrderedDepMap* o, string name) { + Array_string* _t2 = (Array_string*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, o->data), &(string[]){name})); + _option_Array_string _t1 = {0}; + if (_t2) { + *((Array_string*)&_t1.data) = *((Array_string*)_t2); + } else { + _t1.state = 2; _t1.err = _v_error(_SLIT("array index out of range")); } - string _t3 = def; + ; + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + *(Array_string*) _t1.data = __new_array_with_default(0, 0, sizeof(string), 0); + } + + Array_string res = *(Array_string*)_t1.data; + Array_string _t3 = res; return _t3; } -Array_string os__cmdline__options_before(Array_string args, Array_string what) { - Array_string args_before = __new_array_with_default(0, 0, sizeof(string), 0); - for (int _t1 = 0; _t1 < args.len; ++_t1) { - string a = ((string*)args.data)[_t1]; - if (Array_string_contains(what, a)) { - break; - } - array_push((array*)&args_before, _MOV((string[]){ string_clone(a) })); - } - Array_string _t3 = args_before; - return _t3; -} - -Array_string os__cmdline__options_after(Array_string args, Array_string what) { - bool found = false; - Array_string args_after = __new_array_with_default(0, 0, sizeof(string), 0); - for (int _t1 = 0; _t1 < args.len; ++_t1) { - string a = ((string*)args.data)[_t1]; - if (Array_string_contains(what, a)) { - found = true; - continue; - } - if (found) { - array_push((array*)&args_after, _MOV((string[]){ string_clone(a) })); - } - } - Array_string _t3 = args_after; - return _t3; -} - -Array_string os__cmdline__only_non_options(Array_string args) { - Array_string _t2 = {0}; - Array_string _t2_orig = args; - int _t2_len = _t2_orig.len; - _t2 = __new_array(0, _t2_len, sizeof(string)); - - for (int _t3 = 0; _t3 < _t2_len; ++_t3) { - string it = ((string*) _t2_orig.data)[_t3]; - if (!string_starts_with(it, _SLIT("-"))) { - array_push((array*)&_t2, &it); - } - } - Array_string _t1 =_t2; - return _t1; -} - -Array_string os__cmdline__only_options(Array_string args) { - Array_string _t2 = {0}; - Array_string _t2_orig = args; - int _t2_len = _t2_orig.len; - _t2 = __new_array(0, _t2_len, sizeof(string)); - - for (int _t3 = 0; _t3 < _t2_len; ++_t3) { - string it = ((string*) _t2_orig.data)[_t3]; - if (string_starts_with(it, _SLIT("-"))) { - array_push((array*)&_t2, &it); - } - } - Array_string _t1 =_t2; - return _t1; -} - -v__token__KeywordsMatcher v__token__new_keywords_matcher_T_v__token__Kind(Map_string_v__token__Kind kw_map) { - v__token__KeywordsMatcher km = ((v__token__KeywordsMatcher){.len_min = 9999,.len_max = -1,.words = {0},}); - for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { - km.words[v_fixed_index(i, 20)] = __new_array_with_default(0, 0, sizeof(v__token__WIndex), 0); - } - int _t2 = kw_map.key_values.len; - for (int _t1 = 0; _t1 < _t2; ++_t1 ) { - int _t3 = kw_map.key_values.len - _t2; - _t2 = kw_map.key_values.len; - if (_t3 < 0) { - _t1 = -1; - continue; - } - if (!DenseArray_has_index(&kw_map.key_values, _t1)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&kw_map.key_values, _t1); - k = string_clone(k); - v__token__Kind v = (*(v__token__Kind*)DenseArray_value(&kw_map.key_values, _t1)); - v__token__KeywordsMatcher_add_word(&km, k, ((int)(v))); - } - for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { - if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); - #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) - { - print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); - Array_v__token__WIndex _t4 = km.words[v_fixed_index(i, 20)]; - for (int _t5 = 0; _t5 < _t4.len; ++_t5) { - v__token__WIndex w = ((v__token__WIndex*)_t4.data)[_t5]; - print( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = w.word}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); - } - println(_SLIT("")); - } - #endif - } - } - v__token__KeywordsMatcher _t6 = km; - return _t6; -} -v__token__KeywordsMatcher v__token__new_keywords_matcher_T_int(Map_string_int kw_map) { - v__token__KeywordsMatcher km = ((v__token__KeywordsMatcher){.len_min = 9999,.len_max = -1,.words = {0},}); - for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { - km.words[v_fixed_index(i, 20)] = __new_array_with_default(0, 0, sizeof(v__token__WIndex), 0); - } - int _t2 = kw_map.key_values.len; - for (int _t1 = 0; _t1 < _t2; ++_t1 ) { - int _t3 = kw_map.key_values.len - _t2; - _t2 = kw_map.key_values.len; - if (_t3 < 0) { - _t1 = -1; - continue; - } - if (!DenseArray_has_index(&kw_map.key_values, _t1)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&kw_map.key_values, _t1); - k = string_clone(k); - int v = (*(int*)DenseArray_value(&kw_map.key_values, _t1)); - v__token__KeywordsMatcher_add_word(&km, k, ((int)(v))); - } - for (int i = 0; i < _const_v__token__max_keyword_len; ++i) { - if (km.words[v_fixed_index(i, 20)].len > 0) { - qsort(km.words[v_fixed_index(i, 20)].data, km.words[v_fixed_index(i, 20)].len, km.words[v_fixed_index(i, 20)].element_size, (int (*)(const void *, const void *))&compare_5690199065019732925_v__token__WIndex_by_word); - #if defined(CUSTOM_DEFINE_trace_keyword_matcher_initialisation) - { - print( str_intp(2, _MOV((StrIntpData[]){{_SLIT("word len: "), /*100 &int literal*/0x6fe27, {.d_i32 = i}}, {_SLIT(" | words: "), 0, { .d_c = 0 }}}))); - Array_v__token__WIndex _t4 = km.words[v_fixed_index(i, 20)]; - for (int _t5 = 0; _t5 < _t4.len; ++_t5) { - v__token__WIndex w = ((v__token__WIndex*)_t4.data)[_t5]; - print( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = w.word}}, {_SLIT(", "), 0, { .d_c = 0 }}}))); - } - println(_SLIT("")); - } - #endif - } - } - v__token__KeywordsMatcher _t6 = km; - return _t6; -} - -VV_LOCAL_SYMBOL void v__token__KeywordsMatcher_add_word(v__token__KeywordsMatcher* km, string word, int kind) { - if (word.len >= _const_v__token__max_keyword_len) { - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("increase max_keyword_len to > "), /*100 &int*/0xfe07, {.d_i32 = word.len}}, {_SLIT0, 0, { .d_c = 0 }}}))); +void v__depgraph__OrderedDepMap_delete(v__depgraph__OrderedDepMap* o, string name) { + if (!_IN_MAP(ADDR(string, name), ADDR(map, o->data))) { + _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("delete: no such key: "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}}))); VUNREACHABLE(); } - if (km->len_max < word.len) { - km->len_max = word.len; + for (int i = 0; i < o->keys.len; ++i) { + if (string__eq((*(string*)/*ee elem_sym */array_get(o->keys, i)), name)) { + array_delete(&o->keys, i); + break; + } } - if (word.len < km->len_min) { - km->len_min = word.len; - } - array_push((array*)&km->words[v_fixed_index(word.len, 20)], _MOV((v__token__WIndex[]){ ((v__token__WIndex){.word = word,.index = kind,}) })); + map_delete(&o->data, &(string[]){name}); } -// Attr: [direct_array_access] -int v__token__KeywordsMatcher_find(v__token__KeywordsMatcher* km, string word) { - int wlen = word.len; - if (wlen < km->len_min || wlen > km->len_max) { - int _t1 = -1; - return _t1; +void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { + Array_string diff = __new_array_with_default(0, 0, sizeof(string), 0); + Array_string deps_of_name = v__depgraph__OrderedDepMap_get(o, name); + for (int _t1 = 0; _t1 < deps_of_name.len; ++_t1) { + string dep = ((string*)deps_of_name.data)[_t1]; + if (!Array_string_contains(deps, dep)) { + array_push((array*)&diff, _MOV((string[]){ string_clone(dep) })); + } } - int list_len = km->words[wlen].len; - if (list_len == 0) { - int _t2 = -1; - return _t2; + v__depgraph__OrderedDepMap_set(o, name, diff); +} + +int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o) { + int _t1 = o->data.len; + return _t1; +} + +v__depgraph__DepGraph* v__depgraph__new_dep_graph(void) { + v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),}, sizeof(v__depgraph__DepGraph))); + return _t1; +} + +void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps) { + v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.deps = array_clone_to_depth(&deps, 0),}); + array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); +} + +v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph) { + v__depgraph__OrderedDepMap node_names = v__depgraph__new_ordered_dependency_map(); + v__depgraph__OrderedDepMap node_deps = v__depgraph__new_ordered_dependency_map(); + for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; + v__depgraph__OrderedDepMap_add(&node_names, node.name, node.deps); + v__depgraph__OrderedDepMap_add(&node_deps, node.name, node.deps); } - int lo = 0; - int hi = list_len - 1; + int iterations = 0; + v__depgraph__DepGraph* resolved = v__depgraph__new_dep_graph(); for (;;) { - if (!(lo <= hi)) break; - int mid = lo + (hi - lo) / 2; - int cmp = string_compare(((v__token__WIndex*)km->words[wlen].data)[mid].word, word); - - if (cmp == (0)) { - int _t3 = ((v__token__WIndex*)km->words[wlen].data)[mid].index; - return _t3; - } - else if (cmp == (-1)) { - lo = mid + 1; - } - else if (cmp == (1)) { - hi = mid - 1; - } - else { - }; - } - int _t4 = -1; - return _t4; -} - -// Attr: [unsafe] -void v__token__Pos_free(v__token__Pos* p) { -} - -string v__token__Pos_line_str(v__token__Pos p) { - string _t1 = str_intp(5, _MOV((StrIntpData[]){{_SLIT("{l: "), /*100 &int*/0xafe27, {.d_i32 = p.line_nr + 1}}, {_SLIT(", c: "), /*100 &int*/0x6fe27, {.d_i32 = p.col}}, {_SLIT(", p: "), /*100 &int*/0xafe27, {.d_i32 = p.pos}}, {_SLIT(", ll: "), /*100 &int*/0xafe27, {.d_i32 = p.last_line + 1}}, {_SLIT("}"), 0, { .d_c = 0 }}})); - return _t1; -} - -v__token__Pos v__token__Pos_extend(v__token__Pos pos, v__token__Pos end) { - v__token__Pos _t1 = ((v__token__Pos){.len = end.pos - pos.pos + end.len,pos.line_nr,pos.pos,pos.col,.last_line = end.last_line,}); - return _t1; -} - -v__token__Pos v__token__Pos_extend_with_last_line(v__token__Pos pos, v__token__Pos end, int last_line) { - v__token__Pos _t1 = ((v__token__Pos){.len = end.pos - pos.pos + end.len,.line_nr = pos.line_nr,.pos = pos.pos,.col = pos.col,.last_line = last_line - 1,}); - return _t1; -} - -void v__token__Pos_update_last_line(v__token__Pos* pos, int last_line) { - pos->last_line = last_line - 1; -} - -// Attr: [inline] -inline v__token__Pos v__token__Token_pos(v__token__Token* tok) { - v__token__Pos _t1 = ((v__token__Pos){.len = tok->len,.line_nr = tok->line_nr - 1,.pos = tok->pos,.col = tok->col - 1,.last_line = tok->line_nr - 1,}); - return _t1; -} - -VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void) { - Map_string_v__token__Kind res = new_map(sizeof(string), sizeof(v__token__Kind), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - for (int t = ((int)(v__token__Kind__keyword_beg)) + 1; t < ((int)(v__token__Kind__keyword_end)); ++t) { - string key = (*(string*)/*ee elem_sym */array_get(_const_v__token__token_str, t)); - map_set(&res, &(string[]){key}, &(v__token__Kind[]) { ((v__token__Kind)(t)) }); - } - Map_string_v__token__Kind _t1 = res; - return _t1; -} - -VV_LOCAL_SYMBOL Array_string v__token__build_token_str(void) { - Array_string s = __new_array_with_default(((int)(v__token__Kind___end_)), 0, sizeof(string), &(string[]){_SLIT("")}); - array_set(&s, v__token__Kind__unknown, &(string[]) { _SLIT("unknown") }); - array_set(&s, v__token__Kind__eof, &(string[]) { _SLIT("eof") }); - array_set(&s, v__token__Kind__name, &(string[]) { _SLIT("name") }); - array_set(&s, v__token__Kind__number, &(string[]) { _SLIT("number") }); - array_set(&s, v__token__Kind__string, &(string[]) { _SLIT("string") }); - array_set(&s, v__token__Kind__chartoken, &(string[]) { _SLIT("char") }); - array_set(&s, v__token__Kind__plus, &(string[]) { _SLIT("+") }); - array_set(&s, v__token__Kind__minus, &(string[]) { _SLIT("-") }); - array_set(&s, v__token__Kind__mul, &(string[]) { _SLIT("*") }); - array_set(&s, v__token__Kind__div, &(string[]) { _SLIT("/") }); - array_set(&s, v__token__Kind__mod, &(string[]) { _SLIT("%") }); - array_set(&s, v__token__Kind__xor, &(string[]) { _SLIT("^") }); - array_set(&s, v__token__Kind__bit_not, &(string[]) { _SLIT("~") }); - array_set(&s, v__token__Kind__pipe, &(string[]) { _SLIT("|") }); - array_set(&s, v__token__Kind__hash, &(string[]) { _SLIT("#") }); - array_set(&s, v__token__Kind__amp, &(string[]) { _SLIT("&") }); - array_set(&s, v__token__Kind__inc, &(string[]) { _SLIT("++") }); - array_set(&s, v__token__Kind__dec, &(string[]) { _SLIT("--") }); - array_set(&s, v__token__Kind__and, &(string[]) { _SLIT("&&") }); - array_set(&s, v__token__Kind__logical_or, &(string[]) { _SLIT("||") }); - array_set(&s, v__token__Kind__not, &(string[]) { _SLIT("!") }); - array_set(&s, v__token__Kind__dot, &(string[]) { _SLIT(".") }); - array_set(&s, v__token__Kind__dotdot, &(string[]) { _SLIT("..") }); - array_set(&s, v__token__Kind__ellipsis, &(string[]) { _SLIT("...") }); - array_set(&s, v__token__Kind__comma, &(string[]) { _SLIT(",") }); - array_set(&s, v__token__Kind__not_in, &(string[]) { _SLIT("!in") }); - array_set(&s, v__token__Kind__not_is, &(string[]) { _SLIT("!is") }); - array_set(&s, v__token__Kind__semicolon, &(string[]) { _SLIT(";") }); - array_set(&s, v__token__Kind__colon, &(string[]) { _SLIT(":") }); - array_set(&s, v__token__Kind__arrow, &(string[]) { _SLIT("<-") }); - array_set(&s, v__token__Kind__assign, &(string[]) { _SLIT("=") }); - array_set(&s, v__token__Kind__decl_assign, &(string[]) { _SLIT(":=") }); - array_set(&s, v__token__Kind__plus_assign, &(string[]) { _SLIT("+=") }); - array_set(&s, v__token__Kind__minus_assign, &(string[]) { _SLIT("-=") }); - array_set(&s, v__token__Kind__mult_assign, &(string[]) { _SLIT("*=") }); - array_set(&s, v__token__Kind__div_assign, &(string[]) { _SLIT("/=") }); - array_set(&s, v__token__Kind__xor_assign, &(string[]) { _SLIT("^=") }); - array_set(&s, v__token__Kind__mod_assign, &(string[]) { _SLIT("%=") }); - array_set(&s, v__token__Kind__or_assign, &(string[]) { _SLIT("|=") }); - array_set(&s, v__token__Kind__and_assign, &(string[]) { _SLIT("&=") }); - array_set(&s, v__token__Kind__right_shift_assign, &(string[]) { _SLIT(">>=") }); - array_set(&s, v__token__Kind__unsigned_right_shift_assign, &(string[]) { _SLIT(">>>=") }); - array_set(&s, v__token__Kind__left_shift_assign, &(string[]) { _SLIT("<<=") }); - array_set(&s, v__token__Kind__lcbr, &(string[]) { _SLIT("{") }); - array_set(&s, v__token__Kind__rcbr, &(string[]) { _SLIT("}") }); - array_set(&s, v__token__Kind__lpar, &(string[]) { _SLIT("(") }); - array_set(&s, v__token__Kind__rpar, &(string[]) { _SLIT(")") }); - array_set(&s, v__token__Kind__lsbr, &(string[]) { _SLIT("[") }); - array_set(&s, v__token__Kind__nilsbr, &(string[]) { _SLIT("#[") }); - array_set(&s, v__token__Kind__rsbr, &(string[]) { _SLIT("]") }); - array_set(&s, v__token__Kind__eq, &(string[]) { _SLIT("==") }); - array_set(&s, v__token__Kind__ne, &(string[]) { _SLIT("!=") }); - array_set(&s, v__token__Kind__gt, &(string[]) { _SLIT(">") }); - array_set(&s, v__token__Kind__lt, &(string[]) { _SLIT("<") }); - array_set(&s, v__token__Kind__ge, &(string[]) { _SLIT(">=") }); - array_set(&s, v__token__Kind__le, &(string[]) { _SLIT("<=") }); - array_set(&s, v__token__Kind__question, &(string[]) { _SLIT("?") }); - array_set(&s, v__token__Kind__left_shift, &(string[]) { _SLIT("<<") }); - array_set(&s, v__token__Kind__right_shift, &(string[]) { _SLIT(">>") }); - array_set(&s, v__token__Kind__unsigned_right_shift, &(string[]) { _SLIT(">>>") }); - array_set(&s, v__token__Kind__comment, &(string[]) { _SLIT("comment") }); - array_set(&s, v__token__Kind__nl, &(string[]) { _SLIT("NLL") }); - array_set(&s, v__token__Kind__dollar, &(string[]) { _SLIT("$") }); - array_set(&s, v__token__Kind__at, &(string[]) { _SLIT("@") }); - array_set(&s, v__token__Kind__str_dollar, &(string[]) { _SLIT("$2") }); - array_set(&s, v__token__Kind__key_assert, &(string[]) { _SLIT("assert") }); - array_set(&s, v__token__Kind__key_struct, &(string[]) { _SLIT("struct") }); - array_set(&s, v__token__Kind__key_if, &(string[]) { _SLIT("if") }); - array_set(&s, v__token__Kind__key_else, &(string[]) { _SLIT("else") }); - array_set(&s, v__token__Kind__key_asm, &(string[]) { _SLIT("asm") }); - array_set(&s, v__token__Kind__key_return, &(string[]) { _SLIT("return") }); - array_set(&s, v__token__Kind__key_module, &(string[]) { _SLIT("module") }); - array_set(&s, v__token__Kind__key_sizeof, &(string[]) { _SLIT("sizeof") }); - array_set(&s, v__token__Kind__key_isreftype, &(string[]) { _SLIT("isreftype") }); - array_set(&s, v__token__Kind__key_likely, &(string[]) { _SLIT("_likely_") }); - array_set(&s, v__token__Kind__key_unlikely, &(string[]) { _SLIT("_unlikely_") }); - array_set(&s, v__token__Kind__key_go, &(string[]) { _SLIT("go") }); - array_set(&s, v__token__Kind__key_goto, &(string[]) { _SLIT("goto") }); - array_set(&s, v__token__Kind__key_const, &(string[]) { _SLIT("const") }); - array_set(&s, v__token__Kind__key_mut, &(string[]) { _SLIT("mut") }); - array_set(&s, v__token__Kind__key_shared, &(string[]) { _SLIT("shared") }); - array_set(&s, v__token__Kind__key_lock, &(string[]) { _SLIT("lock") }); - array_set(&s, v__token__Kind__key_rlock, &(string[]) { _SLIT("rlock") }); - array_set(&s, v__token__Kind__key_type, &(string[]) { _SLIT("type") }); - array_set(&s, v__token__Kind__key_for, &(string[]) { _SLIT("for") }); - array_set(&s, v__token__Kind__key_fn, &(string[]) { _SLIT("fn") }); - array_set(&s, v__token__Kind__key_true, &(string[]) { _SLIT("true") }); - array_set(&s, v__token__Kind__key_false, &(string[]) { _SLIT("false") }); - array_set(&s, v__token__Kind__key_continue, &(string[]) { _SLIT("continue") }); - array_set(&s, v__token__Kind__key_break, &(string[]) { _SLIT("break") }); - array_set(&s, v__token__Kind__key_import, &(string[]) { _SLIT("import") }); - array_set(&s, v__token__Kind__key_unsafe, &(string[]) { _SLIT("unsafe") }); - array_set(&s, v__token__Kind__key_typeof, &(string[]) { _SLIT("typeof") }); - array_set(&s, v__token__Kind__key_dump, &(string[]) { _SLIT("dump") }); - array_set(&s, v__token__Kind__key_enum, &(string[]) { _SLIT("enum") }); - array_set(&s, v__token__Kind__key_interface, &(string[]) { _SLIT("interface") }); - array_set(&s, v__token__Kind__key_pub, &(string[]) { _SLIT("pub") }); - array_set(&s, v__token__Kind__key_in, &(string[]) { _SLIT("in") }); - array_set(&s, v__token__Kind__key_atomic, &(string[]) { _SLIT("atomic") }); - array_set(&s, v__token__Kind__key_orelse, &(string[]) { _SLIT("or") }); - array_set(&s, v__token__Kind__key_global, &(string[]) { _SLIT("__global") }); - array_set(&s, v__token__Kind__key_union, &(string[]) { _SLIT("union") }); - array_set(&s, v__token__Kind__key_static, &(string[]) { _SLIT("static") }); - array_set(&s, v__token__Kind__key_volatile, &(string[]) { _SLIT("volatile") }); - array_set(&s, v__token__Kind__key_as, &(string[]) { _SLIT("as") }); - array_set(&s, v__token__Kind__key_defer, &(string[]) { _SLIT("defer") }); - array_set(&s, v__token__Kind__key_match, &(string[]) { _SLIT("match") }); - array_set(&s, v__token__Kind__key_select, &(string[]) { _SLIT("select") }); - array_set(&s, v__token__Kind__key_none, &(string[]) { _SLIT("none") }); - array_set(&s, v__token__Kind__key_offsetof, &(string[]) { _SLIT("__offsetof") }); - array_set(&s, v__token__Kind__key_is, &(string[]) { _SLIT("is") }); - array_set(&s, v__token__Kind__keyword_beg, &(string[]) { _SLIT("keyword_beg") }); - array_set(&s, v__token__Kind__keyword_end, &(string[]) { _SLIT("keyword_end") }); - array_set(&s, v__token__Kind__str_inter, &(string[]) { _SLIT("str_inter") }); - #if defined(CUSTOM_DEFINE_debug_build_token_str) - { - for (int k = 0; k < s.len; ++k) { - string v = ((string*)s.data)[k]; - if ((v).len == 0) { - eprintln( str_intp(5, _MOV((StrIntpData[]){{_SLIT(">>> "), /*115 &string*/0xfe10, {.d_s = _SLIT("v.token")}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = _SLIT("build_token_str")}}, {_SLIT(" missing k: "), /*100 &int*/0xfe07, {.d_i32 = k}}, {_SLIT(" | ."), /*115 &string*/0xfe10, {.d_s = v__token__kind_to_string(((v__token__Kind)(k)))}}, {_SLIT0, 0, { .d_c = 0 }}}))); + if (!(v__depgraph__OrderedDepMap_size(&node_deps) != 0)) break; + iterations++; + Array_string ready_set = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t2 = 0; _t2 < node_deps.keys.len; ++_t2) { + string name = ((string*)node_deps.keys.data)[_t2]; + Array_string deps = v__depgraph__OrderedDepMap_get(&node_deps, name); + if (deps.len == 0) { + array_push((array*)&ready_set, _MOV((string[]){ string_clone(name) })); } } - } - #endif - Array_string _t1 = s; - return _t1; -} - -// Attr: [inline] -inline bool v__token__is_key(string key) { - bool _t1 = ((int)((*(v__token__Kind*)map_get(ADDR(map, _const_v__token__keywords), &(string[]){key}, &(v__token__Kind[]){ 0 })))) > 0; - return _t1; -} - -// Attr: [inline] -inline bool v__token__is_decl(v__token__Kind t) { - bool _t1 = (t == v__token__Kind__key_enum || t == v__token__Kind__key_interface || t == v__token__Kind__key_fn || t == v__token__Kind__key_struct || t == v__token__Kind__key_type || t == v__token__Kind__key_const || t == v__token__Kind__key_pub || t == v__token__Kind__eof); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_assign(v__token__Kind t) { - bool _t1 = Array_v__token__Kind_contains(_const_v__token__assign_tokens, t); - return _t1; -} - -// Attr: [inline] -inline string v__token__Kind_str(v__token__Kind t) { - string _t1 = (*(string*)/*ee elem_sym */array_get(_const_v__token__token_str, ((int)(t)))); - return _t1; -} - -string v__token__Token_str(v__token__Token t) { - string s = v__token__Kind_str(t.kind); - if (s.len == 0) { - eprintln(_SLIT("missing token kind string")); - } else if (!u8_is_letter(string_at(s, 0))) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("token `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("`"), 0, { .d_c = 0 }}})); - return _t1; - } - if (v__token__is_key(t.lit)) { - s = _SLIT("keyword"); - } - if ((t.lit).len != 0) { - s = /*f*/string__plus(s, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = t.lit}}, {_SLIT("`"), 0, { .d_c = 0 }}}))); - } - string _t2 = s; - return _t2; -} - -string v__token__Token_debug(v__token__Token t) { - string ks = v__token__kind_to_string(t.kind); - string s = ((t.lit).len == 0 ? (v__token__Kind_str(t.kind)) : (t.lit)); - string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("tok: ."), /*115 &string*/0x18fe10, {.d_s = ks}}, {_SLIT(" | lit: `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("`"), 0, { .d_c = 0 }}})); - return _t1; -} - -Array_v__token__Precedence v__token__build_precedences(void) { - Array_v__token__Precedence p = __new_array_with_default(((int)(v__token__Kind___end_)), 0, sizeof(v__token__Precedence), 0); - array_set(&p, v__token__Kind__lsbr, &(v__token__Precedence[]) { v__token__Precedence__index }); - array_set(&p, v__token__Kind__nilsbr, &(v__token__Precedence[]) { v__token__Precedence__index }); - array_set(&p, v__token__Kind__dot, &(v__token__Precedence[]) { v__token__Precedence__call }); - array_set(&p, v__token__Kind__inc, &(v__token__Precedence[]) { v__token__Precedence__postfix }); - array_set(&p, v__token__Kind__dec, &(v__token__Precedence[]) { v__token__Precedence__postfix }); - array_set(&p, v__token__Kind__question, &(v__token__Precedence[]) { v__token__Precedence__postfix }); - array_set(&p, v__token__Kind__mul, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__div, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__mod, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__left_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__right_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__unsigned_right_shift, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__amp, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__arrow, &(v__token__Precedence[]) { v__token__Precedence__product }); - array_set(&p, v__token__Kind__plus, &(v__token__Precedence[]) { v__token__Precedence__sum }); - array_set(&p, v__token__Kind__minus, &(v__token__Precedence[]) { v__token__Precedence__sum }); - array_set(&p, v__token__Kind__pipe, &(v__token__Precedence[]) { v__token__Precedence__sum }); - array_set(&p, v__token__Kind__xor, &(v__token__Precedence[]) { v__token__Precedence__sum }); - array_set(&p, v__token__Kind__eq, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__ne, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__lt, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__le, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__gt, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__ge, &(v__token__Precedence[]) { v__token__Precedence__eq }); - array_set(&p, v__token__Kind__assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__plus_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__minus_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__div_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__mod_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__or_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__and_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__left_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__right_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__unsigned_right_shift_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__mult_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__xor_assign, &(v__token__Precedence[]) { v__token__Precedence__assign }); - array_set(&p, v__token__Kind__key_in, &(v__token__Precedence[]) { v__token__Precedence__in_as }); - array_set(&p, v__token__Kind__not_in, &(v__token__Precedence[]) { v__token__Precedence__in_as }); - array_set(&p, v__token__Kind__key_as, &(v__token__Precedence[]) { v__token__Precedence__in_as }); - array_set(&p, v__token__Kind__key_is, &(v__token__Precedence[]) { v__token__Precedence__in_as }); - array_set(&p, v__token__Kind__not_is, &(v__token__Precedence[]) { v__token__Precedence__in_as }); - array_set(&p, v__token__Kind__logical_or, &(v__token__Precedence[]) { v__token__Precedence__cond }); - array_set(&p, v__token__Kind__and, &(v__token__Precedence[]) { v__token__Precedence__cond }); - Array_v__token__Precedence _t1 = p; - return _t1; -} - -// Attr: [inline] -inline int v__token__Token_precedence(v__token__Token tok) { - int _t1 = ((int)((*(v__token__Precedence*)/*ee elem_sym */array_get(_const_v__token__precedences, tok.kind)))); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Token_is_scalar(v__token__Token tok) { - bool _t1 = (tok.kind == v__token__Kind__number || tok.kind == v__token__Kind__string); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Token_is_unary(v__token__Token tok) { - bool _t1 = (tok.kind == v__token__Kind__plus || tok.kind == v__token__Kind__minus || tok.kind == v__token__Kind__not || tok.kind == v__token__Kind__bit_not || tok.kind == v__token__Kind__mul || tok.kind == v__token__Kind__amp || tok.kind == v__token__Kind__arrow); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_relational(v__token__Kind tok) { - bool _t1 = (tok == v__token__Kind__lt || tok == v__token__Kind__le || tok == v__token__Kind__gt || tok == v__token__Kind__ge || tok == v__token__Kind__eq || tok == v__token__Kind__ne); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_start_of_type(v__token__Kind k) { - bool _t1 = (k == v__token__Kind__name || k == v__token__Kind__lpar || k == v__token__Kind__amp || k == v__token__Kind__lsbr || k == v__token__Kind__question || k == v__token__Kind__key_shared || k == v__token__Kind__not); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_prefix(v__token__Kind kind) { - bool _t1 = (kind == v__token__Kind__minus || kind == v__token__Kind__amp || kind == v__token__Kind__mul || kind == v__token__Kind__not || kind == v__token__Kind__bit_not); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_infix(v__token__Kind kind) { - bool _t1 = (kind == v__token__Kind__plus || kind == v__token__Kind__minus || kind == v__token__Kind__mod || kind == v__token__Kind__mul || kind == v__token__Kind__div || kind == v__token__Kind__eq || kind == v__token__Kind__ne || kind == v__token__Kind__gt || kind == v__token__Kind__lt || kind == v__token__Kind__key_in || kind == v__token__Kind__key_as || kind == v__token__Kind__ge || kind == v__token__Kind__le || kind == v__token__Kind__logical_or || kind == v__token__Kind__xor || kind == v__token__Kind__not_in || kind == v__token__Kind__key_is || kind == v__token__Kind__not_is || kind == v__token__Kind__and || kind == v__token__Kind__dot || kind == v__token__Kind__pipe || kind == v__token__Kind__amp || kind == v__token__Kind__left_shift || kind == v__token__Kind__right_shift || kind == v__token__Kind__unsigned_right_shift || kind == v__token__Kind__arrow); - return _t1; -} - -// Attr: [inline] -inline bool v__token__Kind_is_postfix(v__token__Kind kind) { - bool _t1 = (kind == v__token__Kind__inc || kind == v__token__Kind__dec || kind == v__token__Kind__question); - return _t1; -} - -string v__token__kind_to_string(v__token__Kind k) { - string _t2 = (string){.str=(byteptr)"", .is_lit=1}; - switch (k) { - case v__token__Kind__unknown: - { - _t2 = _SLIT("unknown"); - break; - } - case v__token__Kind__eof: - { - _t2 = _SLIT("eof"); - break; - } - case v__token__Kind__name: - { - _t2 = _SLIT("name"); - break; - } - case v__token__Kind__number: - { - _t2 = _SLIT("number"); - break; - } - case v__token__Kind__string: - { - _t2 = _SLIT("string"); - break; - } - case v__token__Kind__str_inter: - { - _t2 = _SLIT("str_inter"); - break; - } - case v__token__Kind__chartoken: - { - _t2 = _SLIT("chartoken"); - break; - } - case v__token__Kind__plus: - { - _t2 = _SLIT("plus"); - break; - } - case v__token__Kind__minus: - { - _t2 = _SLIT("minus"); - break; - } - case v__token__Kind__mul: - { - _t2 = _SLIT("mul"); - break; - } - case v__token__Kind__div: - { - _t2 = _SLIT("div"); - break; - } - case v__token__Kind__mod: - { - _t2 = _SLIT("mod"); - break; - } - case v__token__Kind__xor: - { - _t2 = _SLIT("xor"); - break; - } - case v__token__Kind__pipe: - { - _t2 = _SLIT("pipe"); - break; - } - case v__token__Kind__inc: - { - _t2 = _SLIT("inc"); - break; - } - case v__token__Kind__dec: - { - _t2 = _SLIT("dec"); - break; - } - case v__token__Kind__and: - { - _t2 = _SLIT("and"); - break; - } - case v__token__Kind__logical_or: - { - _t2 = _SLIT("logical_or"); - break; - } - case v__token__Kind__not: - { - _t2 = _SLIT("not"); - break; - } - case v__token__Kind__bit_not: - { - _t2 = _SLIT("bit_not"); - break; - } - case v__token__Kind__question: - { - _t2 = _SLIT("question"); - break; - } - case v__token__Kind__comma: - { - _t2 = _SLIT("comma"); - break; - } - case v__token__Kind__semicolon: - { - _t2 = _SLIT("semicolon"); - break; - } - case v__token__Kind__colon: - { - _t2 = _SLIT("colon"); - break; - } - case v__token__Kind__arrow: - { - _t2 = _SLIT("arrow"); - break; - } - case v__token__Kind__amp: - { - _t2 = _SLIT("amp"); - break; - } - case v__token__Kind__hash: - { - _t2 = _SLIT("hash"); - break; - } - case v__token__Kind__dollar: - { - _t2 = _SLIT("dollar"); - break; - } - case v__token__Kind__at: - { - _t2 = _SLIT("at"); - break; - } - case v__token__Kind__str_dollar: - { - _t2 = _SLIT("str_dollar"); - break; - } - case v__token__Kind__left_shift: - { - _t2 = _SLIT("left_shift"); - break; - } - case v__token__Kind__right_shift: - { - _t2 = _SLIT("right_shift"); - break; - } - case v__token__Kind__unsigned_right_shift: - { - _t2 = _SLIT("unsigned_right_shift"); - break; - } - case v__token__Kind__not_in: - { - _t2 = _SLIT("not_in"); - break; - } - case v__token__Kind__not_is: - { - _t2 = _SLIT("not_is"); - break; - } - case v__token__Kind__assign: - { - _t2 = _SLIT("assign"); - break; - } - case v__token__Kind__decl_assign: - { - _t2 = _SLIT("decl_assign"); - break; - } - case v__token__Kind__plus_assign: - { - _t2 = _SLIT("plus_assign"); - break; - } - case v__token__Kind__minus_assign: - { - _t2 = _SLIT("minus_assign"); - break; - } - case v__token__Kind__div_assign: - { - _t2 = _SLIT("div_assign"); - break; - } - case v__token__Kind__mult_assign: - { - _t2 = _SLIT("mult_assign"); - break; - } - case v__token__Kind__xor_assign: - { - _t2 = _SLIT("xor_assign"); - break; - } - case v__token__Kind__mod_assign: - { - _t2 = _SLIT("mod_assign"); - break; - } - case v__token__Kind__or_assign: - { - _t2 = _SLIT("or_assign"); - break; - } - case v__token__Kind__and_assign: - { - _t2 = _SLIT("and_assign"); - break; - } - case v__token__Kind__right_shift_assign: - { - _t2 = _SLIT("right_shift_assign"); - break; - } - case v__token__Kind__left_shift_assign: - { - _t2 = _SLIT("left_shift_assign"); - break; - } - case v__token__Kind__unsigned_right_shift_assign: - { - _t2 = _SLIT("unsigned_right_shift_assign"); - break; - } - case v__token__Kind__lcbr: - { - _t2 = _SLIT("lcbr"); - break; - } - case v__token__Kind__rcbr: - { - _t2 = _SLIT("rcbr"); - break; - } - case v__token__Kind__lpar: - { - _t2 = _SLIT("lpar"); - break; - } - case v__token__Kind__rpar: - { - _t2 = _SLIT("rpar"); - break; - } - case v__token__Kind__lsbr: - { - _t2 = _SLIT("lsbr"); - break; - } - case v__token__Kind__nilsbr: - { - _t2 = _SLIT("nilsbr"); - break; - } - case v__token__Kind__rsbr: - { - _t2 = _SLIT("rsbr"); - break; - } - case v__token__Kind__eq: - { - _t2 = _SLIT("eq"); - break; - } - case v__token__Kind__ne: - { - _t2 = _SLIT("ne"); - break; - } - case v__token__Kind__gt: - { - _t2 = _SLIT("gt"); - break; - } - case v__token__Kind__lt: - { - _t2 = _SLIT("lt"); - break; - } - case v__token__Kind__ge: - { - _t2 = _SLIT("ge"); - break; - } - case v__token__Kind__le: - { - _t2 = _SLIT("le"); - break; - } - case v__token__Kind__comment: - { - _t2 = _SLIT("comment"); - break; - } - case v__token__Kind__nl: - { - _t2 = _SLIT("nl"); - break; - } - case v__token__Kind__dot: - { - _t2 = _SLIT("dot"); - break; - } - case v__token__Kind__dotdot: - { - _t2 = _SLIT("dotdot"); - break; - } - case v__token__Kind__ellipsis: - { - _t2 = _SLIT("ellipsis"); - break; - } - case v__token__Kind__keyword_beg: - { - _t2 = _SLIT("keyword_beg"); - break; - } - case v__token__Kind__key_as: - { - _t2 = _SLIT("key_as"); - break; - } - case v__token__Kind__key_asm: - { - _t2 = _SLIT("key_asm"); - break; - } - case v__token__Kind__key_assert: - { - _t2 = _SLIT("key_assert"); - break; - } - case v__token__Kind__key_atomic: - { - _t2 = _SLIT("key_atomic"); - break; - } - case v__token__Kind__key_break: - { - _t2 = _SLIT("key_break"); - break; - } - case v__token__Kind__key_const: - { - _t2 = _SLIT("key_const"); - break; - } - case v__token__Kind__key_continue: - { - _t2 = _SLIT("key_continue"); - break; - } - case v__token__Kind__key_defer: - { - _t2 = _SLIT("key_defer"); - break; - } - case v__token__Kind__key_else: - { - _t2 = _SLIT("key_else"); - break; - } - case v__token__Kind__key_enum: - { - _t2 = _SLIT("key_enum"); - break; - } - case v__token__Kind__key_false: - { - _t2 = _SLIT("key_false"); - break; - } - case v__token__Kind__key_for: - { - _t2 = _SLIT("key_for"); - break; - } - case v__token__Kind__key_fn: - { - _t2 = _SLIT("key_fn"); - break; - } - case v__token__Kind__key_global: - { - _t2 = _SLIT("key_global"); - break; - } - case v__token__Kind__key_go: - { - _t2 = _SLIT("key_go"); - break; - } - case v__token__Kind__key_goto: - { - _t2 = _SLIT("key_goto"); - break; - } - case v__token__Kind__key_if: - { - _t2 = _SLIT("key_if"); - break; - } - case v__token__Kind__key_import: - { - _t2 = _SLIT("key_import"); - break; - } - case v__token__Kind__key_in: - { - _t2 = _SLIT("key_in"); - break; - } - case v__token__Kind__key_interface: - { - _t2 = _SLIT("key_interface"); - break; - } - case v__token__Kind__key_is: - { - _t2 = _SLIT("key_is"); - break; - } - case v__token__Kind__key_match: - { - _t2 = _SLIT("key_match"); - break; - } - case v__token__Kind__key_module: - { - _t2 = _SLIT("key_module"); - break; - } - case v__token__Kind__key_mut: - { - _t2 = _SLIT("key_mut"); - break; - } - case v__token__Kind__key_shared: - { - _t2 = _SLIT("key_shared"); - break; - } - case v__token__Kind__key_lock: - { - _t2 = _SLIT("key_lock"); - break; - } - case v__token__Kind__key_rlock: - { - _t2 = _SLIT("key_rlock"); - break; - } - case v__token__Kind__key_none: - { - _t2 = _SLIT("key_none"); - break; - } - case v__token__Kind__key_return: - { - _t2 = _SLIT("key_return"); - break; - } - case v__token__Kind__key_select: - { - _t2 = _SLIT("key_select"); - break; - } - case v__token__Kind__key_sizeof: - { - _t2 = _SLIT("key_sizeof"); - break; - } - case v__token__Kind__key_isreftype: - { - _t2 = _SLIT("key_isreftype"); - break; - } - case v__token__Kind__key_likely: - { - _t2 = _SLIT("key_likely"); - break; - } - case v__token__Kind__key_unlikely: - { - _t2 = _SLIT("key_unlikely"); - break; - } - case v__token__Kind__key_offsetof: - { - _t2 = _SLIT("key_offsetof"); - break; - } - case v__token__Kind__key_struct: - { - _t2 = _SLIT("key_struct"); - break; - } - case v__token__Kind__key_true: - { - _t2 = _SLIT("key_true"); - break; - } - case v__token__Kind__key_type: - { - _t2 = _SLIT("key_type"); - break; - } - case v__token__Kind__key_typeof: - { - _t2 = _SLIT("key_typeof"); - break; - } - case v__token__Kind__key_dump: - { - _t2 = _SLIT("key_dump"); - break; - } - case v__token__Kind__key_orelse: - { - _t2 = _SLIT("key_orelse"); - break; - } - case v__token__Kind__key_union: - { - _t2 = _SLIT("key_union"); - break; - } - case v__token__Kind__key_pub: - { - _t2 = _SLIT("key_pub"); - break; - } - case v__token__Kind__key_static: - { - _t2 = _SLIT("key_static"); - break; - } - case v__token__Kind__key_volatile: - { - _t2 = _SLIT("key_volatile"); - break; - } - case v__token__Kind__key_unsafe: - { - _t2 = _SLIT("key_unsafe"); - break; - } - case v__token__Kind__keyword_end: - { - _t2 = _SLIT("keyword_end"); - break; - } - case v__token__Kind___end_: - { - _t2 = _SLIT("_end_"); - break; - } - } - string _t1 = _t2; - return _t1; -} - -_option_v__token__Kind v__token__kind_from_string(string s) { - _option_v__token__Kind _t2 = {0}; - - if (string__eq(s, _SLIT("unknown"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__unknown }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("eof"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__eof }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("name"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__name }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("number"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__number }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("string"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__string }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("str_inter"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__str_inter }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("chartoken"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__chartoken }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("plus"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__plus }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("minus"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__minus }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("mul"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__mul }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("div"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__div }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("mod"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__mod }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("xor"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__xor }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("pipe"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__pipe }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("inc"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__inc }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("dec"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__dec }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("and"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__and }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("logical_or"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__logical_or }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("not"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__not }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("bit_not"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__bit_not }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("question"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__question }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("comma"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__comma }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("semicolon"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__semicolon }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("colon"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__colon }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("arrow"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__arrow }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("amp"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__amp }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("hash"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__hash }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("dollar"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__dollar }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("at"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__at }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("str_dollar"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__str_dollar }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("left_shift"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__left_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("right_shift"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__right_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("unsigned_right_shift"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__unsigned_right_shift }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("not_in"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__not_in }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("not_is"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__not_is }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("decl_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__decl_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("plus_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__plus_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("minus_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__minus_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("div_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__div_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("mult_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__mult_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("xor_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__xor_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("mod_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__mod_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("or_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__or_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("and_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__and_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("right_shift_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__right_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("left_shift_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__left_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("unsigned_right_shift_assign"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__unsigned_right_shift_assign }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("lcbr"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__lcbr }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("rcbr"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__rcbr }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("lpar"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__lpar }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("rpar"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__rpar }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("lsbr"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__lsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("nilsbr"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__nilsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("rsbr"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__rsbr }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("eq"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__eq }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("ne"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__ne }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("gt"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__gt }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("lt"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__lt }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("ge"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__ge }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("le"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__le }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("comment"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__comment }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("nl"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__nl }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("dot"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__dot }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("dotdot"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__dotdot }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("ellipsis"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__ellipsis }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("keyword_beg"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__keyword_beg }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_as"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_as }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_asm"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_asm }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_assert"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_assert }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_atomic"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_atomic }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_break"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_break }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_const"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_const }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_continue"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_continue }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_defer"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_defer }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_else"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_else }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_enum"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_enum }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_false"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_false }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_for"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_for }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_fn"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_fn }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_global"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_global }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_go"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_go }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_goto"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_goto }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_if"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_if }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_import"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_import }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_in"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_in }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_interface"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_interface }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_is"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_is }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_match"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_match }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_module"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_module }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_mut"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_mut }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_shared"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_shared }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_lock"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_lock }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_rlock"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_rlock }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_none"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_none }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_return"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_return }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_select"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_select }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_sizeof"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_sizeof }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_isreftype"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_isreftype }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_likely"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_likely }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_unlikely"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_unlikely }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_offsetof"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_offsetof }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_struct"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_struct }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_true"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_true }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_type"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_type }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_typeof"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_typeof }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_dump"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_dump }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_orelse"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_orelse }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_union"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_union }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_pub"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_pub }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_static"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_static }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_volatile"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_volatile }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("key_unsafe"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__key_unsafe }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("keyword_end"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind__keyword_end }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else if (string__eq(s, _SLIT("_end_"))) { - opt_ok2(&(v__token__Kind[]) { v__token__Kind___end_ }, (_option*)(&_t2), sizeof(v__token__Kind)); - } - else { - _t2.state = 2; - _t2.err = _v_error(_SLIT("unknown")); - }_option_v__token__Kind _t1 = _t2; - return _t1; -} - -// Attr: [inline] -inline int v__mathutil__min_T_int(int a, int b) { - int _t1 = (a < b ? (a) : (b)); - return _t1; -} - -// Attr: [inline] -inline int v__mathutil__max_T_int(int a, int b) { - int _t1 = (a > b ? (a) : (b)); - return _t1; -} - -void v__dotgraph__start_digraph(void) { - println(_SLIT("digraph G {")); - atexit((voidptr) anon_fn_6b9593b3d6ef610a__82); -} - -v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color) { - v__dotgraph__DotGraph* res = ((v__dotgraph__DotGraph*)memdup(&(v__dotgraph__DotGraph){.sb = strings__new_builder(1024),}, sizeof(v__dotgraph__DotGraph))); - v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" subgraph cluster_"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); - v__dotgraph__DotGraph_writeln(res, _SLIT("\tedge [fontname=\"Helvetica\",fontsize=\"10\",labelfontname=\"Helvetica\",labelfontsize=\"10\",style=\"solid\",color=\"black\"];")); - v__dotgraph__DotGraph_writeln(res, _SLIT("\tnode [fontname=\"Helvetica\",fontsize=\"10\",style=\"filled\",fontcolor=\"black\",fillcolor=\"white\",color=\"black\",shape=\"box\"];")); - v__dotgraph__DotGraph_writeln(res, _SLIT("\trankdir=\"LR\";")); - v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tcolor=\""), /*115 &string*/0xfe10, {.d_s = color}}, {_SLIT("\";"), 0, { .d_c = 0 }}}))); - v__dotgraph__DotGraph_writeln(res, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tlabel=\""), /*115 &string*/0xfe10, {.d_s = label}}, {_SLIT("\";"), 0, { .d_c = 0 }}}))); - v__dotgraph__DotGraph* _t1 = res; - return _t1; -} - -void v__dotgraph__DotGraph_writeln(v__dotgraph__DotGraph* d, string line) { - strings__Builder_writeln(&d->sb, line); -} - -void v__dotgraph__DotGraph_finish(v__dotgraph__DotGraph* d) { - strings__Builder_writeln(&d->sb, _SLIT(" }")); - println(strings__Builder_str(&d->sb)); -} - -void v__dotgraph__DotGraph_new_node(v__dotgraph__DotGraph* d, string nlabel, v__dotgraph__NewNodeConfig cfg) { - string nname = cfg.name2node_fn(nlabel, cfg.ctx); - if ((cfg.node_name).len != 0) { - nname = cfg.node_name; - } - if (cfg.should_highlight) { - v__dotgraph__DotGraph_writeln(d, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nname}}, {_SLIT(" [label=\""), /*115 &string*/0xfe10, {.d_s = nlabel}}, {_SLIT("\",color=\"blue\",height=0.2,width=0.4,fillcolor=\"#00FF00\",tooltip=\""), /*115 &string*/0xfe10, {.d_s = cfg.tooltip}}, {_SLIT("\",shape=oval];"), 0, { .d_c = 0 }}}))); - } else { - v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nname}}, {_SLIT(" [shape=\"box\",label=\""), /*115 &string*/0xfe10, {.d_s = nlabel}}, {_SLIT("\"];"), 0, { .d_c = 0 }}}))); - } -} - -void v__dotgraph__DotGraph_new_edge(v__dotgraph__DotGraph* d, string source, string target, v__dotgraph__NewEdgeConfig cfg) { - string nsource = cfg.name2node_fn(source, cfg.ctx); - string ntarget = cfg.name2node_fn(target, cfg.ctx); - if (cfg.should_highlight) { - v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nsource}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = ntarget}}, {_SLIT(" [color=\"blue\"];"), 0, { .d_c = 0 }}}))); - } else { - v__dotgraph__DotGraph_writeln(d, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = nsource}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = ntarget}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - } -} - -// TypeDecl -string v__dotgraph__node_name(string name, voidptr context) { - string _t1 = string_replace(name, _SLIT("."), _SLIT("_")); - return _t1; -} - -// Attr: [inline] -inline u64 hash__wyhash_c(u8* key, u64 len, u64 seed) { - u64 _t1 = wyhash(key, len, seed, ((u64*)(_wyp))); - return _t1; -} - -// Attr: [inline] -inline u64 hash__wyhash64_c(u64 a, u64 b) { - u64 _t1 = wyhash64(a, b); - return _t1; -} - -// Attr: [inline] -inline u64 hash__sum64_string(string key, u64 seed) { - u64 _t1 = hash__wyhash_c(key.str, ((u64)(key.len)), seed); - return _t1; -} - -// Attr: [inline] -inline u64 hash__sum64(Array_u8 key, u64 seed) { - u64 _t1 = hash__wyhash_c(((u8*)(key.data)), ((u64)(key.len)), seed); - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 hash__wyrotr(u64 v, u32 k) { - u64 _t1 = ((v >> k) | (v << (64 - k))); - return _t1; -} - -// Attr: [inline] -inline u64 hash__wymum(u64 a, u64 b) { - u32 mask32 = ((u32)(4294967295U)); - u64 x0 = (a & mask32); - u64 x1 = a >> 32U; - u64 y0 = (b & mask32); - u64 y1 = b >> 32U; - u64 w0 = x0 * y0; - u64 t = x1 * y0 + (w0 >> 32U); - u64 w1 = (t & mask32); - u64 w2 = t >> 32U; - w1 += x0 * y1; - u64 hi = x1 * y1 + w2 + (w1 >> 32U); - u64 lo = a * b; - u64 _t1 = (hi ^ lo); - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 hash__wyr3(u8* p, u64 k) { - { // Unsafe block - u64 _t1 = (((((u64)(p[0])) << 16U) | (((u64)(p[k >> 1U])) << 8U)) | ((u64)(p[k - 1U]))); - return _t1; - } - return 0; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 hash__wyr4(u8* p) { - { // Unsafe block - u64 _t1 = (((((u32)(p[0])) | (((u32)(p[1])) << ((u32)(8U)))) | (((u32)(p[2])) << ((u32)(16U)))) | (((u32)(p[3])) << ((u32)(24U)))); - return _t1; - } - return 0; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 hash__wyr8(u8* p) { - { // Unsafe block - u64 _t1 = (((((((((u64)(p[0])) | (((u64)(p[1])) << 8U)) | (((u64)(p[2])) << 16U)) | (((u64)(p[3])) << 24U)) | (((u64)(p[4])) << 32U)) | (((u64)(p[5])) << 40U)) | (((u64)(p[6])) << 48U)) | (((u64)(p[7])) << 56U)); - return _t1; - } - return 0; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline u32 hash__fnv1a__sum32_string(string data) { - u32 hash = _const_hash__fnv1a__fnv32_offset_basis; - for (int i = 0; i < data.len; ++i) { - hash = ((hash ^ ((u32)(data.str[ i])))) * _const_hash__fnv1a__fnv32_prime; - } - u32 _t1 = hash; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline u32 hash__fnv1a__sum32(Array_u8 data) { - u32 hash = _const_hash__fnv1a__fnv32_offset_basis; - for (int i = 0; i < data.len; ++i) { - hash = ((hash ^ ((u32)(((u8*)data.data)[i])))) * _const_hash__fnv1a__fnv32_prime; - } - u32 _t1 = hash; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -// Attr: [unsafe] -inline u32 hash__fnv1a__sum32_bytes(u8* data, int data_len) { - u32 hash = _const_hash__fnv1a__fnv32_offset_basis; - for (int i = 0; i < data_len; ++i) { - hash = ((hash ^ ((u32)(data[i])))) * _const_hash__fnv1a__fnv32_prime; - } - u32 _t1 = hash; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline u64 hash__fnv1a__sum64_string(string data) { - u64 hash = _const_hash__fnv1a__fnv64_offset_basis; - for (int i = 0; i < data.len; ++i) { - hash = ((hash ^ ((u64)(data.str[ i])))) * _const_hash__fnv1a__fnv64_prime; - } - u64 _t1 = hash; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -inline u64 hash__fnv1a__sum64(Array_u8 data) { - u64 hash = _const_hash__fnv1a__fnv64_offset_basis; - for (int i = 0; i < data.len; ++i) { - hash = ((hash ^ ((u64)(((u8*)data.data)[i])))) * _const_hash__fnv1a__fnv64_prime; - } - u64 _t1 = hash; - return _t1; -} - -// Attr: [direct_array_access] -// Attr: [inline] -// Attr: [unsafe] -inline u64 hash__fnv1a__sum64_bytes(u8* data, int data_len) { - u64 hash = _const_hash__fnv1a__fnv64_offset_basis; - for (int i = 0; i < data_len; ++i) { - hash = ((hash ^ ((u64)(data[i])))) * _const_hash__fnv1a__fnv64_prime; - } - u64 _t1 = hash; - return _t1; -} - -VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unknown flag `"), /*115 &string*/0xfe10, {.d_s = err.flag}}, {_SLIT("`"), 0, { .d_c = 0 }}})); - return _t1; -} - -VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err) { - if (err.want == 0) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Expected no arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; - } else if (err.got > err.want) { - string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Expected at most "), /*100 &int*/0xfe07, {.d_i32 = err.want}}, {_SLIT(" arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } else { - string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Expected at least "), /*100 &int*/0xfe07, {.d_i32 = err.want}}, {_SLIT(" arguments, but got "), /*100 &int*/0xfe07, {.d_i32 = err.got}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - return (string){.str=(byteptr)"", .is_lit=1}; -} - -// Attr: [unsafe] -VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f) { - { // Unsafe block - string_free(&f->name); - string_free(&f->usage); - string_free(&f->val_desc); - } -} - -string flag__Flag_str(flag__Flag f) { - string _t1 = string__plus(string__plus(string__plus(string__plus(_SLIT(" flag:\n"), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" name: "), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" abbr: `"), /*115 &string*/0xfe10, {.d_s = u8_ascii_str(f.abbr)}}, {_SLIT("`\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" usag: "), /*115 &string*/0xfe10, {.d_s = f.usage}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))), str_intp(2, _MOV((StrIntpData[]){{_SLIT(" desc: "), /*115 &string*/0xfe10, {.d_s = f.val_desc}}, {_SLIT0, 0, { .d_c = 0 }}}))); - return _t1; -} - -string Array_flag__Flag_str(Array_flag__Flag af) { - Array_string res = __new_array_with_default(0, 0, sizeof(string), 0); - array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT("\n []Flag = [")) })); - for (int _t2 = 0; _t2 < af.len; ++_t2) { - flag__Flag f = ((flag__Flag*)af.data)[_t2]; - array_push((array*)&res, _MOV((string[]){ string_clone(flag__Flag_str(f)) })); - } - array_push((array*)&res, _MOV((string[]){ string_clone(_SLIT(" ]")) })); - string _t5 = Array_string_join(res, _SLIT("\n")); - return _t5; -} - -// Attr: [unsafe] -VV_LOCAL_SYMBOL void flag__FlagParser_free(flag__FlagParser* f) { - { // Unsafe block - for (int _t1 = 0; _t1 < f->args.len; ++_t1) { - string a = ((string*)f->args.data)[_t1]; - string_free(&a); + if (ready_set.len == 0) { + v__depgraph__DepGraph* g = v__depgraph__new_dep_graph(); + g->acyclic = false; + for (int _t4 = 0; _t4 < node_deps.keys.len; ++_t4) { + string name = ((string*)node_deps.keys.data)[_t4]; + v__depgraph__DepGraph_add(g, name, v__depgraph__OrderedDepMap_get(&node_names, name)); + } + v__depgraph__DepGraph* _t5 = g; + return _t5; } - array_free(&f->args); - for (int _t2 = 0; _t2 < f->flags.len; ++_t2) { - flag__Flag flag = ((flag__Flag*)f->flags.data)[_t2]; - flag__Flag_free(&flag); + for (int _t6 = 0; _t6 < ready_set.len; ++_t6) { + string name = ((string*)ready_set.data)[_t6]; + v__depgraph__OrderedDepMap_delete(&node_deps, name); + Array_string resolved_deps = v__depgraph__OrderedDepMap_get(&node_names, name); + v__depgraph__DepGraph_add(resolved, name, resolved_deps); } - array_free(&f->flags); - string_free(&f->application_name); - string_free(&f->application_version); - string_free(&f->application_description); - string_free(&f->args_description); - } -} - -flag__FlagParser* flag__new_flag_parser(Array_string args) { - Array_string original_args = array_clone_to_depth(&args, 0); - int idx_dashdash = Array_string_index(args, _SLIT("--")); - Array_string all_before_dashdash = array_clone_to_depth(&args, 0); - Array_string all_after_dashdash = __new_array_with_default(0, 0, sizeof(string), 0); - if (idx_dashdash >= 0) { - array_trim(&all_before_dashdash, idx_dashdash); - if (idx_dashdash < original_args.len) { - Array_string _t1; - all_after_dashdash = (_t1 = original_args, array_slice(_t1, idx_dashdash + 1, _t1.len)); + for (int _t7 = 0; _t7 < node_deps.keys.len; ++_t7) { + string name = ((string*)node_deps.keys.data)[_t7]; + v__depgraph__OrderedDepMap_apply_diff(&node_deps, name, ready_set); } } - flag__FlagParser* _t2 = ((flag__FlagParser*)memdup(&(flag__FlagParser){.original_args = original_args,.idx_dashdash = idx_dashdash,.all_after_dashdash = all_after_dashdash,.usage_examples = __new_array(0, 0, sizeof(string)),.default_help_label = _SLIT("display this help and exit"),.default_version_label = _SLIT("output version information and exit"),.args = all_before_dashdash,.max_free_args = _const_flag__max_args_number,.flags = __new_array(0, 0, sizeof(flag__Flag)),.application_name = (string){.str=(byteptr)"", .is_lit=1},.application_version = (string){.str=(byteptr)"", .is_lit=1},.application_description = (string){.str=(byteptr)"", .is_lit=1},.min_free_args = 0,.args_description = (string){.str=(byteptr)"", .is_lit=1},.allow_unknown_args = 0,.footers = __new_array(0, 0, sizeof(string)),}, sizeof(flag__FlagParser))); - return _t2; -} - -void flag__FlagParser_usage_example(flag__FlagParser* fs, string example) { - array_push((array*)&fs->usage_examples, _MOV((string[]){ string_clone(example) })); -} - -void flag__FlagParser_footer(flag__FlagParser* fs, string footer) { - array_push((array*)&fs->footers, _MOV((string[]){ string_clone(footer) })); -} - -void flag__FlagParser_application(flag__FlagParser* fs, string name) { - fs->application_name = name; -} - -void flag__FlagParser_version(flag__FlagParser* fs, string vers) { - fs->application_version = vers; -} - -void flag__FlagParser_description(flag__FlagParser* fs, string desc) { - if (fs->application_description.len == 0) { - fs->application_description = desc; - } else { - fs->application_description = /*f*/string__plus(fs->application_description, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = desc}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } -} - -void flag__FlagParser_skip_executable(flag__FlagParser* fs) { - array_delete(&fs->args, 0); -} - -void flag__FlagParser_allow_unknown_args(flag__FlagParser* fs) { - fs->allow_unknown_args = true; -} - -VV_LOCAL_SYMBOL void flag__FlagParser_add_flag(flag__FlagParser* fs, string name, u8 abbr, string usage, string desc) { - array_push((array*)&fs->flags, _MOV((flag__Flag[]){ ((flag__Flag){.name = name,.abbr = abbr,.usage = usage,.val_desc = desc,}) })); -} - -// Attr: [manualfree] -VV_LOCAL_SYMBOL Array_string flag__FlagParser_parse_value(flag__FlagParser* fs, string longhand, u8 shorthand) { -bool flag__FlagParser_parse_value_defer_0 = false; -string full; -bool flag__FlagParser_parse_value_defer_1 = false; -Array_int to_delete; - full = str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT0, 0, { .d_c = 0 }}})); - flag__FlagParser_parse_value_defer_0 = true; - Array_string found_entries = __new_array_with_default(0, 0, sizeof(string), 0); - to_delete = __new_array_with_default(0, 0, sizeof(int), 0); - flag__FlagParser_parse_value_defer_1 = true; - bool should_skip_one = false; - for (int i = 0; i < fs->args.len; ++i) { - string arg = ((string*)fs->args.data)[i]; - if (should_skip_one) { - should_skip_one = false; - continue; - } - if (arg.len == 0 || string_at(arg, 0) != '-') { - continue; - } - if ((arg.len == 2 && string_at(arg, 0) == '-' && string_at(arg, 1) == shorthand) || string__eq(arg, full)) { - if (i + 1 >= fs->args.len) { - Array_string _t1 = __new_array_with_default(0, 0, sizeof(string), 0); - // Defer begin - if (flag__FlagParser_parse_value_defer_1) { - array_free(&to_delete); - } - // Defer end - // Defer begin - if (flag__FlagParser_parse_value_defer_0) { - string_free(&full); - } - // Defer end - return _t1; - } - string nextarg = (*(string*)/*ee elem_sym */array_get(fs->args, i + 1)); - if (nextarg.len > 2) { - string nextarg_rest = string_substr(nextarg, 0, 2); - if (string__eq(nextarg_rest, _SLIT("--"))) { - string_free(&nextarg_rest); - Array_string _t2 = __new_array_with_default(0, 0, sizeof(string), 0); - // Defer begin - if (flag__FlagParser_parse_value_defer_1) { - array_free(&to_delete); - } - // Defer end - // Defer begin - if (flag__FlagParser_parse_value_defer_0) { - string_free(&full); - } - // Defer end - return _t2; - } - string_free(&nextarg_rest); - } - array_push((array*)&found_entries, _MOV((string[]){ string_clone((*(string*)/*ee elem_sym */array_get(fs->args, i + 1))) })); - array_push((array*)&to_delete, _MOV((int[]){ i })); - array_push((array*)&to_delete, _MOV((int[]){ i + 1 })); - should_skip_one = true; - continue; - } - if (arg.len > full.len + 1 && string__eq(string_substr(arg, 0, full.len + 1), str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = full}}, {_SLIT("="), 0, { .d_c = 0 }}})))) { - array_push((array*)&found_entries, _MOV((string[]){ string_clone(string_substr(arg, full.len + 1, (arg).len)) })); - array_push((array*)&to_delete, _MOV((int[]){ i })); - continue; - } - } - for (int i = 0; i < to_delete.len; ++i) { - int del = ((int*)to_delete.data)[i]; - array_delete(&fs->args, del - i); - } - Array_string _t8 = found_entries; - // Defer begin - if (flag__FlagParser_parse_value_defer_1) { - array_free(&to_delete); - } - // Defer end - // Defer begin - if (flag__FlagParser_parse_value_defer_0) { - string_free(&full); - } - // Defer end + v__depgraph__DepGraph* _t8 = resolved; return _t8; } -VV_LOCAL_SYMBOL _option_string flag__FlagParser_parse_bool_value(flag__FlagParser* fs, string longhand, u8 shorthand) { - { - string full = str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT0, 0, { .d_c = 0 }}})); - for (int i = 0; i < fs->args.len; ++i) { - string arg = ((string*)fs->args.data)[i]; - if (arg.len == 0) { - continue; - } - if (string_at(arg, 0) != '-') { - continue; - } - if ((arg.len == 2 && string_at(arg, 0) == '-' && string_at(arg, 1) == shorthand) || string__eq(arg, full)) { - if (fs->args.len > i + 1 && ((string__eq((*(string*)/*ee elem_sym */array_get(fs->args, i + 1)), _SLIT("true")) || string__eq((*(string*)/*ee elem_sym */array_get(fs->args, i + 1)), _SLIT("false"))))) { - string val = (*(string*)/*ee elem_sym */array_get(fs->args, i + 1)); - array_delete(&fs->args, i + 1); - array_delete(&fs->args, i); - _option_string _t1; - opt_ok2(&(string[]) { val }, (_option*)(&_t1), sizeof(string)); - return _t1; - } else { - array_delete(&fs->args, i); - _option_string _t2; - opt_ok2(&(string[]) { _SLIT("true") }, (_option*)(&_t2), sizeof(string)); - return _t2; - } - } - if (arg.len > full.len + 1 && string__eq(string_substr(arg, 0, full.len + 1), str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = full}}, {_SLIT("="), 0, { .d_c = 0 }}})))) { - string val = string_substr(arg, full.len + 1, (arg).len); - array_delete(&fs->args, i); - _option_string _t3; - opt_ok2(&(string[]) { val }, (_option*)(&_t3), sizeof(string)); - return _t3; - } - if (arg.len > 1 && string_at(arg, 0) == '-' && string_at(arg, 1) != '-' && string_index_u8(arg, shorthand) != -1) { - _option_string _t4; - opt_ok2(&(string[]) { _SLIT("true") }, (_option*)(&_t4), sizeof(string)); - return _t4; - } - } - } - return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = longhand}}, {_SLIT("' not found"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -_option_bool flag__FlagParser_bool_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { - bool res = false; - { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - _option_string _t1 = flag__FlagParser_parse_bool_value(fs, name, abbr); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_bool){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - string parsed = (*(string*)_t1.data); - res = string__eq(parsed, _SLIT("true")); - } - _option_bool _t3; - opt_ok2(&(bool[]) { res }, (_option*)(&_t3), sizeof(bool)); - return _t3; -} - -bool flag__FlagParser_bool(flag__FlagParser* fs, string name, u8 abbr, bool bdefault, string usage) { - _option_bool _t1 = flag__FlagParser_bool_opt(fs, name, abbr, usage); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - bool _t2 = bdefault; - return _t2; - } - - bool value = (*(bool*)_t1.data); - bool _t3 = value; - return _t3; -} - -Array_int flag__FlagParser_int_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); - Array_int value = __new_array_with_default(0, 0, sizeof(int), 0); - for (int _t1 = 0; _t1 < parsed.len; ++_t1) { - string val = ((string*)parsed.data)[_t1]; - array_push((array*)&value, _MOV((int[]){ string_int(val) })); - } - Array_int _t3 = value; - return _t3; -} - -_option_int flag__FlagParser_int_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { - int res = 0; - { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); - if (parsed.len == 0) { - return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string parsed0 = (*(string*)/*ee elem_sym */array_get(parsed, 0)); - res = string_int(parsed0); - } - _option_int _t2; - opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); - return _t2; -} - -int flag__FlagParser_int(flag__FlagParser* fs, string name, u8 abbr, int idefault, string usage) { - _option_int _t1 = flag__FlagParser_int_opt(fs, name, abbr, usage); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - int _t2 = idefault; - return _t2; - } - - int value = (*(int*)_t1.data); - int _t3 = value; - return _t3; -} - -Array_f64 flag__FlagParser_float_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); - Array_f64 value = __new_array_with_default(0, 0, sizeof(f64), 0); - for (int _t1 = 0; _t1 < parsed.len; ++_t1) { - string val = ((string*)parsed.data)[_t1]; - array_push((array*)&value, _MOV((f64[]){ string_f64(val) })); - } - Array_f64 _t3 = value; - return _t3; -} - -_option_f64 flag__FlagParser_float_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { - f64 res = 0.0; - { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); - if (parsed.len == 0) { - return (_option_f64){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - res = string_f64((*(string*)/*ee elem_sym */array_get(parsed, 0))); - } - _option_f64 _t2; - opt_ok2(&(f64[]) { res }, (_option*)(&_t2), sizeof(f64)); - return _t2; -} - -f64 flag__FlagParser_float(flag__FlagParser* fs, string name, u8 abbr, f64 fdefault, string usage) { - _option_f64 _t1 = flag__FlagParser_float_opt(fs, name, abbr, usage); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - f64 _t2 = fdefault; - return _t2; - } - - f64 value = (*(f64*)_t1.data); - f64 _t3 = value; - return _t3; -} - -Array_string flag__FlagParser_string_multi(flag__FlagParser* fs, string name, u8 abbr, string usage) { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string _t1 = flag__FlagParser_parse_value(fs, name, abbr); +v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph) { + v__depgraph__DepGraphNode _t1 = (*(v__depgraph__DepGraphNode*)/*ee elem_sym */array_get(graph->nodes, graph->nodes.len - 1)); return _t1; } -_option_string flag__FlagParser_string_opt(flag__FlagParser* fs, string name, u8 abbr, string usage) { - string res = _SLIT(""); - { - flag__FlagParser_add_flag(fs, name, abbr, usage, _SLIT("")); - Array_string parsed = flag__FlagParser_parse_value(fs, name, abbr); - if (parsed.len == 0) { - return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("parameter '"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("' not provided"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - res = (*(string*)/*ee elem_sym */array_get(parsed, 0)); - } - _option_string _t2; - opt_ok2(&(string[]) { res }, (_option*)(&_t2), sizeof(string)); - return _t2; -} - -string flag__FlagParser_string(flag__FlagParser* fs, string name, u8 abbr, string sdefault, string usage) { - _option_string _t1 = flag__FlagParser_string_opt(fs, name, abbr, usage); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - string _t2 = sdefault; - return _t2; - } - - string value = (*(string*)_t1.data); - string _t3 = value; - return _t3; -} - -_option_void flag__FlagParser_limit_free_args_to_at_least(flag__FlagParser* fs, int n) { - if (n > _const_flag__max_args_number) { - return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args_to_at_least expect n to be smaller than "), /*100 &int literal*/0xfe07, {.d_i32 = _const_flag__max_args_number}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (n <= 0) { - return (_option_void){ .state=2, .err=_v_error(_SLIT("flag.limit_free_args_to_at_least expect n to be a positive number")), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - fs->min_free_args = n; - return (_option_void){0}; -} - -_option_void flag__FlagParser_limit_free_args_to_exactly(flag__FlagParser* fs, int n) { - if (n > _const_flag__max_args_number) { - return (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args_to_exactly expect n to be smaller than "), /*100 &int literal*/0xfe07, {.d_i32 = _const_flag__max_args_number}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (n < 0) { - return (_option_void){ .state=2, .err=_v_error(_SLIT("flag.limit_free_args_to_exactly expect n to be a non negative number")), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - fs->min_free_args = n; - fs->max_free_args = n; - return (_option_void){0}; -} - -_option_void flag__FlagParser_limit_free_args(flag__FlagParser* fs, int min, int max) { - if (min > max) { - return (_option_void){ .state=2, .err=_v_error( str_intp(3, _MOV((StrIntpData[]){{_SLIT("flag.limit_free_args expect min < max, got "), /*100 &int*/0xfe07, {.d_i32 = min}}, {_SLIT(" >= "), /*100 &int*/0xfe07, {.d_i32 = max}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - fs->min_free_args = min; - fs->max_free_args = max; - return (_option_void){0}; -} - -void flag__FlagParser_arguments_description(flag__FlagParser* fs, string description) { - fs->args_description = description; -} - -string flag__FlagParser_usage(flag__FlagParser* fs) { - bool positive_min_arg = (fs->min_free_args > 0); - bool positive_max_arg = (fs->max_free_args > 0 && fs->max_free_args != _const_flag__max_args_number); - bool no_arguments = (fs->min_free_args == 0 && fs->max_free_args == 0); - string adesc = (fs->args_description.len > 0 ? (fs->args_description) : (_SLIT("[ARGS]"))); - if (no_arguments) { - adesc = _SLIT(""); - } - Array_string use = __new_array_with_default(0, 0, sizeof(string), 0); - if ((fs->application_version).len != 0) { - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fs->application_version}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_flag__underline}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - if (fs->usage_examples.len == 0) { - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Usage: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" [options] "), /*115 &string*/0xfe10, {.d_s = adesc}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } else { - for (int i = 0; i < fs->usage_examples.len; ++i) { - string example = ((string*)fs->usage_examples.data)[i]; - if (i == 0) { - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("Usage: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = example}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } else { - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" or: "), /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = example}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } +string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph) { + Array_string out = __new_array_with_default(0, 0, sizeof(string), 0); + for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; + for (int _t2 = 0; _t2 < node.deps.len; ++_t2) { + string dep = ((string*)node.deps.data)[_t2]; + array_push((array*)&out, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" * "), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = dep}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); } } - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); - if ((fs->application_description).len != 0) { - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Description: "), /*115 &string*/0xfe10, {.d_s = fs->application_description}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); - } - if (positive_min_arg || positive_max_arg || no_arguments) { - if (no_arguments) { - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("This application does not expect any arguments")) })); - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); - } else { - Array_string s = __new_array_with_default(0, 0, sizeof(string), 0); - if (positive_min_arg) { - array_push((array*)&s, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("at least "), /*100 &int*/0xfe07, {.d_i32 = fs->min_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - if (positive_max_arg) { - array_push((array*)&s, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("at most "), /*100 &int*/0xfe07, {.d_i32 = fs->max_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - if (positive_min_arg && positive_max_arg && fs->min_free_args == fs->max_free_args) { - s = new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){ str_intp(2, _MOV((StrIntpData[]){{_SLIT("exactly "), /*100 &int*/0xfe07, {.d_i32 = fs->min_free_args}}, {_SLIT0, 0, { .d_c = 0 }}}))})); - } - string sargs = Array_string_join(s, _SLIT(" and ")); - array_push((array*)&use, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("The arguments should be "), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(" in number."), 0, { .d_c = 0 }}}))) })); - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("")) })); - } - } - if (fs->flags.len > 0) { - array_push((array*)&use, _MOV((string[]){ string_clone(_SLIT("Options:")) })); - for (int _t16 = 0; _t16 < fs->flags.len; ++_t16) { - flag__Flag f = ((flag__Flag*)fs->flags.data)[_t16]; - Array_string onames = __new_array_with_default(0, 0, sizeof(string), 0); - if (f.abbr != 0) { - array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*115 &string*/0xfe10, {.d_s = u8_ascii_str(f.abbr)}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - if ((f.name).len != 0) { - if (!string_contains(f.val_desc, _SLIT(""))) { - array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = f.val_desc}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } else { - array_push((array*)&onames, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("--"), /*115 &string*/0xfe10, {.d_s = f.name}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - } - string option_names = string__plus(_SLIT(" "), Array_string_join(onames, _SLIT(", "))); - string xspace = _SLIT(""); - if (option_names.len > _const_flag__space.len - 2) { - xspace = str_intp(2, _MOV((StrIntpData[]){{_SLIT("\n"), /*115 &string*/0xfe10, {.d_s = _const_flag__space}}, {_SLIT0, 0, { .d_c = 0 }}})); - } else { - xspace = string_substr(_const_flag__space, option_names.len, (_const_flag__space).len); - } - string fdesc = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = option_names}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = xspace}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = f.usage}}, {_SLIT0, 0, { .d_c = 0 }}})); - array_push((array*)&use, _MOV((string[]){ string_clone(fdesc) })); - } - } - for (int _t21 = 0; _t21 < fs->footers.len; ++_t21) { - string footer = ((string*)fs->footers.data)[_t21]; - array_push((array*)&use, _MOV((string[]){ string_clone(footer) })); - } - string _t23 = string_replace(Array_string_join(use, _SLIT("\n")), _SLIT("- ,"), _SLIT(" ")); - return _t23; + string _t4 = Array_string_join(out, _SLIT("\n")); + return _t4; } -VV_LOCAL_SYMBOL _option_flag__Flag flag__FlagParser_find_existing_flag(flag__FlagParser* fs, string fname) { - for (int _t1 = 0; _t1 < fs->flags.len; ++_t1) { - flag__Flag f = ((flag__Flag*)fs->flags.data)[_t1]; - if (string__eq(f.name, fname)) { - _option_flag__Flag _t2; - opt_ok2(&(flag__Flag[]) { f }, (_option*)(&_t2), sizeof(flag__Flag)); - return _t2; +string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph) { + bool seen = false; + Array_string out = __new_array_with_default(0, 0, sizeof(string), 0); + v__depgraph__NodeNames nn = ((v__depgraph__NodeNames){.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.names = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}); + for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; + map_set(&nn.names, &(string[]){node.name}, &(Array_string[]) { node.deps }); + } + Map_string_Array_string _t2 = nn.names; + int _t4 = _t2.key_values.len; + for (int _t3 = 0; _t3 < _t4; ++_t3 ) { + int _t5 = _t2.key_values.len - _t4; + _t4 = _t2.key_values.len; + if (_t5 < 0) { + _t3 = -1; + continue; + } + if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} + string k = /*key*/ *(string*)DenseArray_key(&_t2.key_values, _t3); + k = string_clone(k); + Array_string cycle_names = __new_array_with_default(0, 0, sizeof(string), 0); + if (_IN_MAP(ADDR(string, k), ADDR(map, nn.is_cycle))) { + continue; + } + multi_return_bool_Array_string mr_3360 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); + seen = mr_3360.arg0; + cycle_names = mr_3360.arg1; + if (seen) { + array_push((array*)&out, _MOV((string[]){ string_clone(string__plus(_SLIT(" * "), Array_string_join(cycle_names, _SLIT(" -> ")))) })); + nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; } } - return (_option_flag__Flag){ .state=2, .err=_v_error(_SLIT("no such flag")), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -VV_LOCAL_SYMBOL void flag__FlagParser_handle_builtin_options(flag__FlagParser* fs) { - bool show_version = false; - bool show_help = false; - _option_flag__Flag _t1 = flag__FlagParser_find_existing_flag(fs, _SLIT("help")); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - show_help = flag__FlagParser_bool(fs, _SLIT("help"), 'h', false, fs->default_help_label); - } - - (*(flag__Flag*)_t1.data); - _option_flag__Flag _t2 = flag__FlagParser_find_existing_flag(fs, _SLIT("version")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - show_version = flag__FlagParser_bool(fs, _SLIT("version"), 0, false, fs->default_version_label); - } - - (*(flag__Flag*)_t2.data); - if (show_help) { - println(flag__FlagParser_usage(fs)); - _v_exit(0); - VUNREACHABLE(); - } - if (show_version) { - println( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fs->application_name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = fs->application_version}}, {_SLIT0, 0, { .d_c = 0 }}}))); - _v_exit(0); - VUNREACHABLE(); - } -} - -_option_Array_string flag__FlagParser_finalize(flag__FlagParser* fs) { - flag__FlagParser_handle_builtin_options(fs); - Array_string remaining = array_clone_to_depth(&fs->args, 0); - if (!fs->allow_unknown_args) { - for (int _t1 = 0; _t1 < remaining.len; ++_t1) { - string a = ((string*)remaining.data)[_t1]; - if ((a.len >= 2 && string__eq(string_substr(a, 0, 2), _SLIT("--"))) || (a.len == 2 && string_at(a, 0) == '-')) { - return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__UnkownFlagError_to_Interface_IError(((flag__UnkownFlagError*)memdup(&(flag__UnkownFlagError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.flag = a,}, sizeof(flag__UnkownFlagError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - } - } - if (remaining.len < fs->min_free_args && fs->min_free_args > 0) { - return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = fs->min_free_args,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (remaining.len > fs->max_free_args && fs->max_free_args > 0) { - return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = fs->max_free_args,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (remaining.len > 0 && fs->max_free_args == 0 && fs->min_free_args == 0) { - return (_option_Array_string){ .state=2, .err=/*&IError*/I_flag__ArgsCountError_to_Interface_IError(((flag__ArgsCountError*)memdup(&(flag__ArgsCountError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.got = remaining.len,.want = 0,}, sizeof(flag__ArgsCountError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _PUSH_MANY(&remaining, (fs->all_after_dashdash), _t6, Array_string); - _option_Array_string _t7; - opt_ok2(&(Array_string[]) { remaining }, (_option*)(&_t7), sizeof(Array_string)); + string _t7 = Array_string_join(out, _SLIT("\n")); return _t7; } -Array_string flag__FlagParser_remaining_parameters(flag__FlagParser* fs) { - _option_Array_string _t2 = flag__FlagParser_finalize(fs); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - eprintln(IError_name_table[err._typ]._method_msg(err._object)); - println(flag__FlagParser_usage(fs)); - _v_exit(1); - VUNREACHABLE(); - ; +VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen) { + bool seen = false; + Array_string new_already_seen = array_clone_to_depth(&already_seen, 0); + if (_IN_MAP(ADDR(string, name), ADDR(map, nn->is_cycle))) { + return (multi_return_bool_Array_string){.arg0=(*(bool*)map_get(ADDR(map, nn->is_cycle), &(string[]){name}, &(bool[]){ 0 })), .arg1=new_already_seen}; } - - Array_string _t1 = (*(Array_string*)_t2.data); - return _t1; + if (Array_string_contains(already_seen, name)) { + array_push((array*)&new_already_seen, _MOV((string[]){ string_clone(name) })); + map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); + return (multi_return_bool_Array_string){.arg0=true, .arg1=new_already_seen}; + } + array_push((array*)&new_already_seen, _MOV((string[]){ string_clone(name) })); + Array_string deps = (*(Array_string*)map_get(ADDR(map, nn->names), &(string[]){name}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); + if (deps.len == 0) { + map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { false }); + return (multi_return_bool_Array_string){.arg0=false, .arg1=new_already_seen}; + } + for (int _t6 = 0; _t6 < deps.len; ++_t6) { + string d = ((string*)deps.data)[_t6]; + Array_string d_already_seen = array_clone_to_depth(&new_already_seen, 0); + multi_return_bool_Array_string mr_4093 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); + seen = mr_4093.arg0; + d_already_seen = mr_4093.arg1; + if (seen) { + new_already_seen = array_clone_to_depth(&d_already_seen, 0); + map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); + return (multi_return_bool_Array_string){.arg0=true, .arg1=new_already_seen}; + } + } + map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { false }); + return (multi_return_bool_Array_string){.arg0=false, .arg1=new_already_seen}; +} + +void v__depgraph__show(v__depgraph__DepGraph* graph, string path) { + v__dotgraph__DotGraph* dg = v__dotgraph__new(_SLIT("ModGraph"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("ModGraph for "), /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT0, 0, { .d_c = 0 }}})), _SLIT("blue")); + string mbuiltin = _SLIT("builtin"); + for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { + v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; + bool is_main = string__eq(node.name, _SLIT("main")); + v__dotgraph__DotGraph_new_node(dg, node.name, ((v__dotgraph__NewNodeConfig){.node_name = (string){.str=(byteptr)"", .is_lit=1},.should_highlight = is_main,.tooltip = (string){.str=(byteptr)"", .is_lit=1},.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); + Array_string deps = array_clone_to_depth(&node.deps, 0); + if (!string__eq(node.name, mbuiltin) && !Array_string_contains(deps, mbuiltin)) { + array_push((array*)&deps, _MOV((string[]){ string_clone(mbuiltin) })); + } + for (int _t3 = 0; _t3 < deps.len; ++_t3) { + string dep = ((string*)deps.data)[_t3]; + v__dotgraph__DotGraph_new_edge(dg, node.name, dep, ((v__dotgraph__NewEdgeConfig){.should_highlight = is_main,.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); + } + } + v__dotgraph__DotGraph_finish(dg); } // Attr: [inline] -inline VV_LOCAL_SYMBOL bool semver__version_satisfies(semver__Version ver, string input) { - _option_semver__Range _t1 = semver__parse_range(input); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - bool _t2 = false; - return _t2; +inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { + u32 _t1 = prev * 1664525U + 1013904223U; + return _t1; +} + +Array_u32 rand__seed__time_seed_array(int count) { + u64 ctime = time__sys_mono_now(); + u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); + Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); + for (int _t1 = 0; _t1 < count; ++_t1) { + seed = rand__seed__nr_next(seed); + array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); } - - semver__Range range = (*(semver__Range*)_t1.data); - bool _t3 = semver__Range_satisfies(range, ver); + Array_u32 _t3 = seed_data; return _t3; } -VV_LOCAL_SYMBOL bool semver__compare_eq(semver__Version v1, semver__Version v2) { - bool _t1 = v1.major == v2.major && v1.minor == v2.minor && v1.patch == v2.patch && string__eq(v1.prerelease, v2.prerelease); +// Attr: [manualfree] +u32 rand__seed__time_seed_32(void) { + Array_u32 sa = rand__seed__time_seed_array(1); + u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); + array_free(&sa); + u32 _t1 = res; return _t1; } -VV_LOCAL_SYMBOL bool semver__compare_gt(semver__Version v1, semver__Version v2) { - if (v1.major < v2.major) { - bool _t1 = false; - return _t1; - } - if (v1.major > v2.major) { - bool _t2 = true; - return _t2; - } - if (v1.minor < v2.minor) { - bool _t3 = false; - return _t3; - } - if (v1.minor > v2.minor) { - bool _t4 = true; - return _t4; - } - bool _t5 = v1.patch > v2.patch; - return _t5; -} - -VV_LOCAL_SYMBOL bool semver__compare_lt(semver__Version v1, semver__Version v2) { - if (v1.major > v2.major) { - bool _t1 = false; - return _t1; - } - if (v1.major < v2.major) { - bool _t2 = true; - return _t2; - } - if (v1.minor > v2.minor) { - bool _t3 = false; - return _t3; - } - if (v1.minor < v2.minor) { - bool _t4 = true; - return _t4; - } - bool _t5 = v1.patch < v2.patch; - return _t5; -} - -VV_LOCAL_SYMBOL bool semver__compare_ge(semver__Version v1, semver__Version v2) { - if (semver__compare_eq(v1, v2)) { - bool _t1 = true; - return _t1; - } - bool _t2 = semver__compare_gt(v1, v2); - return _t2; -} - -VV_LOCAL_SYMBOL bool semver__compare_le(semver__Version v1, semver__Version v2) { - if (semver__compare_eq(v1, v2)) { - bool _t1 = true; - return _t1; - } - bool _t2 = semver__compare_lt(v1, v2); - return _t2; -} - -VV_LOCAL_SYMBOL semver__RawVersion semver__parse(string input) { - string raw_version = input; - string prerelease = _SLIT(""); - string metadata = _SLIT(""); - _option_int _t1 = string_last_index(raw_version, _SLIT("+")); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - *(int*) _t1.data = -1; - } - - int plus_idx = (*(int*)_t1.data); - if (plus_idx > 0) { - metadata = string_substr(raw_version, (plus_idx + 1), (raw_version).len); - raw_version = string_substr(raw_version, 0, plus_idx); - } - _option_int _t2 = string_index(raw_version, _SLIT("-")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(int*) _t2.data = -1; - } - - int hyphen_idx = (*(int*)_t2.data); - if (hyphen_idx > 0) { - prerelease = string_substr(raw_version, (hyphen_idx + 1), (raw_version).len); - raw_version = string_substr(raw_version, 0, hyphen_idx); - } - Array_string raw_ints = string_split(raw_version, _SLIT(".")); - semver__RawVersion _t3 = ((semver__RawVersion){.prerelease = prerelease,.metadata = metadata,.raw_ints = raw_ints,}); - return _t3; -} - -VV_LOCAL_SYMBOL bool semver__RawVersion_is_valid(semver__RawVersion ver) { - if (ver.raw_ints.len != 3) { - bool _t1 = false; - return _t1; - } - bool _t2 = semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_major))) && semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_minor))) && semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_patch))) && semver__is_valid_string(ver.prerelease) && semver__is_valid_string(ver.metadata); - return _t2; -} - -VV_LOCAL_SYMBOL bool semver__RawVersion_is_missing(semver__RawVersion ver, int typ) { - bool _t1 = typ >= ver.raw_ints.len - 1; +// Attr: [manualfree] +u64 rand__seed__time_seed_64(void) { + Array_u32 seed_data = rand__seed__time_seed_array(2); + u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); + u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); + array_free(&seed_data); + u64 res = (lower | (upper << 32U)); + u64 _t1 = res; return _t1; } -VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_coerce(semver__RawVersion raw_ver) { - semver__RawVersion ver = semver__RawVersion_complete(raw_ver); - if (!semver__is_valid_number((*(string*)/*ee elem_sym */array_get(ver.raw_ints, _const_semver__ver_major)))) { - return (_option_semver__Version){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid major version: "), /*115 &[]string*/0xfe10, {.d_s = Array_string_str(ver.raw_ints)}}, {_SLIT("[ver_major]"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_semver__Version _t2; - opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(ver) }, (_option*)(&_t2), sizeof(semver__Version)); - return _t2; -} - -VV_LOCAL_SYMBOL semver__RawVersion semver__RawVersion_complete(semver__RawVersion raw_ver) { - Array_string raw_ints = raw_ver.raw_ints; - for (;;) { - if (!(raw_ints.len < 3)) break; - array_push((array*)&raw_ints, _MOV((string[]){ string_clone(_SLIT("0")) })); - } - semver__RawVersion _t2 = ((semver__RawVersion){.prerelease = raw_ver.prerelease,.metadata = raw_ver.metadata,.raw_ints = raw_ints,}); - return _t2; -} - -VV_LOCAL_SYMBOL _option_semver__Version semver__RawVersion_validate(semver__RawVersion raw_ver) { - if (!semver__RawVersion_is_valid(raw_ver)) { - return (_option_semver__Version){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_semver__Version _t2; - opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(raw_ver) }, (_option*)(&_t2), sizeof(semver__Version)); - return _t2; -} - -VV_LOCAL_SYMBOL semver__Version semver__RawVersion_to_version(semver__RawVersion raw_ver) { - semver__Version _t1 = ((semver__Version){.major = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_major))),.minor = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_minor))),.patch = string_int((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, _const_semver__ver_patch))),.prerelease = raw_ver.prerelease,.metadata = raw_ver.metadata,}); - return _t1; -} - -VV_LOCAL_SYMBOL bool semver__Range_satisfies(semver__Range r, semver__Version ver) { - bool final_result = false; - for (int _t1 = 0; _t1 < r.comparator_sets.len; ++_t1) { - semver__ComparatorSet set = ((semver__ComparatorSet*)r.comparator_sets.data)[_t1]; - final_result = final_result || semver__ComparatorSet_satisfies(set, ver); - } - bool _t2 = final_result; - return _t2; -} - -VV_LOCAL_SYMBOL bool semver__ComparatorSet_satisfies(semver__ComparatorSet set, semver__Version ver) { - for (int _t1 = 0; _t1 < set.comparators.len; ++_t1) { - semver__Comparator comp = ((semver__Comparator*)set.comparators.data)[_t1]; - if (!semver__Comparator_satisfies(comp, ver)) { - bool _t2 = false; - return _t2; - } - } - bool _t3 = true; - return _t3; -} - -VV_LOCAL_SYMBOL bool semver__Comparator_satisfies(semver__Comparator c, semver__Version ver) { - if (c.op == semver__Operator__gt) { - bool _t1 = semver__Version_gt(ver, c.ver); - return _t1; - } - if (c.op == semver__Operator__lt) { - bool _t2 = semver__Version_lt(ver, c.ver); - return _t2; - } - if (c.op == semver__Operator__ge) { - bool _t3 = semver__Version_ge(ver, c.ver); - return _t3; - } - if (c.op == semver__Operator__le) { - bool _t4 = semver__Version_le(ver, c.ver); - return _t4; - } - if (c.op == semver__Operator__eq) { - bool _t5 = semver__Version_eq(ver, c.ver); - return _t5; - } - bool _t6 = false; - return _t6; -} - -VV_LOCAL_SYMBOL _option_semver__Range semver__parse_range(string input) { - Array_string raw_comparator_sets = string_split(input, _const_semver__comparator_set_sep); - Array_semver__ComparatorSet comparator_sets = __new_array_with_default(0, 0, sizeof(semver__ComparatorSet), 0); - for (int _t1 = 0; _t1 < raw_comparator_sets.len; ++_t1) { - string raw_comp_set = ((string*)raw_comparator_sets.data)[_t1]; - if (semver__can_expand(raw_comp_set)) { - _option_semver__ComparatorSet _t2 = semver__expand_comparator_set(raw_comp_set); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (_option_semver__Range){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__ComparatorSet s = (*(semver__ComparatorSet*)_t2.data); - array_push((array*)&comparator_sets, _MOV((semver__ComparatorSet[]){ s })); - } else { - _option_semver__ComparatorSet _t5 = semver__parse_comparator_set(raw_comp_set); - if (_t5.state != 0) { /*or block*/ - IError err = _t5.err; - return (_option_semver__Range){ .state=2, .err=err, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__ComparatorSet s = (*(semver__ComparatorSet*)_t5.data); - array_push((array*)&comparator_sets, _MOV((semver__ComparatorSet[]){ s })); - } - } - _option_semver__Range _t8; - opt_ok2(&(semver__Range[]) { ((semver__Range){.comparator_sets = comparator_sets,}) }, (_option*)(&_t8), sizeof(semver__Range)); - return _t8; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__parse_comparator_set(string input) { - Array_string raw_comparators = string_split(input, _const_semver__comparator_sep); - if (raw_comparators.len > 2) { - return (_option_semver__ComparatorSet){ .state=2, .err=/*&IError*/I_semver__InvalidComparatorFormatError_to_Interface_IError(((semver__InvalidComparatorFormatError*)memdup(&(semver__InvalidComparatorFormatError){.MessageError = ((MessageError){.msg = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid format of comparator set for input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}})),.code = 0,}),}, sizeof(semver__InvalidComparatorFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Array_semver__Comparator comparators = __new_array_with_default(0, 0, sizeof(semver__Comparator), 0); - for (int _t2 = 0; _t2 < raw_comparators.len; ++_t2) { - string raw_comp = ((string*)raw_comparators.data)[_t2]; - _option_semver__Comparator _t3 = semver__parse_comparator(raw_comp); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - return (_option_semver__ComparatorSet){ .state=2, .err=/*&IError*/I_semver__InvalidComparatorFormatError_to_Interface_IError(((semver__InvalidComparatorFormatError*)memdup(&(semver__InvalidComparatorFormatError){.MessageError = ((MessageError){.msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("Invalid comparator \""), /*115 &string*/0xfe10, {.d_s = raw_comp}}, {_SLIT("\" in input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}})),.code = 0,}),}, sizeof(semver__InvalidComparatorFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Comparator c = (*(semver__Comparator*)_t3.data); - array_push((array*)&comparators, _MOV((semver__Comparator[]){ c })); - } - _option_semver__ComparatorSet _t6; - opt_ok2(&(semver__ComparatorSet[]) { ((semver__ComparatorSet){.comparators = comparators,}) }, (_option*)(&_t6), sizeof(semver__ComparatorSet)); - return _t6; -} - -VV_LOCAL_SYMBOL _option_semver__Comparator semver__parse_comparator(string input) { - semver__Operator op = semver__Operator__eq; - string raw_version = _SLIT(""); - if (string_starts_with(input, _SLIT(">="))) { - op = semver__Operator__ge; - raw_version = string_substr(input, 2, (input).len); - } else if (string_starts_with(input, _SLIT("<="))) { - op = semver__Operator__le; - raw_version = string_substr(input, 2, (input).len); - } else if (string_starts_with(input, _SLIT(">"))) { - op = semver__Operator__gt; - raw_version = string_substr(input, 1, (input).len); - } else if (string_starts_with(input, _SLIT("<"))) { - op = semver__Operator__lt; - raw_version = string_substr(input, 1, (input).len); - } else if (string_starts_with(input, _SLIT("="))) { - raw_version = string_substr(input, 1, (input).len); - } else { - raw_version = input; - } - _option_semver__Version _t1 = semver__coerce_version(raw_version); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_semver__Comparator){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version version = (*(semver__Version*)_t1.data); - _option_semver__Comparator _t3; - opt_ok2(&(semver__Comparator[]) { ((semver__Comparator){.ver = version,.op = op,}) }, (_option*)(&_t3), sizeof(semver__Comparator)); - return _t3; -} - -VV_LOCAL_SYMBOL _option_semver__Version semver__parse_xrange(string input) { - semver__RawVersion raw_ver = semver__RawVersion_complete(semver__parse(input)); - for (int _t1 = 0; _t1 < _const_semver__versions.len; ++_t1) { - int typ = ((int*)_const_semver__versions.data)[_t1]; - if (string_index_any((*(string*)/*ee elem_sym */array_get(raw_ver.raw_ints, typ)), _const_semver__x_range_symbols) == -1) { - continue; - } - - if (typ == (_const_semver__ver_major)) { - array_set(&raw_ver.raw_ints, _const_semver__ver_major, &(string[]) { _SLIT("0") }); - array_set(&raw_ver.raw_ints, _const_semver__ver_minor, &(string[]) { _SLIT("0") }); - array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); - } - else if (typ == (_const_semver__ver_minor)) { - array_set(&raw_ver.raw_ints, _const_semver__ver_minor, &(string[]) { _SLIT("0") }); - array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); - } - else if (typ == (_const_semver__ver_patch)) { - array_set(&raw_ver.raw_ints, _const_semver__ver_patch, &(string[]) { _SLIT("0") }); - } - else { - }; - } - if (!semver__RawVersion_is_valid(raw_ver)) { - return (_option_semver__Version){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_semver__Version _t3; - opt_ok2(&(semver__Version[]) { semver__RawVersion_to_version(raw_ver) }, (_option*)(&_t3), sizeof(semver__Version)); - return _t3; -} - -VV_LOCAL_SYMBOL bool semver__can_expand(string input) { - bool _t1 = string_at(input, 0) == '~' || string_at(input, 0) == '^' || string_contains(input, _const_semver__hyphen_range_sep) || string_index_any(input, _const_semver__x_range_symbols) > -1; - return _t1; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_comparator_set(string input) { - u8 _t1 = string_at(input, 0); - - if (_t1 == ('~')) { - _option_semver__ComparatorSet _t2 = semver__expand_tilda(string_substr(input, 1, (input).len)); - return _t2; - } - else if (_t1 == ('^')) { - _option_semver__ComparatorSet _t3 = semver__expand_caret(string_substr(input, 1, (input).len)); - return _t3; - } - else { - }; - if (string_contains(input, _const_semver__hyphen_range_sep)) { - _option_semver__ComparatorSet _t4 = semver__expand_hyphen(input); - return _t4; - } - _option_semver__ComparatorSet _t5 = semver__expand_xrange(input); - return _t5; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_tilda(string raw_version) { - _option_semver__Version _t1 = semver__coerce_version(raw_version); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version min_ver = (*(semver__Version*)_t1.data); - semver__Version max_ver = min_ver; - if (min_ver.minor == 0 && min_ver.patch == 0) { - max_ver = semver__Version_increment(min_ver, semver__Increment__major); - } else { - max_ver = semver__Version_increment(min_ver, semver__Increment__minor); - } - _option_semver__ComparatorSet _t3; - opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); - return _t3; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_caret(string raw_version) { - _option_semver__Version _t1 = semver__coerce_version(raw_version); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version min_ver = (*(semver__Version*)_t1.data); - semver__Version max_ver = min_ver; - if (min_ver.major == 0) { - max_ver = semver__Version_increment(min_ver, semver__Increment__minor); - } else { - max_ver = semver__Version_increment(min_ver, semver__Increment__major); - } - _option_semver__ComparatorSet _t3; - opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); - return _t3; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_hyphen(string raw_range) { - Array_string raw_versions = string_split(raw_range, _const_semver__hyphen_range_sep); - if (raw_versions.len != 2) { - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_semver__Version _t2 = semver__coerce_version((*(string*)/*ee elem_sym */array_get(raw_versions, 0))); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version min_ver = (*(semver__Version*)_t2.data); - semver__RawVersion raw_max_ver = semver__parse((*(string*)/*ee elem_sym */array_get(raw_versions, 1))); - if (semver__RawVersion_is_missing(raw_max_ver, _const_semver__ver_major)) { - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_semver__Version _t5 = semver__RawVersion_coerce(raw_max_ver); - if (_t5.state != 0) { /*or block*/ - IError err = _t5.err; - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version max_ver = (*(semver__Version*)_t5.data); - if (semver__RawVersion_is_missing(raw_max_ver, _const_semver__ver_minor)) { - max_ver = semver__Version_increment(max_ver, semver__Increment__minor); - _option_semver__ComparatorSet _t7; - opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t7), sizeof(semver__ComparatorSet)); - return _t7; - } - _option_semver__ComparatorSet _t8; - opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_le(min_ver, max_ver) }, (_option*)(&_t8), sizeof(semver__ComparatorSet)); - return _t8; -} - -VV_LOCAL_SYMBOL _option_semver__ComparatorSet semver__expand_xrange(string raw_range) { - _option_semver__Version _t1 = semver__parse_xrange(raw_range); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_semver__ComparatorSet){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version min_ver = (*(semver__Version*)_t1.data); - if (min_ver.major == 0) { - Array_semver__Comparator comparators = new_array_from_c_array(1, 1, sizeof(semver__Comparator), _MOV((semver__Comparator[1]){((semver__Comparator){.ver = min_ver,.op = semver__Operator__ge,})})); - _option_semver__ComparatorSet _t3; - opt_ok2(&(semver__ComparatorSet[]) { ((semver__ComparatorSet){.comparators = comparators,}) }, (_option*)(&_t3), sizeof(semver__ComparatorSet)); - return _t3; - } - semver__Version max_ver = min_ver; - if (min_ver.minor == 0) { - max_ver = semver__Version_increment(min_ver, semver__Increment__major); - } else { - max_ver = semver__Version_increment(min_ver, semver__Increment__minor); - } - _option_semver__ComparatorSet _t4; - opt_ok2(&(semver__ComparatorSet[]) { semver__make_comparator_set_ge_lt(min_ver, max_ver) }, (_option*)(&_t4), sizeof(semver__ComparatorSet)); - return _t4; -} - -VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_lt(semver__Version min, semver__Version max) { - Array_semver__Comparator comparators = new_array_from_c_array(2, 2, sizeof(semver__Comparator), _MOV((semver__Comparator[2]){((semver__Comparator){.ver = min,.op = semver__Operator__ge,}), ((semver__Comparator){.ver = max,.op = semver__Operator__lt,})})); - semver__ComparatorSet _t1 = ((semver__ComparatorSet){.comparators = comparators,}); - return _t1; -} - -VV_LOCAL_SYMBOL semver__ComparatorSet semver__make_comparator_set_ge_le(semver__Version min, semver__Version max) { - Array_semver__Comparator comparators = new_array_from_c_array(2, 2, sizeof(semver__Comparator), _MOV((semver__Comparator[2]){((semver__Comparator){.ver = min,.op = semver__Operator__ge,}), ((semver__Comparator){.ver = max,.op = semver__Operator__le,})})); - semver__ComparatorSet _t1 = ((semver__ComparatorSet){.comparators = comparators,}); - return _t1; -} - -string semver__EmptyInputError_msg(semver__EmptyInputError err) { - string _t1 = _SLIT("Empty input"); - return _t1; -} - -string semver__InvalidVersionFormatError_msg(semver__InvalidVersionFormatError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid version format for input \""), /*115 &string*/0xfe10, {.d_s = err.input}}, {_SLIT("\""), 0, { .d_c = 0 }}})); - return _t1; -} - -_option_semver__Version semver__from(string input) { - if (input.len == 0) { - return (_option_semver__Version){ .state=2, .err=/*&IError*/I_semver__EmptyInputError_to_Interface_IError(((semver__EmptyInputError*)memdup(&(semver__EmptyInputError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(semver__EmptyInputError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - semver__RawVersion raw_version = semver__parse(input); - _option_semver__Version _t2 = semver__RawVersion_validate(raw_version); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (_option_semver__Version){ .state=2, .err=/*&IError*/I_semver__InvalidVersionFormatError_to_Interface_IError(((semver__InvalidVersionFormatError*)memdup(&(semver__InvalidVersionFormatError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.input = input,}, sizeof(semver__InvalidVersionFormatError)))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version version = (*(semver__Version*)_t2.data); - _option_semver__Version _t4; - opt_ok2(&(semver__Version[]) { version }, (_option*)(&_t4), sizeof(semver__Version)); - return _t4; -} - -semver__Version semver__build(int major, int minor, int patch) { - semver__Version _t1 = ((semver__Version){.major = major,.minor = minor,.patch = patch,.prerelease = _SLIT(""),.metadata = _SLIT(""),}); - return _t1; -} - -semver__Version semver__Version_increment(semver__Version ver, semver__Increment typ) { - semver__Version _t1 = semver__increment_version(ver, typ); - return _t1; -} - -bool semver__Version_satisfies(semver__Version ver, string input) { - bool _t1 = semver__version_satisfies(ver, input); - return _t1; -} - -bool semver__Version_eq(semver__Version v1, semver__Version v2) { - bool _t1 = semver__compare_eq(v1, v2); - return _t1; -} - -bool semver__Version_gt(semver__Version v1, semver__Version v2) { - bool _t1 = semver__compare_gt(v1, v2); - return _t1; -} - -bool semver__Version_lt(semver__Version v1, semver__Version v2) { - bool _t1 = semver__compare_lt(v1, v2); - return _t1; -} - -bool semver__Version_ge(semver__Version v1, semver__Version v2) { - bool _t1 = semver__compare_ge(v1, v2); - return _t1; -} - -bool semver__Version_le(semver__Version v1, semver__Version v2) { - bool _t1 = semver__compare_le(v1, v2); - return _t1; -} - -string semver__Version_str(semver__Version ver) { - string common_string = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = ver.major}}, {_SLIT("."), /*100 &int*/0xfe07, {.d_i32 = ver.minor}}, {_SLIT("."), /*100 &int*/0xfe07, {.d_i32 = ver.patch}}, {_SLIT0, 0, { .d_c = 0 }}})); - string prerelease_string = (ver.prerelease.len > 0 ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*115 &string*/0xfe10, {.d_s = ver.prerelease}}, {_SLIT0, 0, { .d_c = 0 }}}))) : (_SLIT(""))); - string metadata_string = (ver.metadata.len > 0 ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*115 &string*/0xfe10, {.d_s = ver.metadata}}, {_SLIT0, 0, { .d_c = 0 }}}))) : (_SLIT(""))); - string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = common_string}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prerelease_string}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = metadata_string}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -_option_semver__Version semver__coerce(string input) { - _option_semver__Version _t1 = semver__coerce_version(input); - return _t1; -} - -bool semver__is_valid(string input) { - bool _t1 = semver__is_version_valid(input); - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL bool semver__is_version_valid(string input) { - semver__RawVersion raw_ver = semver__parse(input); - bool _t1 = semver__RawVersion_is_valid(raw_ver); - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL _option_semver__Version semver__coerce_version(string input) { - semver__RawVersion raw_ver = semver__parse(input); - _option_semver__Version _t1 = semver__RawVersion_coerce(raw_ver); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - return (_option_semver__Version){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid version for input \""), /*115 &string*/0xfe10, {.d_s = input}}, {_SLIT("\""), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - semver__Version ver = (*(semver__Version*)_t1.data); - _option_semver__Version _t3; - opt_ok2(&(semver__Version[]) { ver }, (_option*)(&_t3), sizeof(semver__Version)); - return _t3; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL semver__Version semver__increment_version(semver__Version ver, semver__Increment typ) { - int major = ver.major; - int minor = ver.minor; - int patch = ver.patch; - - if (typ == (semver__Increment__major)) { - major++; - minor = 0; - patch = 0; - } - else if (typ == (semver__Increment__minor)) { - minor++; - patch = 0; - } - else if (typ == (semver__Increment__patch)) { - patch++; - }; - semver__Version _t1 = ((semver__Version){.major = major,.minor = minor,.patch = patch,.prerelease = ver.prerelease,.metadata = ver.metadata,}); - return _t1; -} - -VV_LOCAL_SYMBOL bool semver__is_valid_string(string input) { - for (int _t1 = 0; _t1 < input.len; ++_t1) { - u8 c = input.str[_t1]; - if (!(u8_is_letter(c) || u8_is_digit(c) || c == '.' || c == '-')) { - bool _t2 = false; - return _t2; - } - } - bool _t3 = true; - return _t3; -} - -VV_LOCAL_SYMBOL bool semver__is_valid_number(string input) { - for (int _t1 = 0; _t1 < input.len; ++_t1) { - u8 c = input.str[_t1]; - if (!u8_is_digit(c)) { - bool _t2 = false; - return _t2; - } - } - bool _t3 = true; - return _t3; -} - -#if defined(_WIN32) -#else -#endif -#if defined(__linux__) - #if defined(__TINYC__) - #if defined(__V_amd64) -#elif defined(__V_arm64) -#endif -#endif -#endif -bool sync__stdatomic__add_u64(u64* ptr, int delta) { - u64 res = atomic_fetch_add_u64(((voidptr)(ptr)), delta); - bool _t1 = res == 0U; - return _t1; -} - -bool sync__stdatomic__sub_u64(u64* ptr, int delta) { - u64 res = atomic_fetch_sub_u64(((voidptr)(ptr)), delta); - bool _t1 = res == 0U; - return _t1; -} - -bool sync__stdatomic__add_i64(i64* ptr, int delta) { - u64 res = atomic_fetch_add_u64(((voidptr)(ptr)), delta); - bool _t1 = res == 0U; - return _t1; -} - -bool sync__stdatomic__sub_i64(i64* ptr, int delta) { - u64 res = atomic_fetch_sub_u64(((voidptr)(ptr)), delta); - bool _t1 = res == 0U; - return _t1; -} - -void sync__stdatomic__store_u64(u64* ptr, u64 val) { - atomic_store_u64(((voidptr)(ptr)), val); -} - -u64 sync__stdatomic__load_u64(u64* ptr) { - u64 _t1 = atomic_load_u64(((voidptr)(ptr))); - return _t1; -} - -void sync__stdatomic__store_i64(i64* ptr, i64 val) { - atomic_store_u64(((voidptr)(ptr)), val); -} - -i64 sync__stdatomic__load_i64(i64* ptr) { - i64 _t1 = ((i64)(atomic_load_u64(((voidptr)(ptr))))); - return _t1; -} - -#if !defined(_WIN32) && !defined(__ANDROID__) -#endif string term__format(string msg, string open, string close) { string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT("["), /*115 &string*/0xfe10, {.d_s = open}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = msg}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = close}}, {_SLIT("m"), 0, { .d_c = 0 }}})); return _t1; @@ -32263,7 +33927,7 @@ _option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string _option_void _t1 = os__write_file(fpath, content); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -32278,7 +33942,7 @@ _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string _option_string _t1 = v__vcache__CacheManager_exists(cm, postfix, key); if (_t1.state != 0) { /*or block*/ _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -32286,7 +33950,7 @@ _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string _option_string _t3 = os__read_file(fpath); if (_t3.state != 0) { /*or block*/ _option_string _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -32307,6 +33971,121 @@ VV_LOCAL_SYMBOL int v__vcache__mypid(void) { return _t1; } +_option_string v__util__diff__find_working_diff_command(void) { + string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); + string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); + if ((env_difftool).len != 0) { + _option_string _t1; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t1), sizeof(string)); + return _t1; + } + Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); + if (env_difftool.len > 0) { + array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); + } + _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); + for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { + string diffcmd = ((string*)known_diff_tools.data)[_t4]; + if (string__eq(diffcmd, _SLIT("opendiff"))) { + if (v__util__diff__opendiff_exists()) { + _option_string _t5; + opt_ok2(&(string[]) { diffcmd }, (_option*)(&_t5), sizeof(string)); + return _t5; + } + continue; + } + os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); + if (p.exit_code < 0) { + continue; + } + if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { + return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (p.exit_code == 0) { + if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { + _option_string _t7; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (_option*)(&_t7), sizeof(string)); + return _t7; + } + _option_string _t8; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t8), sizeof(string)); + return _t8; + } + } + return (_option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { + os__Result o = os__execute(_SLIT("opendiff")); + if (o.exit_code < 0) { + bool _t1 = false; + return _t1; + } + if (o.exit_code == 1) { + if (string_contains(o.output, _SLIT("too few arguments"))) { + bool _t2 = true; + return _t2; + } + } + bool _t3 = false; + return _t3; +} + +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { + if ((diff_cmd).len != 0) { + string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); + os__Result x = os__execute(full_cmd); + if (x.exit_code < 0) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), /*115 &string*/0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); + return _t1; + } + string _t2 = string_trim_right(x.output, _SLIT("\r\n")); + return _t2; + } + string _t3 = _SLIT(""); + return _t3; +} + +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { + string cdir = os__join_path_single(os__cache_dir(), unique_prefix); + _option_bool _t1 = os__mkdir(cdir); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; + } + + (*(bool*)_t1.data); + u64 ctime = time__sys_mono_now(); + string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); + string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); + _option_void _t2 = os__write_file(e_file, expected); + if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { + IError err = _t2.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + _option_void _t3 = os__write_file(f_file, found); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); + _option_void _t4 = os__rmdir_all(cdir); + if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { + IError err = _t4.err; + } + + ; + string _t5 = res; + return _t5; +} + _option_v__vmod__Manifest v__vmod__from_file(string vmod_path) { if (!os__exists(vmod_path)) { return (_option_v__vmod__Manifest){ .state=2, .err=_v_error(_SLIT("v.mod: v.mod file not found.")), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -32521,7 +34300,7 @@ VV_LOCAL_SYMBOL _option_v__vmod__Manifest v__vmod__Parser_parse(v__vmod__Parser* _option_multi_return_Array_string_int _t5 = v__vmod__get_array_content(tokens, i + 1); if (_t5.state != 0) { /*or block*/ _option_v__vmod__Manifest _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -32537,7 +34316,7 @@ VV_LOCAL_SYMBOL _option_v__vmod__Manifest v__vmod__Parser_parse(v__vmod__Parser* _option_multi_return_Array_string_int _t7 = v__vmod__get_array_content(tokens, i + 1); if (_t7.state != 0) { /*or block*/ _option_v__vmod__Manifest _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -32743,244 +34522,6 @@ void v__util__recompilation__must_be_enabled(string vroot, string error_message) } } -v__depgraph__OrderedDepMap v__depgraph__new_ordered_dependency_map(void) { - v__depgraph__OrderedDepMap res = ((v__depgraph__OrderedDepMap){.keys = __new_array(0, 0, sizeof(string)),.data = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}); - ArrayFlags_set(&res.keys.flags, ArrayFlags__noslices); - v__depgraph__OrderedDepMap _t1 = res; - return _t1; -} - -void v__depgraph__OrderedDepMap_set(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { - if (!_IN_MAP(ADDR(string, name), ADDR(map, o->data))) { - array_push((array*)&o->keys, _MOV((string[]){ string_clone(name) })); - } - map_set(&o->data, &(string[]){name}, &(Array_string[]) { deps }); -} - -void v__depgraph__OrderedDepMap_add(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { - Array_string d = v__depgraph__OrderedDepMap_get(o, name); - for (int _t1 = 0; _t1 < deps.len; ++_t1) { - string dep = ((string*)deps.data)[_t1]; - if (!Array_string_contains(d, dep)) { - array_push((array*)&d, _MOV((string[]){ string_clone(dep) })); - } else { - } - } - v__depgraph__OrderedDepMap_set(o, name, d); -} - -Array_string v__depgraph__OrderedDepMap_get(v__depgraph__OrderedDepMap* o, string name) { - Array_string* _t2 = (Array_string*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, o->data), &(string[]){name})); - _option_Array_string _t1 = {0}; - if (_t2) { - *((Array_string*)&_t1.data) = *((Array_string*)_t2); - } else { - _t1.state = 2; _t1.err = _v_error(_SLIT("array index out of range")); - } - ; - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - *(Array_string*) _t1.data = __new_array_with_default(0, 0, sizeof(string), 0); - } - - Array_string res = *(Array_string*)_t1.data; - Array_string _t3 = res; - return _t3; -} - -void v__depgraph__OrderedDepMap_delete(v__depgraph__OrderedDepMap* o, string name) { - if (!_IN_MAP(ADDR(string, name), ADDR(map, o->data))) { - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("delete: no such key: "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT0, 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - } - for (int i = 0; i < o->keys.len; ++i) { - if (string__eq((*(string*)/*ee elem_sym */array_get(o->keys, i)), name)) { - array_delete(&o->keys, i); - break; - } - } - map_delete(&o->data, &(string[]){name}); -} - -void v__depgraph__OrderedDepMap_apply_diff(v__depgraph__OrderedDepMap* o, string name, Array_string deps) { - Array_string diff = __new_array_with_default(0, 0, sizeof(string), 0); - Array_string deps_of_name = v__depgraph__OrderedDepMap_get(o, name); - for (int _t1 = 0; _t1 < deps_of_name.len; ++_t1) { - string dep = ((string*)deps_of_name.data)[_t1]; - if (!Array_string_contains(deps, dep)) { - array_push((array*)&diff, _MOV((string[]){ string_clone(dep) })); - } - } - v__depgraph__OrderedDepMap_set(o, name, diff); -} - -int v__depgraph__OrderedDepMap_size(v__depgraph__OrderedDepMap* o) { - int _t1 = o->data.len; - return _t1; -} - -v__depgraph__DepGraph* v__depgraph__new_dep_graph(void) { - v__depgraph__DepGraph* _t1 = ((v__depgraph__DepGraph*)memdup(&(v__depgraph__DepGraph){.acyclic = true,.nodes = __new_array_with_default(0, 1024, sizeof(v__depgraph__DepGraphNode), 0),}, sizeof(v__depgraph__DepGraph))); - return _t1; -} - -void v__depgraph__DepGraph_add(v__depgraph__DepGraph* graph, string mod, Array_string deps) { - v__depgraph__DepGraphNode new_node = ((v__depgraph__DepGraphNode){.name = mod,.deps = array_clone_to_depth(&deps, 0),}); - array_push((array*)&graph->nodes, _MOV((v__depgraph__DepGraphNode[]){ new_node })); -} - -v__depgraph__DepGraph* v__depgraph__DepGraph_resolve(v__depgraph__DepGraph* graph) { - v__depgraph__OrderedDepMap node_names = v__depgraph__new_ordered_dependency_map(); - v__depgraph__OrderedDepMap node_deps = v__depgraph__new_ordered_dependency_map(); - for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { - v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; - v__depgraph__OrderedDepMap_add(&node_names, node.name, node.deps); - v__depgraph__OrderedDepMap_add(&node_deps, node.name, node.deps); - } - int iterations = 0; - v__depgraph__DepGraph* resolved = v__depgraph__new_dep_graph(); - for (;;) { - if (!(v__depgraph__OrderedDepMap_size(&node_deps) != 0)) break; - iterations++; - Array_string ready_set = __new_array_with_default(0, 0, sizeof(string), 0); - for (int _t2 = 0; _t2 < node_deps.keys.len; ++_t2) { - string name = ((string*)node_deps.keys.data)[_t2]; - Array_string deps = v__depgraph__OrderedDepMap_get(&node_deps, name); - if (deps.len == 0) { - array_push((array*)&ready_set, _MOV((string[]){ string_clone(name) })); - } - } - if (ready_set.len == 0) { - v__depgraph__DepGraph* g = v__depgraph__new_dep_graph(); - g->acyclic = false; - for (int _t4 = 0; _t4 < node_deps.keys.len; ++_t4) { - string name = ((string*)node_deps.keys.data)[_t4]; - v__depgraph__DepGraph_add(g, name, v__depgraph__OrderedDepMap_get(&node_names, name)); - } - v__depgraph__DepGraph* _t5 = g; - return _t5; - } - for (int _t6 = 0; _t6 < ready_set.len; ++_t6) { - string name = ((string*)ready_set.data)[_t6]; - v__depgraph__OrderedDepMap_delete(&node_deps, name); - Array_string resolved_deps = v__depgraph__OrderedDepMap_get(&node_names, name); - v__depgraph__DepGraph_add(resolved, name, resolved_deps); - } - for (int _t7 = 0; _t7 < node_deps.keys.len; ++_t7) { - string name = ((string*)node_deps.keys.data)[_t7]; - v__depgraph__OrderedDepMap_apply_diff(&node_deps, name, ready_set); - } - } - v__depgraph__DepGraph* _t8 = resolved; - return _t8; -} - -v__depgraph__DepGraphNode v__depgraph__DepGraph_last_node(v__depgraph__DepGraph* graph) { - v__depgraph__DepGraphNode _t1 = (*(v__depgraph__DepGraphNode*)/*ee elem_sym */array_get(graph->nodes, graph->nodes.len - 1)); - return _t1; -} - -string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph) { - Array_string out = __new_array_with_default(0, 0, sizeof(string), 0); - for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { - v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; - for (int _t2 = 0; _t2 < node.deps.len; ++_t2) { - string dep = ((string*)node.deps.data)[_t2]; - array_push((array*)&out, _MOV((string[]){ string_clone( str_intp(3, _MOV((StrIntpData[]){{_SLIT(" * "), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT(" -> "), /*115 &string*/0xfe10, {.d_s = dep}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); - } - } - string _t4 = Array_string_join(out, _SLIT("\n")); - return _t4; -} - -string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph) { - bool seen = false; - Array_string out = __new_array_with_default(0, 0, sizeof(string), 0); - v__depgraph__NodeNames nn = ((v__depgraph__NodeNames){.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.names = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),}); - for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { - v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; - map_set(&nn.names, &(string[]){node.name}, &(Array_string[]) { node.deps }); - } - Map_string_Array_string _t2 = nn.names; - int _t4 = _t2.key_values.len; - for (int _t3 = 0; _t3 < _t4; ++_t3 ) { - int _t5 = _t2.key_values.len - _t4; - _t4 = _t2.key_values.len; - if (_t5 < 0) { - _t3 = -1; - continue; - } - if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} - string k = /*key*/ *(string*)DenseArray_key(&_t2.key_values, _t3); - k = string_clone(k); - Array_string cycle_names = __new_array_with_default(0, 0, sizeof(string), 0); - if (_IN_MAP(ADDR(string, k), ADDR(map, nn.is_cycle))) { - continue; - } - multi_return_bool_Array_string mr_3360 = v__depgraph__NodeNames_is_part_of_cycle(&nn, k, cycle_names); - seen = mr_3360.arg0; - cycle_names = mr_3360.arg1; - if (seen) { - array_push((array*)&out, _MOV((string[]){ string_clone(string__plus(_SLIT(" * "), Array_string_join(cycle_names, _SLIT(" -> ")))) })); - nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - } - } - string _t7 = Array_string_join(out, _SLIT("\n")); - return _t7; -} - -VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen) { - bool seen = false; - Array_string new_already_seen = array_clone_to_depth(&already_seen, 0); - if (_IN_MAP(ADDR(string, name), ADDR(map, nn->is_cycle))) { - return (multi_return_bool_Array_string){.arg0=(*(bool*)map_get(ADDR(map, nn->is_cycle), &(string[]){name}, &(bool[]){ 0 })), .arg1=new_already_seen}; - } - if (Array_string_contains(already_seen, name)) { - array_push((array*)&new_already_seen, _MOV((string[]){ string_clone(name) })); - map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); - return (multi_return_bool_Array_string){.arg0=true, .arg1=new_already_seen}; - } - array_push((array*)&new_already_seen, _MOV((string[]){ string_clone(name) })); - Array_string deps = (*(Array_string*)map_get(ADDR(map, nn->names), &(string[]){name}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); - if (deps.len == 0) { - map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { false }); - return (multi_return_bool_Array_string){.arg0=false, .arg1=new_already_seen}; - } - for (int _t6 = 0; _t6 < deps.len; ++_t6) { - string d = ((string*)deps.data)[_t6]; - Array_string d_already_seen = array_clone_to_depth(&new_already_seen, 0); - multi_return_bool_Array_string mr_4093 = v__depgraph__NodeNames_is_part_of_cycle(nn, d, d_already_seen); - seen = mr_4093.arg0; - d_already_seen = mr_4093.arg1; - if (seen) { - new_already_seen = array_clone_to_depth(&d_already_seen, 0); - map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { true }); - return (multi_return_bool_Array_string){.arg0=true, .arg1=new_already_seen}; - } - } - map_set(&nn->is_cycle, &(string[]){name}, &(bool[]) { false }); - return (multi_return_bool_Array_string){.arg0=false, .arg1=new_already_seen}; -} - -void v__depgraph__show(v__depgraph__DepGraph* graph, string path) { - v__dotgraph__DotGraph* dg = v__dotgraph__new(_SLIT("ModGraph"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("ModGraph for "), /*115 &string*/0xfe10, {.d_s = path}}, {_SLIT0, 0, { .d_c = 0 }}})), _SLIT("blue")); - string mbuiltin = _SLIT("builtin"); - for (int _t1 = 0; _t1 < graph->nodes.len; ++_t1) { - v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)graph->nodes.data)[_t1]; - bool is_main = string__eq(node.name, _SLIT("main")); - v__dotgraph__DotGraph_new_node(dg, node.name, ((v__dotgraph__NewNodeConfig){.node_name = (string){.str=(byteptr)"", .is_lit=1},.should_highlight = is_main,.tooltip = (string){.str=(byteptr)"", .is_lit=1},.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); - Array_string deps = array_clone_to_depth(&node.deps, 0); - if (!string__eq(node.name, mbuiltin) && !Array_string_contains(deps, mbuiltin)) { - array_push((array*)&deps, _MOV((string[]){ string_clone(mbuiltin) })); - } - for (int _t3 = 0; _t3 < deps.len; ++_t3) { - string dep = ((string*)deps.data)[_t3]; - v__dotgraph__DotGraph_new_edge(dg, node.name, dep, ((v__dotgraph__NewEdgeConfig){.should_highlight = is_main,.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); - } - } - v__dotgraph__DotGraph_finish(dg); -} - string v__cflag__CFlag_str(v__cflag__CFlag* c) { string _t1 = str_intp(6, _MOV((StrIntpData[]){{_SLIT("CFlag{ name: \""), /*115 &string*/0xfe10, {.d_s = c->name}}, {_SLIT("\" value: \""), /*115 &string*/0xfe10, {.d_s = c->value}}, {_SLIT("\" mod: \""), /*115 &string*/0xfe10, {.d_s = c->mod}}, {_SLIT("\" os: \""), /*115 &string*/0xfe10, {.d_s = c->os}}, {_SLIT("\" cached: \""), /*115 &string*/0xfe10, {.d_s = c->cached}}, {_SLIT("\" }"), 0, { .d_c = 0 }}})); return _t1; @@ -33118,2021 +34659,88 @@ multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_define return (multi_return_Array_string_Array_string_Array_string){.arg0=defines, .arg1=others, .arg2=libs}; } -// Attr: [deprecated] -f64 math__fabs(f64 x) { - if (x > 0.0) { - return x; - } - return -x; -} - -f64 math__inf(int sign) { - u64 v = (sign >= 0 ? (_const_math__uvinf) : (_const_math__uvneginf)); - return math__f64_from_bits(v); -} - -f64 math__nan(void) { - return math__f64_from_bits(_const_math__uvnan); -} - -bool math__is_nan(f64 f) { - return f != f; -} - -bool math__is_inf(f64 f, int sign) { - return (sign >= 0 && f > _const_math__max_f64) || (sign <= 0 && f < -_const_math__max_f64); -} - -bool math__is_finite(f64 f) { - return !math__is_nan(f) && !math__is_inf(f, 0); -} - -multi_return_f64_int math__normalize(f64 x) { - f64 smallest_normal = 2.2250738585072014e-308; - if (math__abs_T_f64(x) < smallest_normal) { - return (multi_return_f64_int){.arg0=x * _const_math__normalize_smallest_mask, .arg1=-52}; - } - return (multi_return_f64_int){.arg0=x, .arg1=0}; -} - -f64 math__cbrt(f64 a) { - f64 x = a; - int b1 = 715094163; - int b2 = 696219795; - f64 c = 5.42857142857142815906e-01; - f64 d = -7.05306122448979611050e-01; - f64 e_ = 1.41428571428571436819e+00; - f64 f = 1.60714285714285720630e+00; - f64 g = 3.57142857142857150787e-01; - f64 smallest_normal = 2.22507385850720138309e-308; - if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - f64 t = math__f64_from_bits(math__f64_bits(x) / ((u64)(3U)) + (((u64)(b1)) << 32U)); - if (x < smallest_normal) { - t = ((f64)(((u64)(1U)) << 54U)); - t *= x; - t = math__f64_from_bits(math__f64_bits(t) / ((u64)(3U)) + (((u64)(b2)) << 32U)); - } - f64 r = t * t / x; - f64 s = c + r * t; - t *= g + f / (s + e_ + d / s); - t = math__f64_from_bits((math__f64_bits(t) & (((u64)(0xffffffffcU)) << 28U)) + (((u64)(1U)) << 30U)); - s = t * t; - r = x / s; - f64 w = t + t; - r = (r - t) / (w + r); - t = t + t * r; - if (sign) { - t = -t; - } - return t; -} - -f64 math__mod(f64 x, f64 y) { - return math__fmod(x, y); -} - -f64 math__fmod(f64 x, f64 y) { - if (y == 0 || math__is_inf(x, 0) || math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } - f64 abs_y = math__abs_T_f64(y); - multi_return_f64_int mr_594 = math__frexp(abs_y); - f64 abs_y_fr = mr_594.arg0; - int abs_y_exp = mr_594.arg1; - f64 r = x; - if (x < 0) { - r = -x; - } - for (;;) { - if (!(r >= abs_y)) break; - multi_return_f64_int mr_680 = math__frexp(r); - f64 rfr = mr_680.arg0; - int rexp = mr_680.arg1; - if (rfr < abs_y_fr) { - rexp = rexp - 1; - } - r = r - math__ldexp(abs_y, rexp - abs_y_exp); - } - if (x < 0) { - r = -r; - } - return r; -} - -i64 math__gcd(i64 a_, i64 b_) { - i64 a = a_; - i64 b = b_; - if (a < 0) { - a = -a; - } - if (b < 0) { - b = -b; - } - for (;;) { - if (!(b != 0)) break; - a %= b; - if (a == 0) { - return b; - } - b %= a; - } - return a; -} - -multi_return_i64_i64_i64 math__egcd(i64 a, i64 b) { - i64 old_r = a; - i64 r = b; - i64 old_s = ((i64)(1)); - i64 s = ((i64)(0)); - i64 old_t = ((i64)(0)); - i64 t = ((i64)(1)); - for (;;) { - if (!(r != 0)) break; - i64 quot = old_r / r; - i64 _var_1339 = old_r; - i64 _var_1346 = r; - old_r = _var_1346; - r = _var_1339%_var_1346; - i64 _var_1365 = old_s; - i64 _var_1372 = s; - old_s = _var_1372; - s = _var_1365-quot*_var_1372; - i64 _var_1398 = old_t; - i64 _var_1405 = t; - old_t = _var_1405; - t = _var_1398-quot*_var_1405; - } - return (multi_return_i64_i64_i64){.arg0=(old_r < 0 ? (-old_r) : (old_r)), .arg1=old_s, .arg2=old_t}; -} - -i64 math__lcm(i64 a, i64 b) { - if (a == 0) { - return a; - } - i64 res = a * (b / math__gcd(b, a)); - if (res < 0) { - return -res; - } - return res; -} - -f64 math__erf(f64 a) { - f64 x = a; - f64 very_tiny = 2.848094538889218e-306; - f64 small_ = 1.0 / ((f64)(((u64)(1U)) << 28U)); - if (math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return 1.0; - } - if (math__is_inf(x, -1)) { - return ((f64)(-1)); - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - if (x < 0.84375) { - f64 temp = 0.0; - if (x < small_) { - if (x < very_tiny) { - temp = 0.125 * (8.0 * x + _const_math__efx8 * x); - } else { - temp = x + _const_math__efx * x; - } - } else { - f64 z = x * x; - f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); - f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); - f64 y = r / s_; - temp = x + x * y; - } - if (sign) { - return -temp; - } - return temp; - } - if (x < 1.25) { - f64 s_ = x - 1; - f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); - f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); - if (sign) { - return -_const_math__erx - p / q; - } - return _const_math__erx + p / q; - } - if (x >= 6) { - if (sign) { - return -1; - } - return 1.0; - } - f64 s_ = 1.0 / (x * x); - f64 r = 0.0; - f64 s = 0.0; - if (x < 2.857143) { - r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); - s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); - } else { - r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); - s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); - } - f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); - f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); - if (sign) { - return r_ / x - 1.0; - } - return 1.0 - r_ / x; -} - -f64 math__erfc(f64 a) { - f64 x = a; - f64 tiny = 1.0 / ((f64)(((u64)(1U)) << 56U)); - if (math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return 0.0; - } - if (math__is_inf(x, -1)) { - return 2.0; - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - if (x < 0.84375) { - f64 temp = 0.0; - if (x < tiny) { - temp = x; - } else { - f64 z = x * x; - f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); - f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); - f64 y = r / s_; - if (x < 0.25) { - temp = x + x * y; - } else { - temp = 0.5 + (x * y + (x - 0.5)); - } - } - if (sign) { - return 1.0 + temp; - } - return 1.0 - temp; - } - if (x < 1.25) { - f64 s_ = x - 1; - f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); - f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); - if (sign) { - return 1.0 + _const_math__erx + p / q; - } - return 1.0 - _const_math__erx - p / q; - } - if (x < 28) { - f64 s_ = 1.0 / (x * x); - f64 r = 0.0; - f64 s = 0.0; - if (x < 2.857143) { - r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); - s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); - } else { - if (sign && x > 6) { - return 2.0; - } - r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); - s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); - } - f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); - f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); - if (sign) { - return 2.0 - r_ / x; - } - return r_ / x; - } - if (sign) { - return 2.0; - } - return 0.0; -} - -f64 math__exp(f64 x) { - f64 log2e = 1.44269504088896338700e+00; - f64 overflow = 7.09782712893383973096e+02; - f64 underflow = -7.45133219101941108420e+02; - f64 near_zero = 1.0 / (268435456); - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (math__is_inf(x, -1)) { - return 0.0; - } - if (x > overflow) { - return math__inf(1); - } - if (x < underflow) { - return 0.0; - } - if (-near_zero < x && x < near_zero) { - return 1.0 + x; - } - int k = 0; - if (x < 0) { - k = ((int)(log2e * x - 0.5)); - } - if (x > 0) { - k = ((int)(log2e * x + 0.5)); - } - f64 hi = x - ((f64)(k)) * _const_math__ln2hi; - f64 lo = ((f64)(k)) * _const_math__ln2lo; - return math__expmulti(hi, lo, k); -} - -f64 math__exp2(f64 x) { - f64 overflow = 1.0239999999999999e+03; - f64 underflow = -1.0740e+03; - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (math__is_inf(x, -1)) { - return 0; - } - if (x > overflow) { - return math__inf(1); - } - if (x < underflow) { - return 0; - } - int k = 0; - if (x > 0) { - k = ((int)(x + 0.5)); - } - if (x < 0) { - k = ((int)(x - 0.5)); - } - f64 t = x - ((f64)(k)); - f64 hi = t * _const_math__ln2hi; - f64 lo = -t * _const_math__ln2lo; - return math__expmulti(hi, lo, k); -} - -f64 math__ldexp(f64 frac, int exp) { - return math__scalbn(frac, exp); -} - -multi_return_f64_int math__frexp(f64 x) { - u64 y = math__f64_bits(x); - int ee = ((int)(((y >> 52U) & 0x7ffU))); - if (ee == 0) { - if (x != 0.0) { - f64 x1p64 = math__f64_from_bits(((u64)(0x43f0000000000000U))); - multi_return_f64_int mr_3352 = math__frexp(x * x1p64); - f64 z = mr_3352.arg0; - int e_ = mr_3352.arg1; - return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; - } - return (multi_return_f64_int){.arg0=x, .arg1=0}; - } else if (ee == 0x7ff) { - return (multi_return_f64_int){.arg0=x, .arg1=0}; - } - int e_ = ee - 0x3fe; - y &= ((u64)(0x800fffffffffffffU)); - y |= ((u64)(0x3fe0000000000000U)); - return (multi_return_f64_int){.arg0=math__f64_from_bits(y), .arg1=e_}; -} - -f64 math__expm1(f64 x) { - if (math__is_inf(x, 1) || math__is_nan(x)) { - return x; - } - if (math__is_inf(x, -1)) { - return ((f64)(-1)); - } - if (math__abs_T_f64(x) < _const_math__ln2) { - f64 i = 1.0; - f64 sum = x; - f64 term = x / 1.0; - i++; - term *= x / ((f64)(i)); - sum += term; - for (;;) { - if (!(math__abs_T_f64(term) > math__abs_T_f64(sum) * _const_math__internal__f64_epsilon)) break; - i++; - term *= x / ((f64)(i)); - sum += term; - } - return sum; - } else { - return math__exp(x) - 1; - } - return 0; -} - -VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k) { - f64 exp_p1 = 1.66666666666666657415e-01; - f64 exp_p2 = -2.77777777770155933842e-03; - f64 exp_p3 = 6.61375632143793436117e-05; - f64 exp_p4 = -1.65339022054652515390e-06; - f64 exp_p5 = 4.13813679705723846039e-08; - f64 r = hi - lo; - f64 t = r * r; - f64 c = r - t * (exp_p1 + t * (exp_p2 + t * (exp_p3 + t * (exp_p4 + t * exp_p5)))); - f64 y = 1 - ((lo - (r * c) / (2 - c)) - hi); - return math__ldexp(y, k); -} - -f64 math__factorial(f64 n) { - if (n >= _const_math__factorials_table.len) { - return _const_math__max_f64; - } - if (n == ((f64)(((i64)(n)))) && n >= 0.0) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, ((i64)(n)))); - } - return math__gamma(n + 1.0); -} - -f64 math__log_factorial(f64 n) { - if (n < 0) { - return -_const_math__max_f64; - } - if (n != ((f64)(((i64)(n))))) { - return math__log_gamma(n + 1); - } else if (n < _const_math__log_factorials_table.len) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__log_factorials_table, ((i64)(n)))); - } - return math__log_factorial_asymptotic_expansion(((int)(n))); -} - -VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n) { - int m = 6; - Array_f64 term = __new_array_with_default(0, 0, sizeof(f64), 0); - f64 xx = ((f64)((n + 1) * (n + 1))); - f64 xj = ((f64)(n + 1)); - f64 log_factorial = _const_math__log_sqrt_2pi - xj + (xj - 0.5) * math__log(xj); - int i = 0; - for (i = 0; i < m; i++) { - array_push((array*)&term, _MOV((f64[]){ (*(f64*)/*ee elem_sym */array_get(_const_math__bernoulli, i)) / xj })); - xj *= xx; - } - f64 sum = (*(f64*)/*ee elem_sym */array_get(term, m - 1)); - for (i = m - 2; i >= 0; i--) { - if (math__abs_T_f64(sum) <= math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(term, i)))) { - break; - } - sum = (*(f64*)/*ee elem_sym */array_get(term, i)); - } - for (;;) { - if (!(i >= 0)) break; - sum += (*(f64*)/*ee elem_sym */array_get(term, i)); - i--; - } - return log_factorial + sum; -} - -i64 math__factoriali(int n) { - if (n <= 0) { - return ((i64)(1)); - } - if (n < 21) { - return ((i64)((*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, n)))); - } - return ((i64)(-1)); -} - -f64 math__floor(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - if (x < 0) { - multi_return_f64_f64 mr_280 = math__modf(-x); - f64 d = mr_280.arg0; - f64 fract = mr_280.arg1; - if (fract != 0.0) { - d = d + 1; - } - return -d; - } - multi_return_f64_f64 mr_350 = math__modf(x); - f64 d = mr_350.arg0; - return d; -} - -f64 math__ceil(f64 x) { - return -math__floor(-x); -} - -f64 math__trunc(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - multi_return_f64_f64 mr_793 = math__modf(x); - f64 d = mr_793.arg0; - return d; -} - -f64 math__round(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - f64 y = math__floor(x); - f64 r = x - y; - if (r > 0.5) { - { // Unsafe block - goto rndup; - } - } - if (r == 0.5) { - r = y - 2.0 * math__floor(0.5 * y); - if (r == 1.0) { - rndup: {} - y += 1.0; - } - } - return y; -} - -f64 math__round_to_even(f64 x) { - u64 bits = math__f64_bits(x); - u64 e_ = ((bits >> _const_math__shift) & _const_math__mask); - if (e_ >= _const_math__bias) { - u64 half_minus_ulp = ((u64)(((u64)(1U)) << (_const_math__shift - 1))) - 1U; - e_ -= ((u64)(_const_math__bias)); - bits += (half_minus_ulp + ((bits >> (_const_math__shift - e_)) & 1U)) >> e_; - bits &= _const_math__frac_mask >> e_; - bits ^= _const_math__frac_mask >> e_; - } else if (e_ == _const_math__bias - 1 && (bits & _const_math__frac_mask) != 0U) { - bits = ((bits & _const_math__sign_mask) | _const_math__uvone); - } else { - bits &= _const_math__sign_mask; - } - return math__f64_from_bits(bits); -} - -VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x) { - if (x > 200) { - return (multi_return_f64_f64){.arg0=math__inf(1), .arg1=1.0}; - } - f64 sqrt_two_pi = 2.506628274631000502417; - f64 max_stirling = 143.01608; - f64 w = 1.0 / x; - w = 1.0 + w * (((((*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 0)) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 1))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 2))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 3))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 4))); - f64 y1 = math__exp(x); - f64 y2 = 1.0; - if (x > max_stirling) { - f64 v = math__pow(x, 0.5 * x - 0.25); - f64 y1_ = y1; - y1 = v; - y2 = v / y1_; - } else { - y1 = math__pow(x, x - 0.5) / y1; - } - return (multi_return_f64_f64){.arg0=y1, .arg1=((f64)(sqrt_two_pi)) * w * y2}; -} - -f64 math__gamma(f64 a) { - f64 x = a; - f64 euler = 0.57721566490153286060651209008240243104215933593992; - if (math__is_neg_int(x) || math__is_inf(x, -1) || math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return math__inf(1); - } - if (x == 0.0) { - return math__copysign(math__inf(1), x); - } - f64 q = math__abs_T_f64(x); - f64 p = math__floor(q); - if (q > 33) { - if (x >= 0) { - multi_return_f64_f64 mr_1482 = math__stirling(x); - f64 y1 = mr_1482.arg0; - f64 y2 = mr_1482.arg1; - return y1 * y2; - } - int signgam = 1; - i64 ip = ((i64)(p)); - if (((ip & 1)) == 0) { - signgam = -1; - } - f64 z = q - p; - if (z > 0.5) { - p = p + 1; - z = q - p; - } - z = q * math__sin(_const_math__pi * z); - if (z == 0) { - return math__inf(signgam); - } - multi_return_f64_f64 mr_1927 = math__stirling(q); - f64 sq1 = mr_1927.arg0; - f64 sq2 = mr_1927.arg1; - f64 absz = math__abs_T_f64(z); - f64 d = absz * sq1 * sq2; - if (math__is_inf(d, 0)) { - z = _const_math__pi / absz / sq1 / sq2; - } else { - z = _const_math__pi / d; - } - return ((f64)(signgam)) * z; - } - f64 z = 1.0; - for (;;) { - if (!(x >= 3)) break; - x = x - 1; - z = z * x; - } - for (;;) { - if (!(x < 0)) break; - if (x > -1e-09) { - { // Unsafe block - goto _v_small; - } - } - z = z / x; - x = x + 1; - } - for (;;) { - if (!(x < 2)) break; - if (x < 1e-09) { - { // Unsafe block - goto _v_small; - } - } - z = z / x; - x = x + 1; - } - if (x == 2) { - return z; - } - x = x - 2; - p = (((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 6)); - q = ((((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 6))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 7)); - if (true) { - return z * p / q; - } - _v_small: {} - if (x == 0) { - return math__inf(1); - } - return z / ((1.0 + euler * x) * x); -} - -f64 math__log_gamma(f64 x) { - multi_return_f64_int mr_3045 = math__log_gamma_sign(x); - f64 y = mr_3045.arg0; - return y; -} - -multi_return_f64_int math__log_gamma_sign(f64 a) { - f64 x = a; - f64 ymin = 1.461632144968362245; - f64 tiny = math__exp2(-70); - f64 two52 = math__exp2(52); - f64 two58 = math__exp2(58); - f64 tc = 1.46163214496836224576e+00; - f64 tf = -1.21486290535849611461e-01; - f64 tt = -3.63867699703950536541e-18; - int sign = 1; - if (math__is_nan(x)) { - return (multi_return_f64_int){.arg0=x, .arg1=sign}; - } - if (math__is_inf(x, 1)) { - return (multi_return_f64_int){.arg0=x, .arg1=sign}; - } - if (x == 0.0) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - bool neg = false; - if (x < 0) { - x = -x; - neg = true; - } - if (x < tiny) { - if (neg) { - sign = -1; - } - return (multi_return_f64_int){.arg0=-math__log(x), .arg1=sign}; - } - f64 nadj = 0.0; - if (neg) { - if (x >= two52) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - f64 t = math__sin_pi(x); - if (t == 0) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - nadj = math__log(_const_math__pi / math__abs_T_f64(t * x)); - if (t < 0) { - sign = -1; - } - } - f64 lgamma = 0.0; - if (x == 1 || x == 2) { - return (multi_return_f64_int){.arg0=0.0, .arg1=sign}; - } else if (x < 2) { - f64 y = 0.0; - int i = 0; - if (x <= 0.9) { - lgamma = -math__log(x); - if (x >= (ymin - 1 + 0.27)) { - y = 1.0 - x; - i = 0; - } else if (x >= (ymin - 1 - 0.27)) { - y = x - (tc - 1); - i = 1; - } else { - y = x; - i = 2; - } - } else { - lgamma = 0; - if (x >= (ymin + 0.27)) { - y = ((f64)(2)) - x; - i = 0; - } else if (x >= (ymin - 0.27)) { - y = x - tc; - i = 1; - } else { - y = x - 1; - i = 2; - } - } - if (i == 0) { - f64 z = y * y; - f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 2)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 4)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 6)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 8)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 10)))))); - f64 gamma_p2 = z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 1)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 3)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 5)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 7)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 9)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 11))))))); - f64 p = y * gamma_p1 + gamma_p2; - lgamma += (p - 0.5 * y); - } else if (i == 1) { - f64 z = y * y; - f64 w = z * y; - f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 0)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 3)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 6)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 9)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 12))))); - f64 gamma_p2 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 1)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 4)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 7)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 10)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 13))))); - f64 gamma_p3 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 2)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 5)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 8)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 11)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 14))))); - f64 p = z * gamma_p1 - (tt - w * (gamma_p2 + y * gamma_p3)); - lgamma += (tf + p); - } else if (i == 2) { - f64 gamma_p1 = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 5))))))); - f64 gamma_p2 = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 5)))))); - lgamma += (-0.5 * y + gamma_p1 / gamma_p2); - } - } else if (x < 8) { - int i = ((int)(x)); - f64 y = x - ((f64)(i)); - f64 p = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 6)))))))); - f64 q = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 6))))))); - lgamma = 0.5 * y + p / q; - f64 z = 1.0; - if (i == 7) { - z *= (y + 6); - z *= (y + 5); - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 6) { - z *= (y + 5); - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 5) { - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 4) { - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 3) { - z *= (y + 2); - lgamma += math__log(z); - } - } else if (x < two58) { - f64 t = math__log(x); - f64 z = 1.0 / x; - f64 y = z * z; - f64 w = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 6))))))); - lgamma = (x - 0.5) * (t - 1.0) + w; - } else { - lgamma = x * (math__log(x) - 1.0); - } - if (neg) { - lgamma = nadj - lgamma; - } - return (multi_return_f64_int){.arg0=lgamma, .arg1=sign}; -} - -VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_) { - f64 x = x_; - f64 two52 = math__exp2(52); - f64 two53 = math__exp2(53); - if (x < 0.25) { - return -math__sin(_const_math__pi * x); - } - f64 z = math__floor(x); - int n = 0; - if (z != x) { - x = math__mod(x, 2); - n = ((int)(x * 4)); - } else { - if (x >= two53) { - x = 0; - n = 0; - } else { - if (x < two52) { - z = x + two52; - } - n = (1 & ((int)(math__f64_bits(z)))); - x = ((f64)(n)); - n <<= 2; - } - } - if (n == 0) { - x = math__sin(_const_math__pi * x); - } else if (n == 1 || n == 2) { - x = math__cos(_const_math__pi * (0.5 - x)); - } else if (n == 3 || n == 4) { - x = math__sin(_const_math__pi * (1.0 - x)); - } else if (n == 5 || n == 6) { - x = -math__cos(_const_math__pi * (x - 1.5)); - } else { - x = math__sin(_const_math__pi * (x - 2)); - } - return -x; -} - -f64 math__hypot(f64 x, f64 y) { - if (math__is_inf(x, 0) || math__is_inf(y, 0)) { - return math__inf(1); - } - if (math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } - f64 result = 0.0; - if (x != 0.0 || y != 0.0) { - f64 abs_x = math__abs_T_f64(x); - f64 abs_y = math__abs_T_f64(y); - multi_return_f64_f64 mr_240 = math__minmax(abs_x, abs_y); - f64 min = mr_240.arg0; - f64 max = mr_240.arg1; - f64 rat = min / max; - f64 root_term = math__sqrt(1.0 + rat * rat); - if (max < _const_math__max_f64 / root_term) { - result = max * root_term; - } else { - _v_panic(_SLIT("overflow in hypot_e function")); - VUNREACHABLE(); - } - } - return result; -} - -f64 math__acosh(f64 x) { - if (x == 0.0) { - return 0.0; - } else if (x > 1.0 / _const_math__internal__sqrt_f64_epsilon) { - return math__log(x) + _const_math__pi * 2; - } else if (x > 2.0) { - return math__log(2.0 * x - 1.0 / (math__sqrt(x * x - 1.0) + x)); - } else if (x > 1.0) { - f64 t = x - 1.0; - return math__log1p(t + math__sqrt(2.0 * t + t * t)); - } else if (x == 1.0) { - return 0.0; - } else { - return math__nan(); - } - return 0; -} - -f64 math__asinh(f64 x) { - f64 a = math__abs_T_f64(x); - f64 s = (x < 0 ? (-1.0) : (1.0)); - if (a > 1.0 / _const_math__internal__sqrt_f64_epsilon) { - return s * (math__log(a) + _const_math__pi * 2.0); - } else if (a > 2.0) { - return s * math__log(2.0 * a + 1.0 / (a + math__sqrt(a * a + 1.0))); - } else if (a > _const_math__internal__sqrt_f64_epsilon) { - f64 a2 = a * a; - return s * math__log1p(a + a2 / (1.0 + math__sqrt(1.0 + a2))); - } else { - return x; - } - return 0; -} - -f64 math__atanh(f64 x) { - f64 a = math__abs_T_f64(x); - f64 s = (x < 0 ? (-1.0) : (1.0)); - if (a > 1.0) { - return math__nan(); - } else if (a == 1.0) { - return (x < 0 ? (math__inf(-1)) : (math__inf(1))); - } else if (a >= 0.5) { - return s * 0.5 * math__log1p(2.0 * a / (1.0 - a)); - } else if (a > _const_math__internal__f64_epsilon) { - return s * 0.5 * math__log1p(2.0 * a + 2.0 * a * a / (1.0 - a)); - } else { - return x; - } - return 0; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__xatan(f64 x) { - f64 xatan_p0 = -8.750608600031904122785e-01; - f64 xatan_p1 = -1.615753718733365076637e+01; - f64 xatan_p2 = -7.500855792314704667340e+01; - f64 xatan_p3 = -1.228866684490136173410e+02; - f64 xatan_p4 = -6.485021904942025371773e+01; - f64 xatan_q0 = 2.485846490142306297962e+01; - f64 xatan_q1 = 1.650270098316988542046e+02; - f64 xatan_q2 = 4.328810604912902668951e+02; - f64 xatan_q3 = 4.853903996359136964868e+02; - f64 xatan_q4 = 1.945506571482613964425e+02; - f64 z = x * x; - z = z * ((((xatan_p0 * z + xatan_p1) * z + xatan_p2) * z + xatan_p3) * z + xatan_p4) / (((((z + xatan_q0) * z + xatan_q1) * z + xatan_q2) * z + xatan_q3) * z + xatan_q4); - z = x * z + x; - return z; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__satan(f64 x) { - if (x <= 0.66) { - return math__xatan(x); - } - if (x > _const_math__tan3pio8) { - return _const_math__pi / 2.0 - math__xatan(1.0 / x) + ((f64)(_const_math__morebits)); - } - return _const_math__pi / 4 + math__xatan((x - 1.0) / (x + 1.0)) + 0.5 * ((f64)(_const_math__morebits)); -} - -f64 math__atan(f64 x) { - if (x == 0) { - return x; - } - if (x > 0) { - return math__satan(x); - } - return -math__satan(-x); -} - -f64 math__atan2(f64 y, f64 x) { - if (math__is_nan(y) || math__is_nan(x)) { - return math__nan(); - } - if (y == 0.0) { - if (x >= 0 && !math__signbit(x)) { - return math__copysign(0, y); - } - return math__copysign(_const_math__pi, y); - } - if (x == 0.0) { - return math__copysign(_const_math__pi / 2.0, y); - } - if (math__is_inf(x, 0)) { - if (math__is_inf(x, 1)) { - if (math__is_inf(y, 0)) { - return math__copysign(_const_math__pi / 4, y); - } - return math__copysign(0, y); - } - if (math__is_inf(y, 0)) { - return math__copysign(3.0 * _const_math__pi / 4.0, y); - } - return math__copysign(_const_math__pi, y); - } - if (math__is_inf(y, 0)) { - return math__copysign(_const_math__pi / 2.0, y); - } - f64 q = math__atan(y / x); - if (x < 0) { - if (q <= 0) { - return q + _const_math__pi; - } - return q - _const_math__pi; - } - return q; -} - -f64 math__asin(f64 x_) { - f64 x = x_; - if (x == 0.0) { - return x; - } - bool sign = false; - if (x < 0.0) { - x = -x; - sign = true; - } - if (x > 1.0) { - return math__nan(); - } - f64 temp = math__sqrt(1.0 - x * x); - if (x > 0.7) { - temp = _const_math__pi / 2.0 - math__satan(temp / x); - } else { - temp = math__satan(x / temp); - } - if (sign) { - temp = -temp; - } - return temp; -} - -// Attr: [inline] -inline f64 math__acos(f64 x) { - if ((x < -1.0) || (x > 1.0)) { - return math__nan(); - } - if (x > 0.5) { - return ((f64)(2.0)) * math__asin(math__sqrt(0.5 - 0.5 * x)); - } - f64 z = _const_math__pi / ((f64)(4.0)) - math__asin(x); - z = z + _const_math__morebits; - z = z + _const_math__pi / ((f64)(4.0)); - return z; -} - -f64 math__log_n(f64 x, f64 b) { - f64 y = math__log(x); - f64 z = math__log(b); - return y / z; -} - -f64 math__log10(f64 x) { - return math__log(x) * (1.0 / _const_math__ln10); -} - -f64 math__log2(f64 x) { - multi_return_f64_int mr_364 = math__frexp(x); - f64 frac = mr_364.arg0; - int exp = mr_364.arg1; - if (frac == 0.5) { - return ((f64)(exp - 1)); - } - return math__log(frac) * (1.0 / _const_math__ln2) + ((f64)(exp)); -} - -f64 math__log1p(f64 x) { - f64 y = 1.0 + x; - f64 z = y - 1.0; - return math__log(y) - (z - x) / y; -} - -f64 math__log_b(f64 x) { - if (x == 0) { - return math__inf(-1); - } - if (math__is_inf(x, 0)) { - return math__inf(1); - } - if (math__is_nan(x)) { - return x; - } - return ((f64)(math__ilog_b_(x))); -} - -int math__ilog_b(f64 x) { - if (x == 0) { - return _const_math__min_i32; - } - if (math__is_nan(x)) { - return _const_math__max_i32; - } - if (math__is_inf(x, 0)) { - return _const_math__max_i32; - } - return math__ilog_b_(x); -} - -VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_) { - multi_return_f64_int mr_1424 = math__normalize(x_); - f64 x = mr_1424.arg0; - int exp = mr_1424.arg1; - return ((int)(((math__f64_bits(x) >> _const_math__shift) & _const_math__mask))) - _const_math__bias + exp; -} - -f64 math__log(f64 a) { - f64 ln2_hi = 6.93147180369123816490e-01; - f64 ln2_lo = 1.90821492927058770002e-10; - f64 l1 = 6.666666666666735130e-01; - f64 l2 = 3.999999999940941908e-01; - f64 l3 = 2.857142874366239149e-01; - f64 l4 = 2.222219843214978396e-01; - f64 l5 = 1.818357216161805012e-01; - f64 l6 = 1.531383769920937332e-01; - f64 l7 = 1.479819860511658591e-01; - f64 x = a; - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } else if (x < 0) { - return math__nan(); - } else if (x == 0) { - return math__inf(-1); - } - multi_return_f64_int mr_4006 = math__frexp(x); - f64 f1 = mr_4006.arg0; - int ki = mr_4006.arg1; - if (f1 < _const_math__sqrt2 / 2) { - f1 *= 2; - ki--; - } - f64 f = f1 - 1; - f64 k = ((f64)(ki)); - f64 s = f / (2 + f); - f64 s2 = s * s; - f64 s4 = s2 * s2; - f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); - f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); - f64 r = t1 + t2; - f64 hfsq = 0.5 * f * f; - return k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); -} - -#if defined(_WIN32) - #if defined(__TINYC__) -#endif -#else -#endif -f64 math__aprox_sin(f64 a) { - f64 a0 = 1.91059300966915117e-31; - f64 a1 = 1.00086760103908896; - f64 a2 = -1.21276126894734565e-2; - f64 a3 = -1.38078780785773762e-1; - f64 a4 = -2.67353392911981221e-2; - f64 a5 = 2.08026600266304389e-2; - f64 a6 = -3.03996055049204407e-3; - f64 a7 = 1.38235642404333740e-4; - return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * a7)))))); -} - -f64 math__aprox_cos(f64 a) { - f64 a0 = 9.9995999154986614e-1; - f64 a1 = 1.2548995793001028e-3; - f64 a2 = -5.0648546280678015e-1; - f64 a3 = 1.2942246466519995e-2; - f64 a4 = 2.8668384702547972e-2; - f64 a5 = 7.3726485210586547e-3; - f64 a6 = -3.8510875386947414e-3; - f64 a7 = 4.7196604604366623e-4; - f64 a8 = -1.8776444013090451e-5; - return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * (a7 + a * a8))))))); -} - -// Attr: [inline] -inline f64 math__copysign(f64 x, f64 y) { - return math__f64_from_bits((((math__f64_bits(x) & ~_const_math__sign_mask)) | ((math__f64_bits(y) & _const_math__sign_mask)))); -} - -// Attr: [inline] -inline f64 math__degrees(f64 radians) { - return radians * (180.0 / _const_math__pi); -} - -Array_int math__digits(i64 num, math__DigitParams params) { - int b = params.base; - if (b < 2) { - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("digits: Cannot find digits of n with base "), /*100 &int*/0xfe07, {.d_i32 = b}}, {_SLIT0, 0, { .d_c = 0 }}}))); +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { + if (seed_data.len != 2) { + eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); + _v_exit(1); VUNREACHABLE(); } - i64 n = num; - int sign = 1; - if (n < 0) { - sign = -1; - n = -n; - } - Array_int res = __new_array_with_default(0, 0, sizeof(int), 0); - if (n == 0) { - array_push((array*)&res, _MOV((int[]){ 0 })); - return res; - } - for (;;) { - if (!(n != 0)) break; - i64 next_n = n / b; - array_push((array*)&res, _MOV((int[]){ ((int)(n - next_n * b)) })); - n = next_n; - } - if (sign == -1) { - (*(int*)array_get(res, res.len - 1)) *= sign; - } - if (params.reverse) { - res = array_reverse(res); - } - return res; -} - -int math__count_digits(i64 number) { - i64 n = number; - if (n == 0) { - return 1; - } - int c = 0; - for (;;) { - if (!(n != 0)) break; - n = n / 10; - c++; - } - return c; -} - -multi_return_f64_f64 math__minmax(f64 a, f64 b) { - if (a < b) { - return (multi_return_f64_f64){.arg0=a, .arg1=b}; - } - return (multi_return_f64_f64){.arg0=b, .arg1=a}; + rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); + rng->bytes_left = 0; + rng->buffer = 0U; } // Attr: [inline] -inline f64 math__clamp(f64 x, f64 a, f64 b) { - if (x < a) { - return a; +inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 1) { + rng->bytes_left -= 1; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t1 = value; + return _t1; } - if (x > b) { - return b; - } - return x; + rng->buffer = rand__wyrand__WyRandRNG_u64(rng); + rng->bytes_left = 7; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t2 = value; + return _t2; } // Attr: [inline] -inline f64 math__sign(f64 n) { - if (math__is_nan(n)) { - return math__nan(); +inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 2) { + rng->bytes_left -= 2; + u16 value = ((u16)(rng->buffer)); + rng->buffer >>= 16U; + u16 _t1 = value; + return _t1; } - return math__copysign(1.0, n); + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 16U; + rng->bytes_left = 6; + u16 _t2 = ((u16)(ans)); + return _t2; } // Attr: [inline] -inline int math__signi(f64 n) { - return ((int)(math__copysign(1.0, n))); +inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 4) { + rng->bytes_left -= 4; + u32 value = ((u32)(rng->buffer)); + rng->buffer >>= 32U; + u32 _t1 = value; + return _t1; + } + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 32U; + rng->bytes_left = 4; + u32 _t2 = ((u32)(ans)); + return _t2; } // Attr: [inline] -inline f64 math__radians(f64 degrees) { - return degrees * (_const_math__pi / 180.0); +inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { + { // Unsafe block + u64 seed1 = rng->state; + seed1 += _const_rand__wyrand__wyp0; + rng->state = seed1; + u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); + return _t1; + } + u64 _t2 = 0U; + return _t2; } // Attr: [inline] -inline bool math__signbit(f64 x) { - return (math__f64_bits(x) & _const_math__sign_mask) != 0U; +inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { + int _t1 = 64; + return _t1; } -bool math__tolerance(f64 a, f64 b, f64 tol) { - f64 ee = tol; - if (a == b) { - return true; - } - f64 d = a - b; - if (d < 0) { - d = -d; - } - if (b != 0) { - ee = ee * b; - if (ee < 0) { - ee = -ee; - } - } - return d < ee; -} - -bool math__close(f64 a, f64 b) { - return math__tolerance(a, b, 1e-14); -} - -bool math__veryclose(f64 a, f64 b) { - return math__tolerance(a, b, 4e-16); -} - -bool math__alike(f64 a, f64 b) { - if (math__is_nan(a) && math__is_nan(b)) { - return true; - } else if (a == b) { - return math__signbit(a) == math__signbit(b); - } - return false; -} - -VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x) { - multi_return_f64_f64 mr_4654 = math__modf(x); - f64 xi = mr_4654.arg0; - f64 xf = mr_4654.arg1; - return xf == 0 && ((((i64)(xi)) & 1)) == 1; -} - -VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x) { - if (x < 0) { - multi_return_f64_f64 mr_4754 = math__modf(x); - f64 xf = mr_4754.arg1; - return xf == 0; - } - return false; -} - -// Attr: [inline] -inline int math__min_T_int(int a, int b) { - return (a < b ? (a) : (b)); -} - -// Attr: [inline] -inline f64 math__abs_T_f64(f64 a) { - return (a < 0 ? (-a) : (a)); -} - -multi_return_f64_f64 math__modf(f64 f) { - f64 abs_f = math__abs_T_f64(f); - f64 i = 0.0; - if (abs_f >= _const_math__modf_maxpowtwo) { - i = f; - } else { - i = abs_f + _const_math__modf_maxpowtwo; - i -= _const_math__modf_maxpowtwo; - for (;;) { - if (!(i > abs_f)) break; - i -= 1.0; - } - if (f < 0.0) { - i = -i; - } - } - return (multi_return_f64_f64){.arg0=i, .arg1=f - i}; -} - -f32 math__nextafter32(f32 x, f32 y) { - f32 r = ((f32)(0.0)); - if (math__is_nan(((f64)(x))) || math__is_nan(((f64)(y)))) { - r = ((f32)(math__nan())); - } else if (x == y) { - r = x; - } else if (x == 0) { - r = ((f32)(math__copysign(((f64)(math__f32_from_bits(1U))), ((f64)(y))))); - } else if ((y > x) == (x > 0)) { - r = math__f32_from_bits(math__f32_bits(x) + 1U); - } else { - r = math__f32_from_bits(math__f32_bits(x) - 1U); - } - return r; -} - -f64 math__nextafter(f64 x, f64 y) { - f64 r = 0.0; - if (math__is_nan(x) || math__is_nan(y)) { - r = math__nan(); - } else if (x == y) { - r = x; - } else if (x == 0) { - r = math__copysign(math__f64_from_bits(1U), y); - } else if ((y > x) == (x > 0)) { - r = math__f64_from_bits(math__f64_bits(x) + 1U); - } else { - r = math__f64_from_bits(math__f64_bits(x) - 1U); - } - return r; -} - -VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x) { - if (c.len == 0) { - _v_panic(_SLIT("coeficients can not be empty")); - VUNREACHABLE(); - } - int len = ((int)(math__min_T_int(c.len, n))); - f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); - Array_f64 _t1 = array_slice(c, 0, len - 1); - for (int _t2 = 0; _t2 < _t1.len; ++_t2) { - f64 e = ((f64*)_t1.data)[_t2]; - ans = e + x * ans; - } - return ans; -} - -VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x) { - if (c.len == 0) { - _v_panic(_SLIT("coeficients can not be empty")); - VUNREACHABLE(); - } - int len = ((int)(math__min_T_int(c.len, n))) - 1; - f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); - Array_f64 _t1 = array_slice(c, 0, len - 1); - for (int _t2 = 0; _t2 < _t1.len; ++_t2) { - f64 e = ((f64*)_t1.data)[_t2]; - ans = e + x * ans; - } - return ans; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x) { - return math__poly_n_eval(c, c.len, x); -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x) { - return math__poly_n_1_eval(c, c.len, x); -} - -VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x) { - f64 d = 0.0; - f64 dd = 0.0; - f64 y = (2.0 * x - cs.a - cs.b) / (cs.b - cs.a); - f64 y2 = 2.0 * y; - f64 e_ = 0.0; - f64 temp = 0.0; - for (int j = cs.order; j >= 1; j--) { - temp = d; - d = y2 * d - dd + (*(f64*)/*ee elem_sym */array_get(cs.c, j)); - e_ += math__abs_T_f64(y2 * temp) + math__abs_T_f64(dd) + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, j))); - dd = temp; - } - temp = d; - d = y * d - dd + 0.5 * (*(f64*)/*ee elem_sym */array_get(cs.c, 0)); - e_ += math__abs_T_f64(y * temp) + math__abs_T_f64(dd) + 0.5 * math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, 0))); - return (multi_return_f64_f64){.arg0=d, .arg1=((f64)(_const_math__internal__f64_epsilon)) * e_ + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, cs.order)))}; -} - -// Attr: [inline] -inline f32 math__powf(f32 a, f32 b) { - return powf(a, b); -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b) { - return ((f32)(math__pow(a, b))); -} - -f64 math__pow10(int n) { - if (0 <= n && n <= 308) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10postab32, ((u32)(n)) / 32U)) * (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(n)) % 32U)); - } - if (-323 <= n && n <= 0) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10negtab32, ((u32)(-n)) / 32U)) / (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(-n)) % 32U)); - } - if (n > 0) { - return math__inf(1); - } - return 0.0; -} - -i64 math__powi(i64 a, i64 b) { - i64 b_ = b; - i64 p = a; - i64 v = ((i64)(1)); - if (b_ < 0) { - if (a == 0) { - return -1; - } - return (a * a != 1 ? (0) : ((((b_ & 1)) > 0 ? (a) : (1)))); - } - for (; b_ > 0; ) { - if ((b_ & 1) > 0) { - v *= p; - } - p *= p; - b_ >>= 1; - } - return v; -} - -f64 math__pow(f64 x, f64 y) { - if (y == 0 || x == 1) { - return 1; - } else if (y == 1) { - return x; - } else if (math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } else if (x == 0) { - if (y < 0) { - if (math__is_odd_int(y)) { - return math__copysign(math__inf(1), x); - } - return math__inf(1); - } else if (y > 0) { - if (math__is_odd_int(y)) { - return x; - } - return 0; - } - } else if (math__is_inf(y, 0)) { - if (x == -1) { - return 1; - } else if ((math__abs_T_f64(x) < 1) == math__is_inf(y, 1)) { - return 0; - } else { - return math__inf(1); - } - } else if (math__is_inf(x, 0)) { - if (math__is_inf(x, -1)) { - return math__pow(1 / x, -y); - } - if (y < 0) { - return 0; - } else if (y > 0) { - return math__inf(1); - } - } else if (y == 0.5) { - return math__sqrt(x); - } else if (y == -0.5) { - return 1 / math__sqrt(x); - } - multi_return_f64_f64 mr_2400 = math__modf(math__abs_T_f64(y)); - f64 yi = mr_2400.arg0; - f64 yf = mr_2400.arg1; - if (yf != 0 && x < 0) { - return math__nan(); - } - if (yi >= (((u64)(1U)) << 63U)) { - if (x == -1) { - return 1; - } else if ((math__abs_T_f64(x) < 1) == (y > 0)) { - return 0; - } else { - return math__inf(1); - } - } - f64 a1 = 1.0; - int ae = 0; - if (yf != 0) { - if (yf > 0.5) { - yf--; - yi++; - } - a1 = math__exp(yf * math__log(x)); - } - multi_return_f64_int mr_3038 = math__frexp(x); - f64 x1 = mr_3038.arg0; - int xe = mr_3038.arg1; - for (i64 i = ((i64)(yi)); i != 0; i >>= 1) { - if (xe < ((int)(((u32)(((u32)(-1)) << 12U)))) || 4096 < xe) { - ae += xe; - break; - } - if ((i & 1) == 1) { - a1 *= x1; - ae += xe; - } - x1 *= x1; - xe <<= 1; - if (x1 < .5) { - x1 += x1; - xe--; - } - } - if (y < 0) { - a1 = 1 / a1; - ae = -ae; - } - return math__ldexp(a1, ae); -} - -// Attr: [inline] -inline f64 math__q_rsqrt(f64 x) { - f64 x_half = 0.5 * x; - i64 i = ((i64)(math__f64_bits(x))); - i = 0x5fe6eb50c7b537a9 - (i >> 1); - f64 j = math__f64_from_bits(((u64)(i))); - j *= (1.5 - x_half * j * j); - j *= (1.5 - x_half * j * j); - return j; -} - -f64 math__scalbn(f64 x, int n_) { - int n = n_; - f64 x1p1023 = math__f64_from_bits(((u64)(0x7fe0000000000000U))); - f64 x1p53 = math__f64_from_bits(((u64)(0x4340000000000000U))); - f64 x1p_1022 = math__f64_from_bits(((u64)(0x0010000000000000U))); - f64 y = x; - if (n > 1023) { - y *= x1p1023; - n -= 1023; - if (n > 1023) { - y *= x1p1023; - n -= 1023; - if (n > 1023) { - n = 1023; - } - } - } else if (n < -1022) { - y *= x1p_1022 * x1p53; - n += 969; - if (n < -1022) { - y *= x1p_1022 * x1p53; - n += 969; - if (n < -1022) { - n = -1022; - } - } - } - return y * math__f64_from_bits(((u64)((0x3ff + n))) << 52U); -} - -// Attr: [inline] -inline f32 math__cosf(f32 a) { - return cosf(a); -} - -// Attr: [inline] -inline f32 math__sinf(f32 a) { - return sinf(a); -} - -f64 math__sin(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - int sgn_x = (x < 0 ? (-1) : (1)); - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return x * (1.0 - x2 / 6.0); - } else { - int sgn_result = sgn_x; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result = -sgn_result; - } - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 result = 0.0; - if (octant == 0) { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_1676 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_1676.arg0; - result = z * (1.0 + z * z * sin_cs_val); - } else { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_1804 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_1804.arg0; - result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } - result *= sgn_result; - return result; - } - return 0; -} - -f64 math__cos(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return 1.0 - 0.5 * x2; - } else { - int sgn_result = 1; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result = -sgn_result; - } - if (octant > 1) { - sgn_result = -sgn_result; - } - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 result = 0.0; - if (octant == 0) { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_2597 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_2597.arg0; - result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } else { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_2741 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_2741.arg0; - result = z * (1.0 + z * z * sin_cs_val); - } - result *= sgn_result; - return result; - } - return 0; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_cosf(f32 a) { - return ((f32)(math__cos(a))); -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_sinf(f32 a) { - return ((f32)(math__sin(a))); -} - -multi_return_f64_f64 math__sincos(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - int sgn_x = (x < 0 ? (-1) : (1)); - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return (multi_return_f64_f64){.arg0=x * (1.0 - x2 / 6.0), .arg1=1.0 - 0.5 * x2}; - } else { - int sgn_result_sin = sgn_x; - int sgn_result_cos = 1; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result_sin = -sgn_result_sin; - sgn_result_cos = -sgn_result_cos; - } - sgn_result_cos = (octant > 1 ? (-sgn_result_cos) : (sgn_result_cos)); - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_3838 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_3838.arg0; - multi_return_f64_f64 mr_3879 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_3879.arg0; - f64 result_sin = 0.0; - f64 result_cos = 0.0; - if (octant == 0) { - result_sin = z * (1.0 + z * z * sin_cs_val); - result_cos = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } else { - result_sin = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - result_cos = z * (1.0 + z * z * sin_cs_val); - } - result_sin *= sgn_result_sin; - result_cos *= sgn_result_cos; - return (multi_return_f64_f64){.arg0=result_sin, .arg1=result_cos}; - } - return (multi_return_f64_f64){0}; -} - -f64 math__sinh(f64 x_) { - f64 x = x_; - f64 p0 = -0.6307673640497716991184787251e+6; - f64 p1 = -0.8991272022039509355398013511e+5; - f64 p2 = -0.2894211355989563807284660366e+4; - f64 p3 = -0.2630563213397497062819489e+2; - f64 q0 = -0.6307673640497716991212077277e+6; - f64 q1 = 0.1521517378790019070696485176e+5; - f64 q2 = -0.173678953558233699533450911e+3; - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - f64 temp = 0.0; - if (x > 21) { - temp = math__exp(x) * 0.5; - } else if (x > 0.5) { - f64 ex = math__exp(x); - temp = (ex - 1.0 / ex) * 0.5; - } else { - f64 sq = x * x; - temp = (((p3 * sq + p2) * sq + p1) * sq + p0) * x; - temp = temp / (((sq + q2) * sq + q1) * sq + q0); - } - if (sign) { - temp = -temp; - } - return temp; -} - -f64 math__cosh(f64 x) { - f64 abs_x = math__abs_T_f64(x); - if (abs_x > 21) { - return math__exp(abs_x) * 0.5; - } - f64 ex = math__exp(abs_x); - return (ex + 1.0 / ex) * 0.5; -} - -// Attr: [inline] -inline f32 math__sqrtf(f32 a) { - return sqrtf(a); -} - -// Attr: [inline] -inline f64 math__sqrt(f64 a) { - f64 x = a; - if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (x < 0.0) { - return math__nan(); - } - multi_return_f64_int mr_258 = math__frexp(x); - f64 z = mr_258.arg0; - int ex = mr_258.arg1; - f64 w = x; - x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; - if (((ex & 1)) != 0) { - x *= _const_math__sqrt2; - } - x = math__ldexp(x, ex >> 1); - x = 0.5 * (x + w / x); - x = 0.5 * (x + w / x); - x = 0.5 * (x + w / x); - return x; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a) { - return ((f32)(math__sqrt(a))); -} - -i64 math__sqrti(i64 a) { - i64 x = a; - i64 q = ((i64)(1)); - i64 r = ((i64)(0)); - for (; q <= x; ) { - q <<= 2; - } - for (; q > 1; ) { - q >>= 2; - i64 t = x - r - q; - r >>= 1; - if (t >= 0) { - x = t; - r += q; - } - } - return r; -} - -// Attr: [inline] -inline f32 math__tanf(f32 a) { - return tanf(a); -} - -f64 math__tan(f64 a) { - f64 x = a; - if (x == 0.0 || math__is_nan(x)) { - return x; - } - if (math__is_inf(x, 0)) { - return math__nan(); - } - int sign = 1; - if (x < 0) { - x = -x; - sign = -1; - } - if (x > _const_math__tan_lossth) { - return 0.0; - } - f64 y = math__floor(x * 4.0 / _const_math__pi); - f64 z = math__ldexp(y, -3); - z = math__floor(z); - z = y - math__ldexp(z, 3); - int octant = ((int)(z)); - if (((octant & 1)) == 1) { - octant++; - y += 1.0; - } - z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; - f64 zz = z * z; - if (zz > 1.0e-14) { - y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); - } else { - y = z; - } - if (((octant & 2)) == 2) { - y = -1.0 / y; - } - if (sign < 0) { - y = -y; - } - return y; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_tanf(f32 a) { - return ((f32)(math__tan(a))); -} - -f64 math__cot(f64 a) { - f64 x = a; - if (x == 0.0) { - return math__inf(1); - } - int sign = 1; - if (x < 0) { - x = -x; - sign = -1; - } - if (x > _const_math__tan_lossth) { - return 0.0; - } - f64 y = math__floor(x * 4.0 / _const_math__pi); - f64 z = math__ldexp(y, -3); - z = math__floor(z); - z = y - math__ldexp(z, 3); - int octant = ((int)(z)); - if (((octant & 1)) == 1) { - octant++; - y += 1.0; - } - z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; - f64 zz = z * z; - if (zz > 1.0e-14) { - y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); - } else { - y = z; - } - if (((octant & 2)) == 2) { - y = -y; - } else { - y = 1.0 / y; - } - if (sign < 0) { - y = -y; - } - return y; -} - -f64 math__tanh(f64 x) { - f64 maxlog = 8.8029691931113054295988e+01; - f64 z = math__abs_T_f64(x); - if (z > 0.5 * maxlog) { - if (x < 0) { - return ((f64)(-1)); - } - return 1.0; - } else if (z >= 0.625) { - f64 s = math__exp(2.0 * z); - z = 1.0 - 2.0 / (s + 1.0); - if (x < 0) { - z = -z; - } - } else { - if (x == 0) { - return x; - } - f64 s = x * x; - z = x + x * s * (((*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 0)) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 2))) / (((s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 0))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 2))); - } - return z; -} - -u32 math__f32_bits(f32 f) { - u32 p = *((u32*)(&f)); - return p; -} - -f32 math__f32_from_bits(u32 b) { - f32 p = *((f32*)(&b)); - return p; -} - -u64 math__f64_bits(f64 f) { - u64 p = *((u64*)(&f)); - return p; -} - -f64 math__f64_from_bits(u64 b) { - f64 p = *((f64*)(&b)); - return p; -} - -f64 math__with_set_low_word(f64 f, u32 lo) { - u64 tmp = math__f64_bits(f); - tmp &= 0xffffffff00000000U; - tmp |= ((u64)(lo)); - return math__f64_from_bits(tmp); -} - -f64 math__with_set_high_word(f64 f, u32 hi) { - u64 tmp = math__f64_bits(f); - tmp &= 0x00000000ffffffffU; - tmp |= ((u64)(hi)) << 32U; - return math__f64_from_bits(tmp); -} - -u32 math__get_high_word(f64 f) { - return ((u32)(math__f64_bits(f) >> 32U)); +// Attr: [unsafe] +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { + _v_free(rng); } VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod) { @@ -35213,7 +34821,7 @@ _option_string v__pkgconfig__Main_run(v__pkgconfig__Main* m) { _option_string _t4 = v__pkgconfig__PkgConfig_extend(pc, pcdep); if (_t4.state != 0) { /*or block*/ _option_string _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35549,7 +35157,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_requires(v__pkgconfig_ _option_void _t2 = v__pkgconfig__PkgConfig_load_require(pc, dep); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_void _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -35560,7 +35168,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_requires(v__pkgconfig_ _option_void _t5 = v__pkgconfig__PkgConfig_load_require(pc, dep); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -35587,7 +35195,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_require(v__pkgconfig__ _option_void _t4 = v__pkgconfig__PkgConfig_load_requires(&pcdep); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { _option_void _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35595,7 +35203,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_require(v__pkgconfig__ _option_string _t6 = v__pkgconfig__PkgConfig_extend(pc, (voidptr)&/*qq*/pcdep); if (_t6.state != 0) { /*or block*/ _option_void _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -35652,7 +35260,7 @@ _option_v__pkgconfig__PkgConfig_ptr v__pkgconfig__load(string pkgname, v__pkgcon _option_void _t4 = v__pkgconfig__PkgConfig_load_requires(pc); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { _option_v__pkgconfig__PkgConfig_ptr _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35753,1771 +35361,124 @@ int runtime__nr_cpus(void) { return _t1; } -i64 time__portable_timegm(struct tm* t) { - int year = t->tm_year + 1900; - int month = t->tm_mon; - if (month > 11) { - year += month / 12; - month %= 12; - } else if (month < 0) { - int years_diff = (11 - month) / 12; - year -= years_diff; - month += 12 * years_diff; - } - i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); - i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; - return _t1; -} - -int time__days_from_civil(int oy, int m, int d) { - int y = (m <= 2 ? (oy - 1) : (oy)); - int era = y / 400; - int yoe = y - era * 400; - int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; - int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - int _t1 = era * 146097 + doe - 719468; - return _t1; -} - -string time__Time_format(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_milli(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_micro(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_hhmm(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; -} - -string time__Time_hhmmss(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); - return _t1; -} - -string time__Time_hhmm12(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; -} - -string time__Time_ymmdd(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_ddmmy(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); - return _t1; -} - -string time__Time_md(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); - return _t1; -} - -VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { - if (n > 3 && n < 21) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a) { + if (a == 0) { + f64 _t1 = a; return _t1; } - int _t2 = n % 10; - - if (_t2 == (1)) { - string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); - return _t3; + f64 x = a; + multi_return_f64_int mr_866 = rand__frexp(x); + f64 z = mr_866.arg0; + int ex = mr_866.arg1; + f64 w = x; + x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; + if (((ex & 1)) != 0) { + x *= _const_rand__sqrt2; } - else if (_t2 == (2)) { - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); - return _t4; - } - else if (_t2 == (3)) { - string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); - return _t5; - } - else { - string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); - return _t6; - }; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string time__Time_custom_format(time__Time t, string s) { - Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); - for (int i = 0; i < s.len; ) { - for (int j = 4; j > 0; j--) { - if (i > s.len - j) { - continue; - } - if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { - array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); - i += (j - 1); - break; - } - } - i++; - } - strings__Builder sb = strings__new_builder(128); - for (int _t2 = 0; _t2 < tokens.len; ++_t2) { - string token = ((string*)tokens.data)[_t2]; - - if (string__eq(token, _SLIT("M"))) { - strings__Builder_write_string(&sb, int_str(t.month)); - } - else if (string__eq(token, _SLIT("MM"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Mo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); - } - else if (string__eq(token, _SLIT("MMM"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); - } - else if (string__eq(token, _SLIT("MMMM"))) { - strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); - } - else if (string__eq(token, _SLIT("D"))) { - strings__Builder_write_string(&sb, int_str(t.day)); - } - else if (string__eq(token, _SLIT("DD"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Do"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); - } - else if (string__eq(token, _SLIT("DDD"))) { - strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); - } - else if (string__eq(token, _SLIT("DDDD"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("DDDo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); - } - else if (string__eq(token, _SLIT("d"))) { - strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); - } - else if (string__eq(token, _SLIT("dd"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); - } - else if (string__eq(token, _SLIT("ddd"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); - } - else if (string__eq(token, _SLIT("dddd"))) { - strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); - } - else if (string__eq(token, _SLIT("YY"))) { - strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); - } - else if (string__eq(token, _SLIT("YYYY"))) { - strings__Builder_write_string(&sb, int_str(t.year)); - } - else if (string__eq(token, _SLIT("H"))) { - strings__Builder_write_string(&sb, int_str(t.hour)); - } - else if (string__eq(token, _SLIT("HH"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("h"))) { - strings__Builder_write_string(&sb, int_str((t.hour % 12))); - } - else if (string__eq(token, _SLIT("hh"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("m"))) { - strings__Builder_write_string(&sb, int_str(t.minute)); - } - else if (string__eq(token, _SLIT("mm"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("s"))) { - strings__Builder_write_string(&sb, int_str(t.second)); - } - else if (string__eq(token, _SLIT("ss"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("k"))) { - strings__Builder_write_string(&sb, int_str((t.hour + 1))); - } - else if (string__eq(token, _SLIT("kk"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("w"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1000f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("ww"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x8005002f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("wo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); - } - else if (string__eq(token, _SLIT("Q"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("QQ"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Qo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); - } - else if (string__eq(token, _SLIT("c"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("N"))) { - strings__Builder_write_string(&sb, _SLIT("AD")); - } - else if (string__eq(token, _SLIT("NN"))) { - strings__Builder_write_string(&sb, _SLIT("Anno Domini")); - } - else if (string__eq(token, _SLIT("Z"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("ZZ"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("ZZZ"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("a"))) { - if (t.hour > 12) { - strings__Builder_write_string(&sb, _SLIT("pm")); - } else { - strings__Builder_write_string(&sb, _SLIT("am")); - } - } - else if (string__eq(token, _SLIT("A"))) { - if (t.hour > 12) { - strings__Builder_write_string(&sb, _SLIT("PM")); - } else { - strings__Builder_write_string(&sb, _SLIT("AM")); - } - } - else { - strings__Builder_write_string(&sb, token); - }; - } - string _t3 = strings__Builder_str(&sb); - return _t3; -} - -string time__Time_clean(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_clean12(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } - string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); - int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); - string _t3 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_time) { - case time__FormatTime__hhmm12: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmm24: - { - _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss12: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_milli: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_micro: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__no_time: - default: - { - _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatTime*/0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string _t2 = _t3; + x = rand__scalbn(x, ex >> 1); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + f64 _t2 = x; return _t2; } -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - string _t1 = _SLIT(""); - return _t1; +VV_LOCAL_SYMBOL f64 rand__mlog(f64 a) { + f64 ln2_lo = 1.90821492927058770002e-10; + f64 ln2_hi = 0.693147180369123816490; + f64 l1 = 0.6666666666666735130; + f64 l2 = 0.3999999999940941908; + f64 l3 = 0.2857142874366239149; + f64 l4 = 0.2222219843214978396; + f64 l5 = 0.1818357216161805012; + f64 l6 = 0.1531383769920937332; + f64 l7 = 0.1479819860511658591; + f64 x = a; + multi_return_f64_int mr_1643 = rand__frexp(x); + f64 f1 = mr_1643.arg0; + int ki = mr_1643.arg1; + if (f1 < _const_rand__sqrt2 / 2) { + f1 *= 2; + ki--; } - string month = time__Time_smonth(&t); - string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); - string _t2 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_date) { - case time__FormatDate__ddmmyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__ddmmyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmdd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yyyymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__no_date: - default: - { - _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatDate*/0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string res = _t2; - string del = ((fmt_dlmtr == (time__FormatDelimiter__dot))? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen))? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash))? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space))? (_SLIT(" ")) : (_SLIT(""))); - res = string_replace(res, _SLIT("|"), del); - string _t3 = res; - return _t3; + f64 f = f1 - 1; + f64 k = ((f64)(ki)); + f64 s = f / (2 + f); + f64 s2 = s * s; + f64 s4 = s2 * s2; + f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); + f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); + f64 r = t1 + t2; + f64 hfsq = 0.5 * f * f; + f64 _t1 = k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); + return _t1; } -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } else { - string _t2 = time__Time_get_fmt_time_str(t, fmt_time); - return _t2; - } - } else { - if (fmt_time != time__FormatTime__no_time) { - string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - string tstr = time__Time_get_fmt_time_str(t, fmt_time); - string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dstr}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } else { - string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - return _t4; +VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x) { + u64 y = rand__f64_bits(x); + int ee = ((int)(((y >> 52U) & 0x7ffU))); + if (ee == 0) { + if (x != 0.0) { + f64 x1p64 = rand__f64_from_bits(((u64)(0x43f0000000000000U))); + multi_return_f64_int mr_2139 = rand__frexp(x * x1p64); + f64 z = mr_2139.arg0; + int e_ = mr_2139.arg1; + return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; } + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } else if (ee == 0x7ff) { + return (multi_return_f64_int){.arg0=x, .arg1=0}; } - return (string){.str=(byteptr)"", .is_lit=1}; + int e_ = ee - 0x3fe; + y &= ((u64)(0x800fffffffffffffU)); + y |= ((u64)(0x3fe0000000000000U)); + return (multi_return_f64_int){.arg0=rand__f64_from_bits(y), .arg1=e_}; } -string time__Time_utc_string(time__Time t) { - string day_str = time__Time_weekday_str(&t); - string month_str = time__Time_smonth(&t); - string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = day_str}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = month_str}}, {_SLIT(" "), /*100 &int*/0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); - string _t1 = utc_string; +VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_) { + int n = n_; + f64 x1p1023 = rand__f64_from_bits(((u64)(0x7fe0000000000000U))); + f64 x1p53 = rand__f64_from_bits(((u64)(0x4340000000000000U))); + f64 x1p_1022 = rand__f64_from_bits(((u64)(0x0010000000000000U))); + f64 y = x; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + n = 1023; + } + } + } else if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + n = -1022; + } + } + } + f64 _t1 = y * rand__f64_from_bits(((u64)((0x3ff + n))) << 52U); return _t1; } // Attr: [inline] -inline bool time__Time__eq(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; +inline VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b) { + f64 _t1 = *((f64*)(&b)); return _t1; } // Attr: [inline] -inline bool time__Time__lt(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); +inline VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f) { + u64 _t1 = *((u64*)(&f)); return _t1; } -// Attr: [inline] -inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { - i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; - i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; - time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; - return _t1; -} - -_option_time__Time time__parse_rfc3339(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); - _option_time__Time _t2 = time__parse_iso8601(sn); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - } - - time__Time t = (*(time__Time*)_t2.data); - if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { - _option_time__Time _t3; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t3), sizeof(time__Time)); - return _t3; - } - _option_int _t4 = string_index(sn, _SLIT("T")); - if (_t4.state != 0) { /*or block*/ - IError err = _t4.err; - *(int*) _t4.data = -1; - } - - int t_i = (*(int*)_t4.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); - if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { - _option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); - if (_t5.state != 0) { /*or block*/ - _option_time__Time _t6; - memcpy(&_t6, &_t5, sizeof(Option)); - return _t6; - } - - multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); - int year = mr_1001.arg0; - int month = mr_1001.arg1; - int day = mr_1001.arg2; - t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); - _option_time__Time _t7; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t7), sizeof(time__Time)); - return _t7; - } - if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - _option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t8.state != 0) { /*or block*/ - _option_time__Time _t9; - memcpy(&_t9, &_t8, sizeof(Option)); - return _t9; - } - - multi_return_int_int_int_int_i64_bool mr_1383 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); - hour_ = mr_1383.arg0; - minute_ = mr_1383.arg1; - second_ = mr_1383.arg2; - microsecond_ = mr_1383.arg3; - unix_offset = mr_1383.arg4; - is_local_time = mr_1383.arg5; - t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); - if (is_local_time) { - _option_time__Time _t10; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t10), sizeof(time__Time)); - return _t10; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - _option_time__Time _t11; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t11), sizeof(time__Time)); - return _t11; - } - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -_option_time__Time time__parse(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t2 = string_index(s, _SLIT(" ")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t2.data); - string symd = string_substr(s, 0, pos); - Array_string ymd = string_split(symd, _SLIT("-")); - if (ymd.len != 3) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string shms = string_substr(s, pos, (s).len); - Array_string hms = string_split(shms, _SLIT(":")); - string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); - string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); - string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); - int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); - int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); - int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); - int ihour = string_int(hour_); - int iminute = string_int(minute_); - int isecond = string_int(second_); - if (iyear > 9999 || iyear < -9999) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (imonth > 12 || imonth < 1) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iday > 31 || iday < 1) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (ihour > 23 || ihour < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iminute > 59 || iminute < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (isecond > 59 || isecond < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - time__Time res = time__new_time(((time__Time){ - .year = iyear, - .month = imonth, - .day = iday, - .hour = ihour, - .minute = iminute, - .second = isecond, - .microsecond = 0, - ._v_unix = 0, - .is_local = 0, - })); - _option_time__Time _t11; - opt_ok2(&(time__Time[]) { res }, (_option*)(&_t11), sizeof(time__Time)); - return _t11; -} - -_option_time__Time time__parse_iso8601(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t2 = string_index(s, _SLIT("T")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(int*) _t2.data = -1; - } - - int t_i = (*(int*)_t2.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); - if (!(parts.len == 1 || parts.len == 2)) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t4.state != 0) { /*or block*/ - _option_time__Time _t5; - memcpy(&_t5, &_t4, sizeof(Option)); - return _t5; - } - - multi_return_int_int_int mr_3644 = (*(multi_return_int_int_int*)_t4.data); - int year = mr_3644.arg0; - int month = mr_3644.arg1; - int day = mr_3644.arg2; - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - if (parts.len == 2) { - _option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); - if (_t6.state != 0) { /*or block*/ - _option_time__Time _t7; - memcpy(&_t7, &_t6, sizeof(Option)); - return _t7; - } - - multi_return_int_int_int_int_i64_bool mr_3885 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); - hour_ = mr_3885.arg0; - minute_ = mr_3885.arg1; - second_ = mr_3885.arg2; - microsecond_ = mr_3885.arg3; - unix_offset = mr_3885.arg4; - is_local_time = mr_3885.arg5; - } - time__Time t = time__new_time(((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hour_, - .minute = minute_, - .second = second_, - .microsecond = microsecond_, - ._v_unix = 0, - .is_local = 0, - })); - if (is_local_time) { - _option_time__Time _t8; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t8), sizeof(time__Time)); - return _t8; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - _option_time__Time _t9; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t9), sizeof(time__Time)); - return _t9; -} - -_option_time__Time time__parse_rfc2822(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Array_string fields = string_split(s, _SLIT(" ")); - if (fields.len < 5) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t3.data); - int mm = pos / 3 + 1; - { // Unsafe block - u8* tmstr = malloc_noscan(s.len * 2); - int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); - _option_time__Time _t5 = time__parse(tos(tmstr, count)); - return _t5; - } - return (_option_time__Time){0}; -} - -VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s) { - int year = 0; - int month = 0; - int day = 0; - u8 dummy = ((u8)(0)); - int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); - if (count != 3) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (year > 9999) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (month > 12) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (day > 31) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_multi_return_int_int_int _t5; - opt_ok2(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (_option*)(&_t5), sizeof(multi_return_int_int_int)); - return _t5; -} - -VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - int nanosecond_ = 0; - rune plus_min_z = 'a'; - int offset_hour = 0; - int offset_minute = 0; - int count = 0; - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%9d%c", &hour_, &minute_, &second_, &nanosecond_, ((char*)(&plus_min_z))); - if (count == 5 && plus_min_z == 'Z') { - int ndigits = 0; - _option_int _t1; - if (_t1 = string_index(s, _SLIT(".")), _t1.state == 0) { - int pos = *(int*)_t1.data; - pos++; - for (; pos < s.len && u8_is_digit(string_at(s, pos)); pos++) { - ndigits++; - } - } - for (;;) { - if (!(ndigits < 9)) break; - nanosecond_ *= 10; - ndigits++; - } - microsecond_ = nanosecond_ / 1000; - } else { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - if (count < 4) { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - count++; - } - if (count < 4) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - } - bool is_local_time = plus_min_z == 'a' && count == 4; - bool is_utc = plus_min_z == 'Z' && count == 5; - if (!(count == 7 || is_local_time || is_utc)) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int unix_offset = 0; - if (offset_hour > 0) { - unix_offset += 3600 * offset_hour; - } - if (offset_minute > 0) { - unix_offset += 60 * offset_minute; - } - if (plus_min_z == '+') { - unix_offset *= -1; - } - _option_multi_return_int_int_int_int_i64_bool _t5; - opt_ok2(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (_option*)(&_t5), sizeof(multi_return_int_int_int_int_i64_bool)); - return _t5; -} - -string time__TimeParseError_msg(time__TimeParseError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), /*100 &int*/0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { - IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); - return _t1; -} - -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { - u64 initial = ((u64)(0U)); - if (opts.auto_start) { - initial = time__sys_mono_now(); - } - time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); - return _t1; -} - -void time__StopWatch_start(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; -} - -void time__StopWatch_restart(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; - t->elapsed = 0U; -} - -void time__StopWatch_stop(time__StopWatch* t) { - t->end = time__sys_mono_now(); -} - -void time__StopWatch_pause(time__StopWatch* t) { - if (t->start > 0U) { - if (t->end == 0U) { - t->elapsed += time__sys_mono_now() - t->start; - } else { - t->elapsed += t->end - t->start; - } - } - t->start = 0U; -} - -time__Duration time__StopWatch_elapsed(time__StopWatch t) { - if (t.start > 0U) { - if (t.end == 0U) { - time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); - return _t1; - } else { - time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); - return _t2; - } - } - time__Duration _t3 = ((((i64)(t.elapsed)))); - return _t3; -} - -time__Time time__now(void) { - #if defined(__APPLE__) - { - time__Time _t1 = time__darwin_now(); - return _t1; - } - #endif - #if defined(_WIN32) - { - time__Time _t2 = time__win_now(); - return _t2; - } - #endif - #if defined(__sun) - { - time__Time _t3 = time__solaris_now(); - return _t3; - } - #endif - #if defined(__linux__) || defined(__ANDROID__) - { - time__Time _t4 = time__linux_now(); - return _t4; - } - #endif - time_t t = time(0); - struct tm* now = localtime(&t); - time__Time _t5 = time__convert_ctime(*now, 0); - return _t5; -} - -time__Time time__utc(void) { - #if defined(__APPLE__) - { - time__Time _t1 = time__darwin_utc(); - return _t1; - } - #endif - #if defined(_WIN32) - { - time__Time _t2 = time__win_utc(); - return _t2; - } - #endif - #if defined(__sun) - { - time__Time _t3 = time__solaris_utc(); - return _t3; - } - #endif - #if defined(__linux__) || defined(__ANDROID__) - { - time__Time _t4 = time__linux_utc(); - return _t4; - } - #endif - time_t t = time(0); - time(&t); - time__Time _t5 = time__unix2(((i64)(t)), 0); - return _t5; -} - -time__Time time__new_time(time__Time t) { - if (t._v_unix != 0) { - time__Time _t1 = t; - return _t1; - } - struct tm tt = ((struct tm){ - .tm_sec = t.second, - .tm_min = t.minute, - .tm_hour = t.hour, - .tm_mday = t.day, - .tm_mon = t.month - 1, - .tm_year = t.year - 1900, - .tm_wday = 0, - .tm_yday = 0, - .tm_isdst = 0, - }); - i64 utime = time__make_unix_time(tt); - time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); - return _t2; -} - -i64 time__ticks(void) { - #if defined(_WIN32) - { - i64 _t1 = GetTickCount(); - return _t1; - } - #else - { - struct timeval ts = ((struct timeval){.tv_sec = 0,.tv_usec = 0,}); - gettimeofday(&ts, 0); - i64 _t2 = ((i64)(ts.tv_sec * ((u64)(1000U)) + (ts.tv_usec / ((u64)(1000U))))); - return _t2; - } - #endif - return 0; -} - -string time__Time_str(time__Time t) { - string _t1 = time__Time_format_ss(t); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { - time__Time _t1 = ((time__Time){ - .year = t.tm_year + 1900, - .month = t.tm_mon + 1, - .day = t.tm_mday, - .hour = t.tm_hour, - .minute = t.tm_min, - .second = t.tm_sec, - .microsecond = microsecond, - ._v_unix = time__make_unix_time(t), - .is_local = true, - }); - return _t1; -} - -string time__Time_strftime(time__Time t, string fmt) { - struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}, sizeof(struct tm))); - #if defined(_WIN32) - { - tm = gmtime(((voidptr)(&t._v_unix))); - } - #else - { - gmtime_r(((voidptr)(&t._v_unix)), tm); - } - #endif - Array_fixed_C__char_1024 buf = {0}; - char* fmt_c = ((char*)(fmt.str)); - strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); - string _t1 = cstring_to_vstring(((char*)(&buf[0]))); - return _t1; -} - -string time__Time_smonth(time__Time* t) { - if (t->month <= 0 || t->month > 12) { - string _t1 = _SLIT("---"); - return _t1; - } - int i = t->month - 1; - string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); - return _t2; -} - -// Attr: [inline] -inline i64 time__Time_unix_time(time__Time* t) { - i64 _t1 = t->_v_unix; - return _t1; -} - -// Attr: [inline] -inline i64 time__Time_unix_time_milli(time__Time* t) { - i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); - return _t1; -} - -time__Time time__Time_add(time__Time* t, time__Duration d) { - i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); - i64 _v_unix = microseconds / 1000000; - i64 micro = microseconds % 1000000; - time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); - return _t1; -} - -time__Time time__Time_add_seconds(time__Time* t, int seconds) { - time__Time _t1 = time__Time_add(t, seconds * _const_time__second); - return _t1; -} - -time__Time time__Time_add_days(time__Time* t, int days) { - time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); - return _t1; -} - -time__Duration time__since(time__Time t) { - time__Duration _t1 = time__Time__minus(time__now(), t); - return _t1; -} - -string time__Time_relative(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - string prefix = _SLIT(""); - string suffix = _SLIT(""); - if (secs < 0) { - secs *= -1; - prefix = _SLIT("in "); - } else { - suffix = _SLIT(" ago"); - } - if (secs < _const_time__seconds_per_minute / 2) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < _const_time__seconds_per_hour) { - i64 m = secs / _const_time__seconds_per_minute; - if (m == 1) { - string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (secs < _const_time__seconds_per_hour * 24) { - i64 h = secs / _const_time__seconds_per_hour; - if (h == 1) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t4; - } - string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t5; - } - if (secs < _const_time__seconds_per_hour * 24 * 7) { - i64 d = secs / _const_time__seconds_per_hour / 24; - if (d == 1) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t7; - } - if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { - if (string__eq(prefix, _SLIT("in "))) { - string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t8; - } - string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t9; - } - i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; - if (y == 1) { - string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t10; - } - string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t11; -} - -string time__Time_relative_short(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - string prefix = _SLIT(""); - string suffix = _SLIT(""); - if (secs < 0) { - secs *= -1; - prefix = _SLIT("in "); - } else { - suffix = _SLIT(" ago"); - } - if (secs < _const_time__seconds_per_minute / 2) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < _const_time__seconds_per_hour) { - i64 m = secs / _const_time__seconds_per_minute; - if (m == 1) { - string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (secs < _const_time__seconds_per_hour * 24) { - i64 h = secs / _const_time__seconds_per_hour; - if (h == 1) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t4; - } - string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t5; - } - if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { - i64 d = secs / _const_time__seconds_per_hour / 24; - if (d == 1) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t7; - } - i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; - if (y == 1) { - string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t8; - } - string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t9; -} - -int time__day_of_week(int y, int m, int d) { - Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 0, 3, 2, 5, 0, 3, 5, 1, 4, - 6, 2, 4})); - int sy = y; - if (m < 3) { - sy = sy - 1; - } - int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; - return _t1; -} - -int time__Time_day_of_week(time__Time* t) { - int _t1 = time__day_of_week(t->year, t->month, t->day); - return _t1; -} - -string time__Time_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); - return _t1; -} - -string time__Time_long_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); - return _t1; -} - -bool time__is_leap_year(int year) { - bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); - return _t1; -} - -_option_int time__days_in_month(int month, int year) { - if (month > 12 || month < 1) { - return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), /*100 &int*/0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); - int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; - _option_int _t2; - opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); - return _t2; -} - -string time__Time_debug(time__Time* t) { - string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), /*100 &int*/0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), /*100 &int*/0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), /*100 &int*/0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), /*100 &int*/0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), /*100 &int*/0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), /*100 &int*/0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), /*100 &int*/0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), /*100 &i64*/0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t1; -} - -// TypeDecl -i64 time__Duration_nanoseconds(time__Duration d) { - i64 _t1 = ((i64)(d)); - return _t1; -} - -i64 time__Duration_microseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / _const_time__microsecond; - return _t1; -} - -i64 time__Duration_milliseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / _const_time__millisecond; - return _t1; -} - -f64 time__Duration_seconds(time__Duration d) { - i64 sec = d / _const_time__second; - i64 nsec = d % _const_time__second; - f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / _const_time__second; - return _t1; -} - -f64 time__Duration_minutes(time__Duration d) { - i64 min = d / _const_time__minute; - i64 nsec = d % _const_time__minute; - f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / _const_time__minute; - return _t1; -} - -f64 time__Duration_hours(time__Duration d) { - i64 hr = d / _const_time__hour; - i64 nsec = d % _const_time__hour; - f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / _const_time__hour; - return _t1; -} - -string time__Duration_str(time__Duration d) { - if (time__Duration_alias_eq(d, _const_time__infinite)) { - string _t1 = _SLIT("inf"); - return _t1; - } - i64 t = ((i64)(d)); - i64 hr = t / _const_time__hour; - t -= hr * _const_time__hour; - i64 min = t / _const_time__minute; - t -= min * _const_time__minute; - i64 sec = t / _const_time__second; - t -= sec * _const_time__second; - i64 ms = t / _const_time__millisecond; - t -= ms * _const_time__millisecond; - i64 us = t / _const_time__microsecond; - t -= us * _const_time__microsecond; - i64 ns = t; - if (hr > 0) { - string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = hr}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - if (min > 0) { - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (sec > 0) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); - return _t4; - } - if (ms > 0) { - string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ms}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); - return _t5; - } - if (us > 0) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = us}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); - return _t7; -} - -int time__offset(void) { - time__Time t = time__utc(); - time__Time local = time__Time_local(&t); - int _t1 = ((int)(local._v_unix - t._v_unix)); - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__sys_mono_now_darwin(void) { - u64 _t1 = 0U; - return _t1; -} - -time__Time time__darwin_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__darwin_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { - i64 _t1 = ((i64)(timegm(&t))); - return _t1; -} - -time__Time time__Time_local(time__Time* t) { - if (t->is_local) { - time__Time _t1 = *t; - return _t1; - } - struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); - localtime_r(((voidptr)(&t->_v_unix)), &loc_tm); - time__Time _t2 = time__convert_ctime(loc_tm, t->microsecond); - return _t2; -} - -u64 time__sys_mono_now(void) { - #if defined(__APPLE__) - { - u64 _t1 = time__sys_mono_now_darwin(); - return _t1; - } - #else - { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_MONOTONIC, &ts); - u64 _t2 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); - return _t2; - } - #endif - return 0; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_MONOTONIC, &ts); - u64 _t1 = ((u64)(ts.tv_sec)) * 1000000000U + ((u64)(ts.tv_nsec)); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__linux_now(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,}); - localtime_r(((voidptr)(&ts.tv_sec)), &loc_tm); - time__Time _t1 = time__convert_ctime(loc_tm, ((int)(ts.tv_nsec / 1000))); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__linux_utc(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - time__Time _t1 = time__unix2(((i64)(ts.tv_sec)), ((int)(ts.tv_nsec / 1000))); - return _t1; -} - -time__Time time__win_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__win_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -struct timespec time__Duration_timespec(time__Duration d) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - clock_gettime(CLOCK_REALTIME, &ts); - i64 d_sec = d / _const_time__second; - i64 d_nsec = d % _const_time__second; - ts.tv_sec += d_sec; - ts.tv_nsec += d_nsec; - if (ts.tv_nsec > ((i64)(_const_time__second))) { - ts.tv_nsec -= ((i64)(_const_time__second)); - ts.tv_sec++; - } - struct timespec _t1 = ts; - return _t1; -} - -struct timespec time__zero_timespec(void) { - struct timespec ts = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - struct timespec _t1 = ts; - return _t1; -} - -void time__sleep(time__Duration duration) { - struct timespec req = ((struct timespec){.tv_sec = duration / _const_time__second,.tv_nsec = duration % _const_time__second,}); - struct timespec rem = ((struct timespec){.tv_sec = 0,.tv_nsec = 0,}); - for (;;) { - if (!(nanosleep(&req, &rem) < 0)) break; - if (errno == EINTR) { - req = rem; - } else { - break; - } - } -} - -int time__Duration_sys_milliseconds(time__Duration d) { - if (d > INT32_MAX * _const_time__millisecond) { - int _t1 = -1; - return _t1; - } else if (d <= 0) { - int _t2 = 0; - return _t2; - } else { - int _t3 = ((int)(d / _const_time__millisecond)); - return _t3; - } - return 0; -} - -time__Time time__unix(i64 abs) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); - int year = mr_472.arg0; - int month = mr_472.arg1; - int day = mr_472.arg2; - multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_528.arg0; - int min = mr_528.arg1; - int sec = mr_528.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = 0, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -time__Time time__unix2(i64 abs, int microsecond) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); - int year = mr_1020.arg0; - int month = mr_1020.arg1; - int day = mr_1020.arg2; - multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_1076.arg0; - int min = mr_1076.arg1; - int sec = mr_1076.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = microsecond, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { - i64 day_offset = day_offset_; - day_offset += 719468; - int era = 0; - if (day_offset >= 0) { - era = ((int)(day_offset / _const_time__days_per_400_years)); - } else { - era = ((int)((day_offset - _const_time__days_per_400_years - 1) / _const_time__days_per_400_years)); - } - i64 doe = day_offset - era * _const_time__days_per_400_years; - i64 yoe = (doe - doe / (_const_time__days_per_4_years - 1) + doe / _const_time__days_per_100_years - doe / (_const_time__days_per_400_years - 1)) / _const_time__days_in_year; - int y = ((int)(yoe + era * 400)); - i64 doy = doe - (_const_time__days_in_year * yoe + yoe / 4 - yoe / 100); - i64 mp = (5 * doy + 2) / 153; - int d = ((int)(doy - (153 * mp + 2) / 5 + 1)); - int m = ((int)(mp)); - if (mp < 10) { - m += 3; - } else { - m -= 9; - } - if (m <= 2) { - y += 1; - } - return (multi_return_int_int_int){.arg0=y, .arg1=m, .arg2=d}; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { - i64 second_offset = second_offset_; - if (second_offset < 0) { - second_offset += _const_time__seconds_per_day; - } - i64 hour_ = second_offset / _const_time__seconds_per_hour; - second_offset %= _const_time__seconds_per_hour; - i64 min = second_offset / _const_time__seconds_per_minute; - second_offset %= _const_time__seconds_per_minute; - return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; -} - -_option_string v__util__diff__find_working_diff_command(void) { - string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); - string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); - if ((env_difftool).len != 0) { - _option_string _t1; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t1), sizeof(string)); - return _t1; - } - Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); - if (env_difftool.len > 0) { - array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); - } - _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); - for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { - string diffcmd = ((string*)known_diff_tools.data)[_t4]; - if (string__eq(diffcmd, _SLIT("opendiff"))) { - if (v__util__diff__opendiff_exists()) { - _option_string _t5; - opt_ok2(&(string[]) { diffcmd }, (_option*)(&_t5), sizeof(string)); - return _t5; - } - continue; - } - os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); - if (p.exit_code < 0) { - continue; - } - if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { - return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (p.exit_code == 0) { - if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { - _option_string _t7; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (_option*)(&_t7), sizeof(string)); - return _t7; - } - _option_string _t8; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t8), sizeof(string)); - return _t8; - } - } - return (_option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { - os__Result o = os__execute(_SLIT("opendiff")); - if (o.exit_code < 0) { - bool _t1 = false; - return _t1; - } - if (o.exit_code == 1) { - if (string_contains(o.output, _SLIT("too few arguments"))) { - bool _t2 = true; - return _t2; - } - } - bool _t3 = false; - return _t3; -} - -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { - if ((diff_cmd).len != 0) { - string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); - os__Result x = os__execute(full_cmd); - if (x.exit_code < 0) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), /*115 &string*/0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); - return _t1; - } - string _t2 = string_trim_right(x.output, _SLIT("\r\n")); - return _t2; - } - string _t3 = _SLIT(""); - return _t3; -} - -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { - string cdir = os__join_path_single(os__cache_dir(), unique_prefix); - _option_bool _t1 = os__mkdir(cdir); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - } - - (*(bool*)_t1.data); - u64 ctime = time__sys_mono_now(); - string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); - string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); - _option_void _t2 = os__write_file(e_file, expected); - if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { - IError err = _t2.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - _option_void _t3 = os__write_file(f_file, found); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); - _option_void _t4 = os__rmdir_all(cdir); - if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { - IError err = _t4.err; - } - - ; - string _t5 = res; - return _t5; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { - u32 _t1 = prev * 1664525U + 1013904223U; - return _t1; -} - -Array_u32 rand__seed__time_seed_array(int count) { - u64 ctime = time__sys_mono_now(); - u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); - Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); - for (int _t1 = 0; _t1 < count; ++_t1) { - seed = rand__seed__nr_next(seed); - array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); - } - Array_u32 _t3 = seed_data; - return _t3; -} - -// Attr: [manualfree] -u32 rand__seed__time_seed_32(void) { - Array_u32 sa = rand__seed__time_seed_array(1); - u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); - array_free(&sa); - u32 _t1 = res; - return _t1; -} - -// Attr: [manualfree] -u64 rand__seed__time_seed_64(void) { - Array_u32 seed_data = rand__seed__time_seed_array(2); - u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); - u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); - array_free(&seed_data); - u64 res = (lower | (upper << 32U)); - u64 _t1 = res; - return _t1; -} - -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { - if (seed_data.len != 2) { - eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); - _v_exit(1); - VUNREACHABLE(); - } - rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); - rng->bytes_left = 0; - rng->buffer = 0U; -} - -// Attr: [inline] -inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 1) { - rng->bytes_left -= 1; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t1 = value; - return _t1; - } - rng->buffer = rand__wyrand__WyRandRNG_u64(rng); - rng->bytes_left = 7; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t2 = value; - return _t2; -} - -// Attr: [inline] -inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 2) { - rng->bytes_left -= 2; - u16 value = ((u16)(rng->buffer)); - rng->buffer >>= 16U; - u16 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 16U; - rng->bytes_left = 6; - u16 _t2 = ((u16)(ans)); - return _t2; -} - -// Attr: [inline] -inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 4) { - rng->bytes_left -= 4; - u32 value = ((u32)(rng->buffer)); - rng->buffer >>= 32U; - u32 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 32U; - rng->bytes_left = 4; - u32 _t2 = ((u32)(ans)); - return _t2; -} - -// Attr: [inline] -inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { - { // Unsafe block - u64 seed1 = rng->state; - seed1 += _const_rand__wyrand__wyp0; - rng->state = seed1; - u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); - return _t1; - } - u64 _t2 = 0U; - return _t2; -} - -// Attr: [inline] -inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { - int _t1 = 64; - return _t1; -} - -// Attr: [unsafe] -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { - _v_free(rng); -} - string rand__uuid_v4(void) { string _t1 = rand__internal_uuid_v4(default_rng); return _t1; @@ -37766,7 +35727,7 @@ inline _option_u32 rand__PRNG_u32_in_range(rand__PRNG* rng, u32 min, u32 max) { _option_u32 _t3 = rand__PRNG_u32n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_u32 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37783,7 +35744,7 @@ inline _option_u64 rand__PRNG_u64_in_range(rand__PRNG* rng, u64 min, u64 max) { _option_u64 _t3 = rand__PRNG_u64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_u64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37836,7 +35797,7 @@ inline _option_int rand__PRNG_intn(rand__PRNG* rng, int max) { _option_u32 _t3 = rand__PRNG_u32n(rng, ((u32)(max))); if (_t3.state != 0) { /*or block*/ _option_int _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37853,7 +35814,7 @@ inline _option_i64 rand__PRNG_i64n(rand__PRNG* rng, i64 max) { _option_u64 _t3 = rand__PRNG_u64n(rng, ((u64)(max))); if (_t3.state != 0) { /*or block*/ _option_i64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37870,7 +35831,7 @@ inline _option_int rand__PRNG_int_in_range(rand__PRNG* rng, int min, int max) { _option_int _t3 = rand__PRNG_intn(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_int _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37887,7 +35848,7 @@ inline _option_i64 rand__PRNG_i64_in_range(rand__PRNG* rng, i64 min, i64 max) { _option_i64 _t3 = rand__PRNG_i64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_i64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37936,7 +35897,7 @@ inline _option_f32 rand__PRNG_f32_in_range(rand__PRNG* rng, f32 min, f32 max) { _option_f32 _t3 = rand__PRNG_f32n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_f32 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37953,7 +35914,7 @@ inline _option_f64 rand__PRNG_f64_in_range(rand__PRNG* rng, f64 min, f64 max) { _option_f64 _t3 = rand__PRNG_f64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_f64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -37992,9 +35953,97 @@ string rand__PRNG_ascii(rand__PRNG* rng, int len) { return _t1; } +_option_bool rand__PRNG_bernoulli(rand__PRNG* rng, f64 p) { + if (p < 0 || p > 1) { + return (_option_bool){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1fe0f, {.d_f64 = p}}, {_SLIT(" is not a valid probability value."), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_bool _t2; + opt_ok2(&(bool[]) { rand__PRNG_f64(rng) <= p }, (_option*)(&_t2), sizeof(bool)); + return _t2; +} + +_option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct conf) { + _option_multi_return_f64_f64 _t1 = rand__PRNG_normal_pair(rng, conf); + if (_t1.state != 0) { /*or block*/ + _option_f64 _t2; + memcpy(&_t2, &_t1, sizeof(_option)); + return _t2; + } + + multi_return_f64_f64 mr_8072 = (*(multi_return_f64_f64*)_t1.data); + f64 x = mr_8072.arg0; + _option_f64 _t3; + opt_ok2(&(f64[]) { x }, (_option*)(&_t3), sizeof(f64)); + return _t3; +} + +_option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf) { + if (conf.sigma <= 0) { + return (_option_multi_return_f64_f64){ .state=2, .err=_v_error(_SLIT("Standard deviation must be positive")), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + for (;;) { + _option_f64 _t2 = rand__PRNG_f64_in_range(rng, -1, 1); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(f64*) _t2.data = 0.0; + } + + f64 u = (*(f64*)_t2.data); + _option_f64 _t3 = rand__PRNG_f64_in_range(rng, -1, 1); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + *(f64*) _t3.data = 0.0; + } + + f64 v = (*(f64*)_t3.data); + f64 s = u * u + v * v; + if (s >= 1 || s == 0) { + continue; + } + f64 t = rand__msqrt(-2 * rand__mlog(s) / s); + f64 x = conf.mu + conf.sigma * t * u; + f64 y = conf.mu + conf.sigma * t * v; + _option_multi_return_f64_f64 _t4; + opt_ok2(&(multi_return_f64_f64/*X*/[]) { (multi_return_f64_f64){.arg0=x, .arg1=y} }, (_option*)(&_t4), sizeof(multi_return_f64_f64)); + return _t4; + } + return (_option_multi_return_f64_f64){ .state=2, .err=_v_error(_SLIT("Implementation error. Please file an issue.")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +_option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p) { + if (p < 0 || p > 1) { + return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1fe0f, {.d_f64 = p}}, {_SLIT(" is not a valid probability value."), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int count = 0; + for (int _t2 = 0; _t2 < n; ++_t2) { + _option_bool _t3 = rand__PRNG_bernoulli(rng, p); + if (_t3.state != 0) { /*or block*/ + _option_int _t4; + memcpy(&_t4, &_t3, sizeof(_result)); + return _t4; + } + + if ( (*(bool*)_t3.data)) { + count++; + } + } + _option_int _t5; + opt_ok2(&(int[]) { count }, (_option*)(&_t5), sizeof(int)); + return _t5; +} + +f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda) { + if (lambda <= 0) { + _v_panic(_SLIT("The rate (lambda) must be positive.")); + VUNREACHABLE(); + } + f64 _t1 = -rand__mlog(rand__PRNG_f64(rng)) / lambda; + return _t1; +} + // Attr: [manualfree] rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config) { - rand__wyrand__WyRandRNG* rng = ((rand__wyrand__WyRandRNG*)memdup(&(rand__wyrand__WyRandRNG){.state = rand__seed__time_seed_64(),.bytes_left = 0,.buffer = 0,}, sizeof(rand__wyrand__WyRandRNG))); + rand__wyrand__WyRandRNG* rng = ((rand__wyrand__WyRandRNG*)memdup(&(rand__wyrand__WyRandRNG){.PRNGBuffer = ((rand__buffer__PRNGBuffer){.bytes_left = 0,.buffer = 0,}),.state = rand__seed__time_seed_64(),.bytes_left = 0,.buffer = 0,}, sizeof(rand__wyrand__WyRandRNG))); rand__wyrand__WyRandRNG_seed(rng, config.seed_); array_free(&config.seed_); rand__PRNG* _t1 = HEAP(rand__PRNG, /*&rand.PRNG*/I_rand__wyrand__WyRandRNG_to_Interface_rand__PRNG(rng)); @@ -38163,8 +36212,33 @@ string rand__ascii(int len) { return _t1; } +_option_bool rand__bernoulli(f64 p) { + _option_bool _t1 = rand__PRNG_bernoulli(default_rng, p); + return _t1; +} + +_option_f64 rand__normal(rand__config__NormalConfigStruct conf) { + _option_f64 _t1 = rand__PRNG_normal(default_rng, conf); + return _t1; +} + +_option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf) { + _option_multi_return_f64_f64 _t1 = rand__PRNG_normal_pair(default_rng, conf); + return _t1; +} + +_option_int rand__binomial(int n, f64 p) { + _option_int _t1 = rand__PRNG_binomial(default_rng, n, p); + return _t1; +} + +f64 rand__exponential(f64 lambda) { + f64 _t1 = rand__PRNG_exponential(default_rng, lambda); + return _t1; +} + v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.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; @@ -38239,7 +36313,7 @@ void v__pref__Preferences_fill_with_defaults(v__pref__Preferences* p) { } #endif } - string vhash = _SLIT("9a0f49950"); + string vhash = _SLIT("f9079b670"); 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; @@ -38811,7 +36885,7 @@ VV_LOCAL_SYMBOL void v__pref__detect_musl(v__pref__Preferences* res) { } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.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) { @@ -39113,6 +37187,14 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->dump_c_flags = os__cmdline__option(current_args, arg, _SLIT("-")); i++; } + else if (string__eq(arg, _SLIT("-dump-modules"))) { + res->dump_modules = os__cmdline__option(current_args, arg, _SLIT("-")); + i++; + } + else if (string__eq(arg, _SLIT("-dump-files"))) { + res->dump_files = os__cmdline__option(current_args, arg, _SLIT("-")); + i++; + } else if (string__eq(arg, _SLIT("-experimental"))) { res->experimental = true; } @@ -39427,7 +37509,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); + Map_string_string m = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; 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("") }); @@ -39720,7 +37803,8 @@ Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Prefere array_push((array*)&all_v_files, _MOV((string[]){ string_clone(os__join_path(dir, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){file})))) })); } Array_string defaults = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_Array_string fnames_no_postfixes = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_Array_string fnames_no_postfixes = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t7 = 0; _t7 < all_v_files.len; ++_t7) { string file = ((string*)all_v_files.data)[_t7]; if (string_contains(file, _SLIT("default.c.v"))) { @@ -41563,7 +39647,8 @@ v__util__Timers* v__util__new_timers(v__util__TimerParams params) { eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT(">>>> new_timers, should_print: "), /*115 &bool*/0xfe10, {.d_s = params.should_print ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | label: "), /*115 &string*/0xfe10, {.d_s = params.label}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - v__util__Timers* _t1 = ((v__util__Timers*)memdup(&(v__util__Timers){.label = params.label,.swatches = new_map(sizeof(string), sizeof(time__StopWatch), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.should_print = params.should_print,.already_shown = __new_array_with_default(0, 100, sizeof(string), 0),}, sizeof(v__util__Timers))); + v__util__Timers* _t1 = ((v__util__Timers*)memdup(&(v__util__Timers){.label = params.label,.swatches = new_map(sizeof(string), sizeof(time__StopWatch), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ,.should_print = params.should_print,.already_shown = __new_array_with_default(0, 100, sizeof(string), 0),}, sizeof(v__util__Timers))); return _t1; } @@ -42472,10 +40557,10 @@ v__ast__Node v__ast__empty_node(void) { _option_v__ast__Ident v__ast__SelectorExpr_root_ident(v__ast__SelectorExpr* e) { v__ast__Expr root = e->expr; for (;;) { - if (!((root)._typ == 288 /* v.ast.SelectorExpr */)) break; + if (!((root)._typ == 290 /* v.ast.SelectorExpr */)) break; root = (*root._v__ast__SelectorExpr).expr; } - if ((root)._typ == 268 /* v.ast.Ident */) { + if ((root)._typ == 270 /* v.ast.Ident */) { _option_v__ast__Ident _t1; opt_ok2(&(v__ast__Ident[]) { (*root._v__ast__Ident) }, (_option*)(&_t1), sizeof(v__ast__Ident)); return _t1; @@ -42508,19 +40593,19 @@ void v__ast__File_free(v__ast__File* f) { // TypeDecl bool v__ast__Ident_is_mut(v__ast__Ident* i) { - if (i->obj._typ == 326 /* v.ast.Var */) { + if (i->obj._typ == 328 /* v.ast.Var */) { bool _t1 = (*i->obj._v__ast__Var).is_mut; return _t1; } - else if (i->obj._typ == 324 /* v.ast.ConstField */) { + else if (i->obj._typ == 326 /* v.ast.ConstField */) { bool _t2 = false; return _t2; } - else if (i->obj._typ == 323 /* v.ast.AsmRegister */) { + else if (i->obj._typ == 325 /* v.ast.AsmRegister */) { bool _t3 = true; return _t3; } - else if (i->obj._typ == 325 /* v.ast.GlobalField */) { + else if (i->obj._typ == 327 /* v.ast.GlobalField */) { bool _t4 = true; return _t4; } @@ -42529,7 +40614,7 @@ bool v__ast__Ident_is_mut(v__ast__Ident* i) { } v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i) { - if (i->info._typ == 378 /* v.ast.IdentVar */) { + if (i->info._typ == 380 /* v.ast.IdentVar */) { v__ast__IdentVar _t1 = (*i->info._v__ast__IdentVar); return _t1; } @@ -42545,7 +40630,7 @@ v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i) { // TypeDecl // Attr: [inline] inline bool v__ast__Expr_is_blank_ident(v__ast__Expr expr) { - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { bool _t1 = (*expr._v__ast__Ident).kind == v__ast__IdentKind__blank_ident; return _t1; } @@ -42554,199 +40639,199 @@ inline bool v__ast__Expr_is_blank_ident(v__ast__Expr expr) { } v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { - if (expr._typ == 246 /* v.ast.AnonFn */) { + if (expr._typ == 248 /* v.ast.AnonFn */) { v__token__Pos _t1 = (*expr._v__ast__AnonFn).decl.pos; return _t1; } - else if (expr._typ == 253 /* v.ast.CTempVar */) { + else if (expr._typ == 255 /* v.ast.CTempVar */) { v__token__Pos _t2 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t2; } - else if (expr._typ == 264 /* v.ast.EmptyExpr */) { + else if (expr._typ == 266 /* v.ast.EmptyExpr */) { v__token__Pos _t3 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t3; } - else if (expr._typ == 279 /* v.ast.NodeError */) { + else if (expr._typ == 281 /* v.ast.NodeError */) { v__token__Pos _t4 = (*expr._v__ast__NodeError).pos; return _t4; } - else if (expr._typ == 247 /* v.ast.ArrayDecompose */) { + else if (expr._typ == 249 /* v.ast.ArrayDecompose */) { v__token__Pos _t5 = (*expr._v__ast__ArrayDecompose).pos; return _t5; } - else if (expr._typ == 248 /* v.ast.ArrayInit */) { + else if (expr._typ == 250 /* v.ast.ArrayInit */) { v__token__Pos _t6 = (*expr._v__ast__ArrayInit).pos; return _t6; } - else if (expr._typ == 249 /* v.ast.AsCast */) { + else if (expr._typ == 251 /* v.ast.AsCast */) { v__token__Pos _t7 = (*expr._v__ast__AsCast).pos; return _t7; } - else if (expr._typ == 250 /* v.ast.Assoc */) { + else if (expr._typ == 252 /* v.ast.Assoc */) { v__token__Pos _t8 = (*expr._v__ast__Assoc).pos; return _t8; } - else if (expr._typ == 251 /* v.ast.AtExpr */) { + else if (expr._typ == 253 /* v.ast.AtExpr */) { v__token__Pos _t9 = (*expr._v__ast__AtExpr).pos; return _t9; } - else if (expr._typ == 252 /* v.ast.BoolLiteral */) { + else if (expr._typ == 254 /* v.ast.BoolLiteral */) { v__token__Pos _t10 = (*expr._v__ast__BoolLiteral).pos; return _t10; } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { v__token__Pos _t11 = (*expr._v__ast__CallExpr).pos; return _t11; } - else if (expr._typ == 255 /* v.ast.CastExpr */) { + else if (expr._typ == 257 /* v.ast.CastExpr */) { v__token__Pos _t12 = (*expr._v__ast__CastExpr).pos; return _t12; } - else if (expr._typ == 256 /* v.ast.ChanInit */) { + else if (expr._typ == 258 /* v.ast.ChanInit */) { v__token__Pos _t13 = (*expr._v__ast__ChanInit).pos; return _t13; } - else if (expr._typ == 257 /* v.ast.CharLiteral */) { + else if (expr._typ == 259 /* v.ast.CharLiteral */) { v__token__Pos _t14 = (*expr._v__ast__CharLiteral).pos; return _t14; } - else if (expr._typ == 262 /* v.ast.ConcatExpr */) { + else if (expr._typ == 264 /* v.ast.ConcatExpr */) { v__token__Pos _t15 = (*expr._v__ast__ConcatExpr).pos; return _t15; } - else if (expr._typ == 258 /* v.ast.Comment */) { + else if (expr._typ == 260 /* v.ast.Comment */) { v__token__Pos _t16 = (*expr._v__ast__Comment).pos; return _t16; } - else if (expr._typ == 259 /* v.ast.ComptimeCall */) { + else if (expr._typ == 261 /* v.ast.ComptimeCall */) { v__token__Pos _t17 = (*expr._v__ast__ComptimeCall).pos; return _t17; } - else if (expr._typ == 260 /* v.ast.ComptimeSelector */) { + else if (expr._typ == 262 /* v.ast.ComptimeSelector */) { v__token__Pos _t18 = (*expr._v__ast__ComptimeSelector).pos; return _t18; } - else if (expr._typ == 265 /* v.ast.EnumVal */) { + else if (expr._typ == 267 /* v.ast.EnumVal */) { v__token__Pos _t19 = (*expr._v__ast__EnumVal).pos; return _t19; } - else if (expr._typ == 263 /* v.ast.DumpExpr */) { + else if (expr._typ == 265 /* v.ast.DumpExpr */) { v__token__Pos _t20 = (*expr._v__ast__DumpExpr).pos; return _t20; } - else if (expr._typ == 266 /* v.ast.FloatLiteral */) { + else if (expr._typ == 268 /* v.ast.FloatLiteral */) { v__token__Pos _t21 = (*expr._v__ast__FloatLiteral).pos; return _t21; } - else if (expr._typ == 267 /* v.ast.GoExpr */) { + else if (expr._typ == 269 /* v.ast.GoExpr */) { v__token__Pos _t22 = (*expr._v__ast__GoExpr).pos; return _t22; } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { v__token__Pos _t23 = (*expr._v__ast__Ident).pos; return _t23; } - else if (expr._typ == 269 /* v.ast.IfExpr */) { + else if (expr._typ == 271 /* v.ast.IfExpr */) { v__token__Pos _t24 = (*expr._v__ast__IfExpr).pos; return _t24; } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { v__token__Pos _t25 = (*expr._v__ast__IntegerLiteral).pos; return _t25; } - else if (expr._typ == 274 /* v.ast.IsRefType */) { + else if (expr._typ == 276 /* v.ast.IsRefType */) { v__token__Pos _t26 = (*expr._v__ast__IsRefType).pos; return _t26; } - else if (expr._typ == 275 /* v.ast.Likely */) { + else if (expr._typ == 277 /* v.ast.Likely */) { v__token__Pos _t27 = (*expr._v__ast__Likely).pos; return _t27; } - else if (expr._typ == 276 /* v.ast.LockExpr */) { + else if (expr._typ == 278 /* v.ast.LockExpr */) { v__token__Pos _t28 = (*expr._v__ast__LockExpr).pos; return _t28; } - else if (expr._typ == 277 /* v.ast.MapInit */) { + else if (expr._typ == 279 /* v.ast.MapInit */) { v__token__Pos _t29 = (*expr._v__ast__MapInit).pos; return _t29; } - else if (expr._typ == 278 /* v.ast.MatchExpr */) { + else if (expr._typ == 280 /* v.ast.MatchExpr */) { v__token__Pos _t30 = (*expr._v__ast__MatchExpr).pos; return _t30; } - else if (expr._typ == 280 /* v.ast.None */) { + else if (expr._typ == 282 /* v.ast.None */) { v__token__Pos _t31 = (*expr._v__ast__None).pos; return _t31; } - else if (expr._typ == 281 /* v.ast.OffsetOf */) { + else if (expr._typ == 283 /* v.ast.OffsetOf */) { v__token__Pos _t32 = (*expr._v__ast__OffsetOf).pos; return _t32; } - else if (expr._typ == 282 /* v.ast.OrExpr */) { + else if (expr._typ == 284 /* v.ast.OrExpr */) { v__token__Pos _t33 = (*expr._v__ast__OrExpr).pos; return _t33; } - else if (expr._typ == 283 /* v.ast.ParExpr */) { + else if (expr._typ == 285 /* v.ast.ParExpr */) { v__token__Pos _t34 = (*expr._v__ast__ParExpr).pos; return _t34; } - else if (expr._typ == 284 /* v.ast.PostfixExpr */) { + else if (expr._typ == 286 /* v.ast.PostfixExpr */) { v__token__Pos _t35 = (*expr._v__ast__PostfixExpr).pos; return _t35; } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { v__token__Pos _t36 = (*expr._v__ast__PrefixExpr).pos; return _t36; } - else if (expr._typ == 286 /* v.ast.RangeExpr */) { + else if (expr._typ == 288 /* v.ast.RangeExpr */) { v__token__Pos _t37 = (*expr._v__ast__RangeExpr).pos; return _t37; } - else if (expr._typ == 287 /* v.ast.SelectExpr */) { + else if (expr._typ == 289 /* v.ast.SelectExpr */) { v__token__Pos _t38 = (*expr._v__ast__SelectExpr).pos; return _t38; } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { v__token__Pos _t39 = (*expr._v__ast__SelectorExpr).pos; return _t39; } - else if (expr._typ == 289 /* v.ast.SizeOf */) { + else if (expr._typ == 291 /* v.ast.SizeOf */) { v__token__Pos _t40 = (*expr._v__ast__SizeOf).pos; return _t40; } - else if (expr._typ == 290 /* v.ast.SqlExpr */) { + else if (expr._typ == 292 /* v.ast.SqlExpr */) { v__token__Pos _t41 = (*expr._v__ast__SqlExpr).pos; return _t41; } - else if (expr._typ == 291 /* v.ast.StringInterLiteral */) { + else if (expr._typ == 293 /* v.ast.StringInterLiteral */) { v__token__Pos _t42 = (*expr._v__ast__StringInterLiteral).pos; return _t42; } - else if (expr._typ == 292 /* v.ast.StringLiteral */) { + else if (expr._typ == 294 /* v.ast.StringLiteral */) { v__token__Pos _t43 = (*expr._v__ast__StringLiteral).pos; return _t43; } - else if (expr._typ == 293 /* v.ast.StructInit */) { + else if (expr._typ == 295 /* v.ast.StructInit */) { v__token__Pos _t44 = (*expr._v__ast__StructInit).pos; return _t44; } - else if (expr._typ == 294 /* v.ast.TypeNode */) { + else if (expr._typ == 296 /* v.ast.TypeNode */) { v__token__Pos _t45 = (*expr._v__ast__TypeNode).pos; return _t45; } - else if (expr._typ == 295 /* v.ast.TypeOf */) { + else if (expr._typ == 297 /* v.ast.TypeOf */) { v__token__Pos _t46 = (*expr._v__ast__TypeOf).pos; return _t46; } - else if (expr._typ == 296 /* v.ast.UnsafeExpr */) { + else if (expr._typ == 298 /* v.ast.UnsafeExpr */) { v__token__Pos _t47 = (*expr._v__ast__UnsafeExpr).pos; return _t47; } - else if (expr._typ == 261 /* v.ast.ComptimeType */) { + else if (expr._typ == 263 /* v.ast.ComptimeType */) { v__token__Pos _t48 = (*expr._v__ast__ComptimeType).pos; return _t48; } - else if (expr._typ == 271 /* v.ast.IndexExpr */) { + else if (expr._typ == 273 /* v.ast.IndexExpr */) { if ((*expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { v__token__Pos _t49 = (*expr._v__ast__IndexExpr).or_expr.pos; return _t49; @@ -42754,11 +40839,11 @@ v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { v__token__Pos _t50 = (*expr._v__ast__IndexExpr).pos; return _t50; } - else if (expr._typ == 270 /* v.ast.IfGuardExpr */) { + else if (expr._typ == 272 /* v.ast.IfGuardExpr */) { v__token__Pos _t51 = v__ast__Expr_pos((*expr._v__ast__IfGuardExpr).expr); return _t51; } - else if (expr._typ == 272 /* v.ast.InfixExpr */) { + else if (expr._typ == 274 /* v.ast.InfixExpr */) { v__token__Pos left_pos = v__ast__Expr_pos((*expr._v__ast__InfixExpr).left); v__token__Pos right_pos = v__ast__Expr_pos((*expr._v__ast__InfixExpr).right); v__token__Pos _t52 = ((v__token__Pos){.len = right_pos.pos - left_pos.pos + right_pos.len,.line_nr = (*expr._v__ast__InfixExpr).pos.line_nr,.pos = left_pos.pos,.col = left_pos.col,.last_line = right_pos.last_line,}); @@ -42769,27 +40854,27 @@ v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { } bool v__ast__Expr_is_lvalue(v__ast__Expr expr) { - if (expr._typ == 268 /* v.ast.Ident */) { + if (expr._typ == 270 /* v.ast.Ident */) { bool _t1 = true; return _t1; } - else if (expr._typ == 253 /* v.ast.CTempVar */) { + else if (expr._typ == 255 /* v.ast.CTempVar */) { bool _t2 = true; return _t2; } - else if (expr._typ == 271 /* v.ast.IndexExpr */) { + else if (expr._typ == 273 /* v.ast.IndexExpr */) { bool _t3 = v__ast__Expr_is_lvalue((*expr._v__ast__IndexExpr).left); return _t3; } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { bool _t4 = v__ast__Expr_is_lvalue((*expr._v__ast__SelectorExpr).expr); return _t4; } - else if (expr._typ == 283 /* v.ast.ParExpr */) { + else if (expr._typ == 285 /* v.ast.ParExpr */) { bool _t5 = v__ast__Expr_is_lvalue((*expr._v__ast__ParExpr).expr); return _t5; } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { bool _t6 = v__ast__Expr_is_lvalue((*expr._v__ast__PrefixExpr).right); return _t6; } @@ -42802,19 +40887,19 @@ bool v__ast__Expr_is_lvalue(v__ast__Expr expr) { } bool v__ast__Expr_is_expr(v__ast__Expr expr) { - if (expr._typ == 269 /* v.ast.IfExpr */) { + if (expr._typ == 271 /* v.ast.IfExpr */) { bool _t1 = (*expr._v__ast__IfExpr).is_expr; return _t1; } - else if (expr._typ == 276 /* v.ast.LockExpr */) { + else if (expr._typ == 278 /* v.ast.LockExpr */) { bool _t2 = (*expr._v__ast__LockExpr).is_expr; return _t2; } - else if (expr._typ == 278 /* v.ast.MatchExpr */) { + else if (expr._typ == 280 /* v.ast.MatchExpr */) { bool _t3 = (*expr._v__ast__MatchExpr).is_expr; return _t3; } - else if (expr._typ == 287 /* v.ast.SelectExpr */) { + else if (expr._typ == 289 /* v.ast.SelectExpr */) { bool _t4 = (*expr._v__ast__SelectExpr).is_expr; return _t4; } @@ -42827,20 +40912,20 @@ bool v__ast__Expr_is_expr(v__ast__Expr expr) { } bool v__ast__Expr_is_lit(v__ast__Expr expr) { - bool _t1 = ((expr._typ == 252 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 257 /* v.ast.CharLiteral */)? (true) : (expr._typ == 292 /* v.ast.StringLiteral */)? (true) : (expr._typ == 273 /* v.ast.IntegerLiteral */)? (true) : (false)); + bool _t1 = ((expr._typ == 254 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 259 /* v.ast.CharLiteral */)? (true) : (expr._typ == 294 /* v.ast.StringLiteral */)? (true) : (expr._typ == 275 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr) { - if (expr._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (expr._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if ((*(*expr._v__ast__Ident).obj._v__ast__Var).is_auto_deref) { bool _t1 = true; return _t1; } } } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { if ((*expr._v__ast__PrefixExpr).op == v__token__Kind__amp && v__ast__Expr_is_auto_deref_var((*expr._v__ast__PrefixExpr).right)) { bool _t2 = true; return _t2; @@ -42855,11 +40940,11 @@ bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr) { } bool v__ast__Expr_is_lockable(v__ast__Expr* e) { - if (e->_typ == 268 /* v.ast.Ident */) { + if (e->_typ == 270 /* v.ast.Ident */) { bool _t1 = true; return _t1; } - else if (e->_typ == 288 /* v.ast.SelectorExpr */) { + else if (e->_typ == 290 /* v.ast.SelectorExpr */) { bool _t2 = v__ast__Expr_is_lockable(&(*e->_v__ast__SelectorExpr).expr); return _t2; } @@ -42873,19 +40958,19 @@ bool v__ast__Expr_is_lockable(v__ast__Expr* e) { } _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt) { - if (stmt._typ == 300 /* v.ast.AssignStmt */) { + if (stmt._typ == 302 /* v.ast.AssignStmt */) { return (_option_void){0}; } - else if (stmt._typ == 309 /* v.ast.ForCStmt */) { + else if (stmt._typ == 311 /* v.ast.ForCStmt */) { return (_option_void){0}; } - else if (stmt._typ == 310 /* v.ast.ForInStmt */) { + else if (stmt._typ == 312 /* v.ast.ForInStmt */) { return (_option_void){0}; } - else if (stmt._typ == 311 /* v.ast.ForStmt */) { + else if (stmt._typ == 313 /* v.ast.ForStmt */) { return (_option_void){0}; } - else if (stmt._typ == 308 /* v.ast.ExprStmt */) { + else if (stmt._typ == 310 /* v.ast.ExprStmt */) { if (v__ast__Expr_is_expr((*stmt._v__ast__ExprStmt).expr)) { return (_option_void){0}; } @@ -42899,29 +40984,29 @@ _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt) { } v__token__Pos v__ast__Node_pos(v__ast__Node node) { - if (node._typ == 279 /* v.ast.NodeError */) { + if (node._typ == 281 /* v.ast.NodeError */) { v__token__Pos _t1 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t1; } - else if (node._typ == 329 /* v.ast.EmptyNode */) { + else if (node._typ == 331 /* v.ast.EmptyNode */) { v__token__Pos _t2 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t2; } - else if (node._typ == 322 /* v.ast.Stmt */) { + else if (node._typ == 324 /* v.ast.Stmt */) { v__token__Pos pos = (*((*node._v__ast__Stmt).pos)); - if (((*node._v__ast__Stmt))._typ == 316 /* v.ast.Import */) { + if (((*node._v__ast__Stmt))._typ == 318 /* v.ast.Import */) { for (int _t3 = 0; _t3 < (*(*node._v__ast__Stmt)._v__ast__Import).syms.len; ++_t3) { v__ast__ImportSymbol sym = ((v__ast__ImportSymbol*)(*(*node._v__ast__Stmt)._v__ast__Import).syms.data)[_t3]; pos = v__token__Pos_extend(pos, sym.pos); } - } else if (((*node._v__ast__Stmt))._typ == 245 /* v.ast.TypeDecl */) { - if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 243 /* v.ast.FnTypeDecl */) { + } else if (((*node._v__ast__Stmt))._typ == 247 /* v.ast.TypeDecl */) { + if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 245 /* v.ast.FnTypeDecl */) { pos = v__token__Pos_extend(pos, (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__FnTypeDecl).type_pos); } - else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 242 /* v.ast.AliasTypeDecl */) { + else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 244 /* v.ast.AliasTypeDecl */) { pos = v__token__Pos_extend(pos, (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__AliasTypeDecl).type_pos); } - else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 244 /* v.ast.SumTypeDecl */) { + else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 246 /* v.ast.SumTypeDecl */) { for (int _t4 = 0; _t4 < (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants.len; ++_t4) { v__ast__TypeNode variant = ((v__ast__TypeNode*)(*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants.data)[_t4]; pos = v__token__Pos_extend(pos, variant.pos); @@ -42929,75 +41014,75 @@ v__token__Pos v__ast__Node_pos(v__ast__Node node) { } ; } - if (((*node._v__ast__Stmt))._typ == 300 /* v.ast.AssignStmt */) { + if (((*node._v__ast__Stmt))._typ == 302 /* v.ast.AssignStmt */) { v__token__Pos _t5 = v__token__Pos_extend(pos, v__ast__Expr_pos((*(v__ast__Expr*)array_last((*(*node._v__ast__Stmt)._v__ast__AssignStmt).right)))); return _t5; } - if (((*node._v__ast__Stmt))._typ == 299 /* v.ast.AssertStmt */) { + if (((*node._v__ast__Stmt))._typ == 301 /* v.ast.AssertStmt */) { v__token__Pos _t6 = v__token__Pos_extend(pos, v__ast__Expr_pos((*(*node._v__ast__Stmt)._v__ast__AssertStmt).expr)); return _t6; } v__token__Pos _t7 = pos; return _t7; } - else if (node._typ == 297 /* v.ast.Expr */) { + else if (node._typ == 299 /* v.ast.Expr */) { v__token__Pos _t8 = v__ast__Expr_pos((*node._v__ast__Expr)); return _t8; } - else if (node._typ == 335 /* v.ast.StructField */) { + else if (node._typ == 337 /* v.ast.StructField */) { v__token__Pos _t9 = v__token__Pos_extend((*node._v__ast__StructField).pos, (*node._v__ast__StructField).type_pos); return _t9; } - else if (node._typ == 332 /* v.ast.MatchBranch */) { + else if (node._typ == 334 /* v.ast.MatchBranch */) { v__token__Pos _t10 = (*node._v__ast__MatchBranch).pos; return _t10; } - else if (node._typ == 334 /* v.ast.SelectBranch */) { + else if (node._typ == 336 /* v.ast.SelectBranch */) { v__token__Pos _t11 = (*node._v__ast__SelectBranch).pos; return _t11; } - else if (node._typ == 330 /* v.ast.EnumField */) { + else if (node._typ == 332 /* v.ast.EnumField */) { v__token__Pos _t12 = (*node._v__ast__EnumField).pos; return _t12; } - else if (node._typ == 324 /* v.ast.ConstField */) { + else if (node._typ == 326 /* v.ast.ConstField */) { v__token__Pos _t13 = (*node._v__ast__ConstField).pos; return _t13; } - else if (node._typ == 336 /* v.ast.StructInitField */) { + else if (node._typ == 338 /* v.ast.StructInitField */) { v__token__Pos _t14 = (*node._v__ast__StructInitField).pos; return _t14; } - else if (node._typ == 325 /* v.ast.GlobalField */) { + else if (node._typ == 327 /* v.ast.GlobalField */) { v__token__Pos _t15 = (*node._v__ast__GlobalField).pos; return _t15; } - else if (node._typ == 328 /* v.ast.CallArg */) { + else if (node._typ == 330 /* v.ast.CallArg */) { v__token__Pos _t16 = (*node._v__ast__CallArg).pos; return _t16; } - else if (node._typ == 333 /* v.ast.Param */) { + else if (node._typ == 335 /* v.ast.Param */) { v__token__Pos _t17 = v__token__Pos_extend((*node._v__ast__Param).pos, (*node._v__ast__Param).type_pos); return _t17; } - else if (node._typ == 331 /* v.ast.IfBranch */) { + else if (node._typ == 333 /* v.ast.IfBranch */) { v__token__Pos _t18 = v__token__Pos_extend((*node._v__ast__IfBranch).pos, (*node._v__ast__IfBranch).body_pos); return _t18; } - else if (node._typ == 327 /* v.ast.ScopeObject */) { - if ((*node._v__ast__ScopeObject)._typ == 324 /* v.ast.ConstField */) { + else if (node._typ == 329 /* v.ast.ScopeObject */) { + if ((*node._v__ast__ScopeObject)._typ == 326 /* v.ast.ConstField */) { v__token__Pos _t19 = (*(*node._v__ast__ScopeObject)._v__ast__ConstField).pos; return _t19; } - else if ((*node._v__ast__ScopeObject)._typ == 325 /* v.ast.GlobalField */) { + else if ((*node._v__ast__ScopeObject)._typ == 327 /* v.ast.GlobalField */) { v__token__Pos _t20 = (*(*node._v__ast__ScopeObject)._v__ast__GlobalField).pos; return _t20; } - else if ((*node._v__ast__ScopeObject)._typ == 326 /* v.ast.Var */) { + else if ((*node._v__ast__ScopeObject)._typ == 328 /* v.ast.Var */) { v__token__Pos _t21 = (*(*node._v__ast__ScopeObject)._v__ast__Var).pos; return _t21; } - else if ((*node._v__ast__ScopeObject)._typ == 323 /* v.ast.AsmRegister */) { + else if ((*node._v__ast__ScopeObject)._typ == 325 /* v.ast.AsmRegister */) { v__token__Pos _t22 = ((v__token__Pos){.len = -1,.line_nr = -1,.pos = -1,.col = -1,.last_line = -1,}); return _t22; } @@ -43019,8 +41104,8 @@ v__token__Pos v__ast__Node_pos(v__ast__Node node) { Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node children = __new_array_with_default(0, 0, sizeof(v__ast__Node), 0); - if ((node)._typ == 297 /* v.ast.Expr */) { - if ((*node._v__ast__Expr)._typ == 291 /* v.ast.StringInterLiteral */) { + if ((node)._typ == 299 /* v.ast.Expr */) { + if ((*node._v__ast__Expr)._typ == 293 /* v.ast.StringInterLiteral */) { Array_v__ast__Node _t2 = {0}; Array_v__ast__Expr _t2_orig = (*(*node._v__ast__Expr)._v__ast__StringInterLiteral).exprs; int _t2_len = _t2_orig.len; @@ -43034,7 +41119,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t1 =_t2; return _t1; } - else if ((*node._v__ast__Expr)._typ == 250 /* v.ast.Assoc */) { + else if ((*node._v__ast__Expr)._typ == 252 /* v.ast.Assoc */) { Array_v__ast__Node _t5 = {0}; Array_v__ast__Expr _t5_orig = (*(*node._v__ast__Expr)._v__ast__Assoc).exprs; int _t5_len = _t5_orig.len; @@ -43048,7 +41133,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t4 =_t5; return _t4; } - else if ((*node._v__ast__Expr)._typ == 248 /* v.ast.ArrayInit */) { + else if ((*node._v__ast__Expr)._typ == 250 /* v.ast.ArrayInit */) { Array_v__ast__Node _t8 = {0}; Array_v__ast__Expr _t8_orig = (*(*node._v__ast__Expr)._v__ast__ArrayInit).exprs; int _t8_len = _t8_orig.len; @@ -43062,37 +41147,37 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t7 =_t8; return _t7; } - else if ((*node._v__ast__Expr)._typ == 288 /* v.ast.SelectorExpr */) { + else if ((*node._v__ast__Expr)._typ == 290 /* v.ast.SelectorExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__SelectorExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 284 /* v.ast.PostfixExpr */) { + else if ((*node._v__ast__Expr)._typ == 286 /* v.ast.PostfixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__PostfixExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 296 /* v.ast.UnsafeExpr */) { + else if ((*node._v__ast__Expr)._typ == 298 /* v.ast.UnsafeExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__UnsafeExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 249 /* v.ast.AsCast */) { + else if ((*node._v__ast__Expr)._typ == 251 /* v.ast.AsCast */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__AsCast).expr) })); } - else if ((*node._v__ast__Expr)._typ == 283 /* v.ast.ParExpr */) { + else if ((*node._v__ast__Expr)._typ == 285 /* v.ast.ParExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ParExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 270 /* v.ast.IfGuardExpr */) { + else if ((*node._v__ast__Expr)._typ == 272 /* v.ast.IfGuardExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IfGuardExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 289 /* v.ast.SizeOf */) { + else if ((*node._v__ast__Expr)._typ == 291 /* v.ast.SizeOf */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__SizeOf).expr) })); } - else if ((*node._v__ast__Expr)._typ == 275 /* v.ast.Likely */) { + else if ((*node._v__ast__Expr)._typ == 277 /* v.ast.Likely */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__Likely).expr) })); } - else if ((*node._v__ast__Expr)._typ == 295 /* v.ast.TypeOf */) { + else if ((*node._v__ast__Expr)._typ == 297 /* v.ast.TypeOf */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__TypeOf).expr) })); } - else if ((*node._v__ast__Expr)._typ == 247 /* v.ast.ArrayDecompose */) { + else if ((*node._v__ast__Expr)._typ == 249 /* v.ast.ArrayDecompose */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ArrayDecompose).expr) })); } - else if ((*node._v__ast__Expr)._typ == 276 /* v.ast.LockExpr */) { + else if ((*node._v__ast__Expr)._typ == 278 /* v.ast.LockExpr */) { Array_v__ast__Node _t21 = {0}; Array_v__ast__Stmt _t21_orig = (*(*node._v__ast__Expr)._v__ast__LockExpr).stmts; int _t21_len = _t21_orig.len; @@ -43106,7 +41191,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t20 =_t21; return _t20; } - else if ((*node._v__ast__Expr)._typ == 282 /* v.ast.OrExpr */) { + else if ((*node._v__ast__Expr)._typ == 284 /* v.ast.OrExpr */) { Array_v__ast__Node _t24 = {0}; Array_v__ast__Stmt _t24_orig = (*(*node._v__ast__Expr)._v__ast__OrExpr).stmts; int _t24_len = _t24_orig.len; @@ -43120,7 +41205,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t23 =_t24; return _t23; } - else if ((*node._v__ast__Expr)._typ == 293 /* v.ast.StructInit */) { + else if ((*node._v__ast__Expr)._typ == 295 /* v.ast.StructInit */) { Array_v__ast__Node _t27 = {0}; Array_v__ast__StructInitField _t27_orig = (*(*node._v__ast__Expr)._v__ast__StructInit).fields; int _t27_len = _t27_orig.len; @@ -43134,10 +41219,10 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t26 =_t27; return _t26; } - else if ((*node._v__ast__Expr)._typ == 246 /* v.ast.AnonFn */) { + else if ((*node._v__ast__Expr)._typ == 248 /* v.ast.AnonFn */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Stmt_to_sumtype_v__ast__Node(ADDR(v__ast__Stmt, (v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*(*node._v__ast__Expr)._v__ast__AnonFn).decl)))) })); } - else if ((*node._v__ast__Expr)._typ == 254 /* v.ast.CallExpr */) { + else if ((*node._v__ast__Expr)._typ == 256 /* v.ast.CallExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CallExpr).left) })); Array_v__ast__Node _t32 = {0}; Array_v__ast__CallArg _t32_orig = (*(*node._v__ast__Expr)._v__ast__CallExpr).args; @@ -43152,18 +41237,18 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { _PUSH_MANY(&children, (_t32), _t31, Array_v__ast__Node); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(ADDR(v__ast__Expr, (v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*(*node._v__ast__Expr)._v__ast__CallExpr).or_block)))) })); } - else if ((*node._v__ast__Expr)._typ == 272 /* v.ast.InfixExpr */) { + else if ((*node._v__ast__Expr)._typ == 274 /* v.ast.InfixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__InfixExpr).left) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__InfixExpr).right) })); } - else if ((*node._v__ast__Expr)._typ == 285 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__Expr)._typ == 287 /* v.ast.PrefixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__PrefixExpr).right) })); } - else if ((*node._v__ast__Expr)._typ == 271 /* v.ast.IndexExpr */) { + else if ((*node._v__ast__Expr)._typ == 273 /* v.ast.IndexExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IndexExpr).left) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IndexExpr).index) })); } - else if ((*node._v__ast__Expr)._typ == 269 /* v.ast.IfExpr */) { + else if ((*node._v__ast__Expr)._typ == 271 /* v.ast.IfExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IfExpr).left) })); Array_v__ast__Node _t42 = {0}; Array_v__ast__IfBranch _t42_orig = (*(*node._v__ast__Expr)._v__ast__IfExpr).branches; @@ -43177,7 +41262,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t42), _t41, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 278 /* v.ast.MatchExpr */) { + else if ((*node._v__ast__Expr)._typ == 280 /* v.ast.MatchExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__MatchExpr).cond) })); Array_v__ast__Node _t46 = {0}; Array_v__ast__MatchBranch _t46_orig = (*(*node._v__ast__Expr)._v__ast__MatchExpr).branches; @@ -43191,7 +41276,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t46), _t45, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 287 /* v.ast.SelectExpr */) { + else if ((*node._v__ast__Expr)._typ == 289 /* v.ast.SelectExpr */) { Array_v__ast__Node _t49 = {0}; Array_v__ast__SelectBranch _t49_orig = (*(*node._v__ast__Expr)._v__ast__SelectExpr).branches; int _t49_len = _t49_orig.len; @@ -43205,10 +41290,10 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t48 =_t49; return _t48; } - else if ((*node._v__ast__Expr)._typ == 256 /* v.ast.ChanInit */) { + else if ((*node._v__ast__Expr)._typ == 258 /* v.ast.ChanInit */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ChanInit).cap_expr) })); } - else if ((*node._v__ast__Expr)._typ == 277 /* v.ast.MapInit */) { + else if ((*node._v__ast__Expr)._typ == 279 /* v.ast.MapInit */) { Array_v__ast__Node _t53 = {0}; Array_v__ast__Expr _t53_orig = (*(*node._v__ast__Expr)._v__ast__MapInit).keys; int _t53_len = _t53_orig.len; @@ -43232,15 +41317,15 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t56), _t55, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 286 /* v.ast.RangeExpr */) { + else if ((*node._v__ast__Expr)._typ == 288 /* v.ast.RangeExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__RangeExpr).low) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__RangeExpr).high) })); } - else if ((*node._v__ast__Expr)._typ == 255 /* v.ast.CastExpr */) { + else if ((*node._v__ast__Expr)._typ == 257 /* v.ast.CastExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CastExpr).expr) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CastExpr).arg) })); } - else if ((*node._v__ast__Expr)._typ == 262 /* v.ast.ConcatExpr */) { + else if ((*node._v__ast__Expr)._typ == 264 /* v.ast.ConcatExpr */) { Array_v__ast__Node _t63 = {0}; Array_v__ast__Expr _t63_orig = (*(*node._v__ast__Expr)._v__ast__ConcatExpr).vals; int _t63_len = _t63_orig.len; @@ -43254,18 +41339,18 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t62 =_t63; return _t62; } - else if ((*node._v__ast__Expr)._typ == 259 /* v.ast.ComptimeCall */) { + else if ((*node._v__ast__Expr)._typ == 261 /* v.ast.ComptimeCall */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ComptimeCall).left) })); } - else if ((*node._v__ast__Expr)._typ == 260 /* v.ast.ComptimeSelector */) { + else if ((*node._v__ast__Expr)._typ == 262 /* v.ast.ComptimeSelector */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ComptimeSelector).left) })); } else { } ; - } else if ((node)._typ == 322 /* v.ast.Stmt */) { - if ((*node._v__ast__Stmt)._typ == 301 /* v.ast.Block */) { + } else if ((node)._typ == 324 /* v.ast.Stmt */) { + if ((*node._v__ast__Stmt)._typ == 303 /* v.ast.Block */) { Array_v__ast__Node _t68 = {0}; Array_v__ast__Stmt _t68_orig = (*(*node._v__ast__Stmt)._v__ast__Block).stmts; int _t68_len = _t68_orig.len; @@ -43279,7 +41364,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t67 =_t68; return _t67; } - else if ((*node._v__ast__Stmt)._typ == 305 /* v.ast.DeferStmt */) { + else if ((*node._v__ast__Stmt)._typ == 307 /* v.ast.DeferStmt */) { Array_v__ast__Node _t71 = {0}; Array_v__ast__Stmt _t71_orig = (*(*node._v__ast__Stmt)._v__ast__DeferStmt).stmts; int _t71_len = _t71_orig.len; @@ -43293,7 +41378,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t70 =_t71; return _t70; } - else if ((*node._v__ast__Stmt)._typ == 309 /* v.ast.ForCStmt */) { + else if ((*node._v__ast__Stmt)._typ == 311 /* v.ast.ForCStmt */) { Array_v__ast__Node _t74 = {0}; Array_v__ast__Stmt _t74_orig = (*(*node._v__ast__Stmt)._v__ast__ForCStmt).stmts; int _t74_len = _t74_orig.len; @@ -43307,7 +41392,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t73 =_t74; return _t73; } - else if ((*node._v__ast__Stmt)._typ == 310 /* v.ast.ForInStmt */) { + else if ((*node._v__ast__Stmt)._typ == 312 /* v.ast.ForInStmt */) { Array_v__ast__Node _t77 = {0}; Array_v__ast__Stmt _t77_orig = (*(*node._v__ast__Stmt)._v__ast__ForInStmt).stmts; int _t77_len = _t77_orig.len; @@ -43321,7 +41406,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t76 =_t77; return _t76; } - else if ((*node._v__ast__Stmt)._typ == 311 /* v.ast.ForStmt */) { + else if ((*node._v__ast__Stmt)._typ == 313 /* v.ast.ForStmt */) { Array_v__ast__Node _t80 = {0}; Array_v__ast__Stmt _t80_orig = (*(*node._v__ast__Stmt)._v__ast__ForStmt).stmts; int _t80_len = _t80_orig.len; @@ -43335,7 +41420,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t79 =_t80; return _t79; } - else if ((*node._v__ast__Stmt)._typ == 303 /* v.ast.ComptimeFor */) { + else if ((*node._v__ast__Stmt)._typ == 305 /* v.ast.ComptimeFor */) { Array_v__ast__Node _t83 = {0}; Array_v__ast__Stmt _t83_orig = (*(*node._v__ast__Stmt)._v__ast__ComptimeFor).stmts; int _t83_len = _t83_orig.len; @@ -43349,13 +41434,13 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t82 =_t83; return _t82; } - else if ((*node._v__ast__Stmt)._typ == 308 /* v.ast.ExprStmt */) { + else if ((*node._v__ast__Stmt)._typ == 310 /* v.ast.ExprStmt */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Stmt)._v__ast__ExprStmt).expr) })); } - else if ((*node._v__ast__Stmt)._typ == 299 /* v.ast.AssertStmt */) { + else if ((*node._v__ast__Stmt)._typ == 301 /* v.ast.AssertStmt */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Stmt)._v__ast__AssertStmt).expr) })); } - else if ((*node._v__ast__Stmt)._typ == 317 /* v.ast.InterfaceDecl */) { + else if ((*node._v__ast__Stmt)._typ == 319 /* v.ast.InterfaceDecl */) { Array_v__ast__Node _t88 = {0}; Array_v__ast__FnDecl _t88_orig = (*(*node._v__ast__Stmt)._v__ast__InterfaceDecl).methods; int _t88_len = _t88_orig.len; @@ -43379,7 +41464,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t91), _t90, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 300 /* v.ast.AssignStmt */) { + else if ((*node._v__ast__Stmt)._typ == 302 /* v.ast.AssignStmt */) { Array_v__ast__Node _t94 = {0}; Array_v__ast__Expr _t94_orig = (*(*node._v__ast__Stmt)._v__ast__AssignStmt).left; int _t94_len = _t94_orig.len; @@ -43403,7 +41488,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t97), _t96, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 319 /* v.ast.Return */) { + else if ((*node._v__ast__Stmt)._typ == 321 /* v.ast.Return */) { Array_v__ast__Node _t100 = {0}; Array_v__ast__Expr _t100_orig = (*(*node._v__ast__Stmt)._v__ast__Return).exprs; int _t100_len = _t100_orig.len; @@ -43417,7 +41502,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t99 =_t100; return _t99; } - else if ((*node._v__ast__Stmt)._typ == 321 /* v.ast.StructDecl */) { + else if ((*node._v__ast__Stmt)._typ == 323 /* v.ast.StructDecl */) { Array_v__ast__Node _t103 = {0}; Array_v__ast__StructField _t103_orig = (*(*node._v__ast__Stmt)._v__ast__StructDecl).fields; int _t103_len = _t103_orig.len; @@ -43431,7 +41516,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t102 =_t103; return _t102; } - else if ((*node._v__ast__Stmt)._typ == 312 /* v.ast.GlobalDecl */) { + else if ((*node._v__ast__Stmt)._typ == 314 /* v.ast.GlobalDecl */) { Array_v__ast__Node _t106 = {0}; Array_v__ast__GlobalField _t106_orig = (*(*node._v__ast__Stmt)._v__ast__GlobalDecl).fields; int _t106_len = _t106_orig.len; @@ -43445,7 +41530,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t105 =_t106; return _t105; } - else if ((*node._v__ast__Stmt)._typ == 304 /* v.ast.ConstDecl */) { + else if ((*node._v__ast__Stmt)._typ == 306 /* v.ast.ConstDecl */) { Array_v__ast__Node _t109 = {0}; Array_v__ast__ConstField _t109_orig = (*(*node._v__ast__Stmt)._v__ast__ConstDecl).fields; int _t109_len = _t109_orig.len; @@ -43459,7 +41544,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t108 =_t109; return _t108; } - else if ((*node._v__ast__Stmt)._typ == 307 /* v.ast.EnumDecl */) { + else if ((*node._v__ast__Stmt)._typ == 309 /* v.ast.EnumDecl */) { Array_v__ast__Node _t112 = {0}; Array_v__ast__EnumField _t112_orig = (*(*node._v__ast__Stmt)._v__ast__EnumDecl).fields; int _t112_len = _t112_orig.len; @@ -43500,8 +41585,8 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t119), _t118, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 245 /* v.ast.TypeDecl */) { - if (((*(*node._v__ast__Stmt)._v__ast__TypeDecl))._typ == 244 /* v.ast.SumTypeDecl */) { + else if ((*node._v__ast__Stmt)._typ == 247 /* v.ast.TypeDecl */) { + if (((*(*node._v__ast__Stmt)._v__ast__TypeDecl))._typ == 246 /* v.ast.SumTypeDecl */) { Array_v__ast__Node _t122 = {0}; Array_v__ast__TypeNode _t122_orig = (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants; int _t122_len = _t122_orig.len; @@ -43519,36 +41604,36 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { else { } ; - } else if ((node)._typ == 327 /* v.ast.ScopeObject */) { - if ((*node._v__ast__ScopeObject)._typ == 325 /* v.ast.GlobalField */) { + } else if ((node)._typ == 329 /* v.ast.ScopeObject */) { + if ((*node._v__ast__ScopeObject)._typ == 327 /* v.ast.GlobalField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__GlobalField).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 324 /* v.ast.ConstField */) { + else if ((*node._v__ast__ScopeObject)._typ == 326 /* v.ast.ConstField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__ConstField).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 326 /* v.ast.Var */) { + else if ((*node._v__ast__ScopeObject)._typ == 328 /* v.ast.Var */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__Var).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 323 /* v.ast.AsmRegister */) { + else if ((*node._v__ast__ScopeObject)._typ == 325 /* v.ast.AsmRegister */) { } ; } else { - if (node._typ == 325 /* v.ast.GlobalField */) { + if (node._typ == 327 /* v.ast.GlobalField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__GlobalField).expr) })); } - else if (node._typ == 324 /* v.ast.ConstField */) { + else if (node._typ == 326 /* v.ast.ConstField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__ConstField).expr) })); } - else if (node._typ == 330 /* v.ast.EnumField */) { + else if (node._typ == 332 /* v.ast.EnumField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__EnumField).expr) })); } - else if (node._typ == 336 /* v.ast.StructInitField */) { + else if (node._typ == 338 /* v.ast.StructInitField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__StructInitField).expr) })); } - else if (node._typ == 328 /* v.ast.CallArg */) { + else if (node._typ == 330 /* v.ast.CallArg */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__CallArg).expr) })); } - else if (node._typ == 334 /* v.ast.SelectBranch */) { + else if (node._typ == 336 /* v.ast.SelectBranch */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Stmt_to_sumtype_v__ast__Node(&(*node._v__ast__SelectBranch).stmt) })); Array_v__ast__Node _t134 = {0}; Array_v__ast__Stmt _t134_orig = (*node._v__ast__SelectBranch).stmts; @@ -43562,7 +41647,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t134), _t133, Array_v__ast__Node); } - else if (node._typ == 331 /* v.ast.IfBranch */) { + else if (node._typ == 333 /* v.ast.IfBranch */) { Array_v__ast__Node _t137 = {0}; Array_v__ast__Stmt _t137_orig = (*node._v__ast__IfBranch).stmts; int _t137_len = _t137_orig.len; @@ -43590,7 +41675,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t139 =_t140; return _t139; } - else if (node._typ == 332 /* v.ast.MatchBranch */) { + else if (node._typ == 334 /* v.ast.MatchBranch */) { Array_v__ast__Node _t143 = {0}; Array_v__ast__Stmt _t143_orig = (*node._v__ast__MatchBranch).stmts; int _t143_len = _t143_orig.len; @@ -43625,7 +41710,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool val) { lx->is_setter = val; - if ((lx->left)._typ == 271 /* v.ast.IndexExpr */) { + if ((lx->left)._typ == 273 /* v.ast.IndexExpr */) { if ((*lx->left._v__ast__IndexExpr).is_map) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*lx->left._v__ast__IndexExpr), val); } @@ -43634,17 +41719,18 @@ void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool va void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx) { lx->is_setter = true; - if ((lx->left)._typ == 271 /* v.ast.IndexExpr */) { + if ((lx->left)._typ == 273 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*lx->left._v__ast__IndexExpr)); - } else if ((lx->left)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 271 /* v.ast.IndexExpr */) { + } else if ((lx->left)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 273 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*(*lx->left._v__ast__SelectorExpr).expr._v__ast__IndexExpr)); } } } Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch) { - Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; switch (arch) { case v__pref__Arch__amd64: case v__pref__Arch__i386: @@ -43799,7 +41885,8 @@ Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__ } VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast__Table* t, Array_string without_numbers, Map_string_int with_numbers, int bit_size) { - Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < without_numbers.len; ++_t1) { string name = ((string*)without_numbers.data)[_t1]; map_set(&res, &(string[]){name}, &(v__ast__ScopeObject[]) { v__ast__AsmRegister_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__AsmRegister, (((v__ast__AsmRegister){.name = name,.typ = v__ast__Table_bitsize_to_type(t, bit_size),.size = bit_size,})))) }); @@ -43835,43 +41922,43 @@ VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast_ } bool v__ast__Expr_is_literal(v__ast__Expr expr) { - if (expr._typ == 252 /* v.ast.BoolLiteral */) { + if (expr._typ == 254 /* v.ast.BoolLiteral */) { bool _t1 = true; return _t1; } - else if (expr._typ == 257 /* v.ast.CharLiteral */) { + else if (expr._typ == 259 /* v.ast.CharLiteral */) { bool _t2 = true; return _t2; } - else if (expr._typ == 266 /* v.ast.FloatLiteral */) { + else if (expr._typ == 268 /* v.ast.FloatLiteral */) { bool _t3 = true; return _t3; } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { bool _t4 = true; return _t4; } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { bool _t5 = v__ast__Expr_is_literal((*expr._v__ast__PrefixExpr).right); return _t5; } - else if (expr._typ == 272 /* v.ast.InfixExpr */) { + else if (expr._typ == 274 /* v.ast.InfixExpr */) { bool _t6 = v__ast__Expr_is_literal((*expr._v__ast__InfixExpr).left) && v__ast__Expr_is_literal((*expr._v__ast__InfixExpr).right); return _t6; } - else if (expr._typ == 283 /* v.ast.ParExpr */) { + else if (expr._typ == 285 /* v.ast.ParExpr */) { bool _t7 = v__ast__Expr_is_literal((*expr._v__ast__ParExpr).expr); return _t7; } - else if (expr._typ == 255 /* v.ast.CastExpr */) { + else if (expr._typ == 257 /* v.ast.CastExpr */) { bool _t8 = !(*expr._v__ast__CastExpr).has_arg && v__ast__Expr_is_literal((*expr._v__ast__CastExpr).expr) && (v__ast__Type_is_ptr((*expr._v__ast__CastExpr).typ) || v__ast__Type_is_pointer((*expr._v__ast__CastExpr).typ) || (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i8_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i16_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__int_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__byte_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u16_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u32_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f32_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__char_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__bool_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__rune_type))); return _t8; } - else if (expr._typ == 289 /* v.ast.SizeOf */) { + else if (expr._typ == 291 /* v.ast.SizeOf */) { bool _t9 = (*expr._v__ast__SizeOf).is_type || v__ast__Expr_is_literal((*expr._v__ast__SizeOf).expr); return _t9; } - else if (expr._typ == 274 /* v.ast.IsRefType */) { + else if (expr._typ == 276 /* v.ast.IsRefType */) { bool _t10 = (*expr._v__ast__IsRefType).is_type || v__ast__Expr_is_literal((*expr._v__ast__IsRefType).expr); return _t10; } @@ -43901,7 +41988,8 @@ bool v__ast__type_can_start_with_token(v__token__Token* tok) { } VV_LOCAL_SYMBOL v__token__KeywordsMatcher v__ast__build_builtin_type_names_matcher(void) { - Map_string_int m = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int m = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < _const_v__ast__builtin_type_names.len; ++i) { string name = ((string*)_const_v__ast__builtin_type_names.data)[i]; map_set(&m, &(string[]){name}, &(int[]) { i }); @@ -44063,7 +42151,7 @@ _option_i8 v__ast__ComptTimeConstValue_i8(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_i8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44080,7 +42168,7 @@ _option_i16 v__ast__ComptTimeConstValue_i16(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_i16 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44097,7 +42185,7 @@ _option_int v__ast__ComptTimeConstValue_int(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_int _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44177,7 +42265,7 @@ _option_i64 v__ast__ComptTimeConstValue_i64(v__ast__ComptTimeConstValue val) { opt_ok2(&(i64[]) { ((int)((*val._rune))) }, (_option*)(&_t12), sizeof(i64)); return _t12; } - else if (val._typ == 264 /* v.ast.EmptyExpr */) { + else if (val._typ == 266 /* v.ast.EmptyExpr */) { } ; return (_option_i64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -44187,7 +42275,7 @@ _option_u8 v__ast__ComptTimeConstValue_u8(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44204,7 +42292,7 @@ _option_u16 v__ast__ComptTimeConstValue_u16(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u16 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44221,7 +42309,7 @@ _option_u32 v__ast__ComptTimeConstValue_u32(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u32 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44304,7 +42392,7 @@ _option_u64 v__ast__ComptTimeConstValue_u64(v__ast__ComptTimeConstValue val) { } else if (val._typ == 21 /* rune */) { } - else if (val._typ == 264 /* v.ast.EmptyExpr */) { + else if (val._typ == 266 /* v.ast.EmptyExpr */) { } ; return (_option_u64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -44314,7 +42402,7 @@ _option_f32 v__ast__ComptTimeConstValue_f32(v__ast__ComptTimeConstValue val) { _option_f64 _t1 = v__ast__ComptTimeConstValue_f64(val); if (_t1.state != 0) { /*or block*/ _option_f32 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -44382,7 +42470,7 @@ _option_f64 v__ast__ComptTimeConstValue_f64(v__ast__ComptTimeConstValue val) { } else if (val._typ == 21 /* rune */) { } - else if (val._typ == 264 /* v.ast.EmptyExpr */) { + else if (val._typ == 266 /* v.ast.EmptyExpr */) { } ; return (_option_f64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -44449,14 +42537,14 @@ _option_string v__ast__ComptTimeConstValue_string(v__ast__ComptTimeConstValue va opt_ok2(&(string[]) { (*val._string) }, (_option*)(&_t12), sizeof(string)); return _t12; } - else if (val._typ == 264 /* v.ast.EmptyExpr */) { + else if (val._typ == 266 /* v.ast.EmptyExpr */) { } ; return (_option_string){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } _option_v__ast__ComptTimeConstValue v__ast__ConstField_comptime_expr_value(v__ast__ConstField* obj) { - if ((obj->comptime_expr_value)._typ != 264 /* v.ast.EmptyExpr */) { + if ((obj->comptime_expr_value)._typ != 266 /* v.ast.EmptyExpr */) { _option_v__ast__ComptTimeConstValue _t1; opt_ok2(&(v__ast__ComptTimeConstValue[]) { obj->comptime_expr_value }, (_option*)(&_t1), sizeof(v__ast__ComptTimeConstValue)); return _t1; @@ -44465,12 +42553,12 @@ _option_v__ast__ComptTimeConstValue v__ast__ConstField_comptime_expr_value(v__as } bool v__ast__ConstField_is_simple_define_const(v__ast__ConstField* obj) { - bool _t1 = ((obj->expr._typ == 257 /* v.ast.CharLiteral */)? (true) : (obj->expr._typ == 266 /* v.ast.FloatLiteral */)? (true) : (obj->expr._typ == 273 /* v.ast.IntegerLiteral */)? (true) : (false)); + bool _t1 = ((obj->expr._typ == 259 /* v.ast.CharLiteral */)? (true) : (obj->expr._typ == 268 /* v.ast.FloatLiteral */)? (true) : (obj->expr._typ == 275 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } bool v__ast__ScopeObject_is_simple_define_const(v__ast__ScopeObject obj) { - if ((obj)._typ == 324 /* v.ast.ConstField */) { + if ((obj)._typ == 326 /* v.ast.ConstField */) { bool _t1 = v__ast__ConstField_is_simple_define_const(&(*obj._v__ast__ConstField)); return _t1; } @@ -44486,7 +42574,7 @@ u64 v__ast__EmbeddedFile_hash(v__ast__EmbeddedFile e) { v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ast__Table* t) { v__ast__TypeSymbol* type_sym = v__ast__Table_sym(t, typ); if (type_sym->kind == v__ast__Kind__array) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; bool has_len = false; bool has_cap = false; bool has_default = false; @@ -44536,7 +42624,7 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ })))); return _t3; } else if (type_sym->kind == v__ast__Kind__map) { - v__ast__Map map_info = /* as */ *(v__ast__Map*)__as_cast((type_sym->info)._v__ast__Map,(type_sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map map_info = /* as */ *(v__ast__Map*)__as_cast((type_sym->info)._v__ast__Map,(type_sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; Array_v__ast__Expr keys = __new_array_with_default(0, 0, sizeof(v__ast__Expr), 0); 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) { @@ -44612,7 +42700,7 @@ _option_v__ast__Var_ptr v__ast__Scope_find_var(v__ast__Scope* s, string name) { _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { _option_v__ast__Var_ptr _t2; opt_ok2(&(v__ast__Var*[]) { &(*obj._v__ast__Var) }, (_option*)(&_t2), sizeof(v__ast__Var*)); return _t2; @@ -44629,7 +42717,7 @@ _option_v__ast__GlobalField_ptr v__ast__Scope_find_global(v__ast__Scope* s, stri _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 325 /* v.ast.GlobalField */) { + if (obj._typ == 327 /* v.ast.GlobalField */) { _option_v__ast__GlobalField_ptr _t2; opt_ok2(&(v__ast__GlobalField*[]) { &(*obj._v__ast__GlobalField) }, (_option*)(&_t2), sizeof(v__ast__GlobalField*)); return _t2; @@ -44646,7 +42734,7 @@ _option_v__ast__ConstField_ptr v__ast__Scope_find_const(v__ast__Scope* s, string _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 324 /* v.ast.ConstField */) { + if (obj._typ == 326 /* v.ast.ConstField */) { _option_v__ast__ConstField_ptr _t2; opt_ok2(&(v__ast__ConstField*[]) { &(*obj._v__ast__ConstField) }, (_option*)(&_t2), sizeof(v__ast__ConstField*)); return _t2; @@ -44687,7 +42775,7 @@ bool v__ast__Scope_known_const(v__ast__Scope* s, string name) { void v__ast__Scope_update_var_type(v__ast__Scope* s, string name, v__ast__Type typ) { v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)map_get(ADDR(map, s->objects), &(string[]){name}, &(v__ast__ScopeObject[]){ {0} })); - if ((obj)._typ == 326 /* v.ast.Var */) { + if ((obj)._typ == 328 /* v.ast.Var */) { if (!v__ast__Type_alias_eq((*obj._v__ast__Var).typ, typ)) { (*obj._v__ast__Var).typ = typ; } @@ -44765,7 +42853,7 @@ bool v__ast__Scope_has_inherited_vars(v__ast__Scope* s) { } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if ((obj)._typ == 326 /* v.ast.Var */) { + if ((obj)._typ == 328 /* v.ast.Var */) { if ((*obj._v__ast__Var).is_inherited) { bool _t5 = true; return _t5; @@ -44795,10 +42883,10 @@ v__ast__Scope* sc = HEAP(v__ast__Scope, _v_toheap_sc); } if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t2.key_values, _t3)); - if (obj._typ == 324 /* v.ast.ConstField */) { + if (obj._typ == 326 /* v.ast.ConstField */) { out = /*f*/string__plus(out, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = indent}}, {_SLIT(" * const: "), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT(" - "), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*obj._v__ast__ConstField).typ)}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))); } - else if (obj._typ == 326 /* v.ast.Var */) { + else if (obj._typ == 328 /* v.ast.Var */) { out = /*f*/string__plus(out, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = indent}}, {_SLIT(" * var: "), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__Var).name}}, {_SLIT(" - "), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*obj._v__ast__Var).typ)}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))); } @@ -44931,7 +43019,7 @@ VV_LOCAL_SYMBOL void v__ast__stringify_fn_after_name(v__ast__FnDecl* node, strin if (node->generic_names.len > 0) { if (node->is_method) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, (*(v__ast__Param*)/*ee elem_sym */array_get(node->params, 0)).typ); - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*sym->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -45052,24 +43140,24 @@ multi_return_string_bool v__ast__StringInterLiteral_get_fspec_braces(v__ast__Str if (!needs_braces) { v__ast__Expr sub_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(lit->exprs, i)); for (;;) { - if (sub_expr._typ == 268 /* v.ast.Ident */) { + if (sub_expr._typ == 270 /* v.ast.Ident */) { if (string_at((*sub_expr._v__ast__Ident).name, 0) == '@') { needs_braces = true; } break; } - else if (sub_expr._typ == 254 /* v.ast.CallExpr */) { + else if (sub_expr._typ == 256 /* v.ast.CallExpr */) { if ((*sub_expr._v__ast__CallExpr).args.len != 0 || (*sub_expr._v__ast__CallExpr).concrete_types.len != 0 || (*sub_expr._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option || (*sub_expr._v__ast__CallExpr).or_block.stmts.len > 0) { needs_braces = true; - } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 254 /* v.ast.CallExpr */) { + } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 256 /* v.ast.CallExpr */) { sub_expr = (*sub_expr._v__ast__CallExpr).left; continue; - } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 255 /* v.ast.CastExpr */ || ((*sub_expr._v__ast__CallExpr).left)._typ == 271 /* v.ast.IndexExpr */) { + } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 257 /* v.ast.CastExpr */ || ((*sub_expr._v__ast__CallExpr).left)._typ == 273 /* v.ast.IndexExpr */) { needs_braces = true; } break; } - else if (sub_expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (sub_expr._typ == 290 /* v.ast.SelectorExpr */) { if (string_at((*sub_expr._v__ast__SelectorExpr).field_name, 0) == '@') { needs_braces = true; break; @@ -45107,19 +43195,19 @@ multi_return_string_bool v__ast__StringInterLiteral_get_fspec_braces(v__ast__Str } string v__ast__Expr_str(v__ast__Expr x) { - if (x._typ == 246 /* v.ast.AnonFn */) { + if (x._typ == 248 /* v.ast.AnonFn */) { string _t1 = _SLIT("anon_fn"); return _t1; } - else if (x._typ == 261 /* v.ast.ComptimeType */) { + else if (x._typ == 263 /* v.ast.ComptimeType */) { string _t2 = v__ast__ComptimeType_str((*x._v__ast__ComptimeType)); return _t2; } - else if (x._typ == 263 /* v.ast.DumpExpr */) { + else if (x._typ == 265 /* v.ast.DumpExpr */) { string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("dump("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__DumpExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t3; } - else if (x._typ == 248 /* v.ast.ArrayInit */) { + else if (x._typ == 250 /* v.ast.ArrayInit */) { Array_string fields = __new_array_with_default(0, 0, sizeof(string), 0); if ((*x._v__ast__ArrayInit).has_len) { array_push((array*)&fields, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("len: "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ArrayInit).len_expr)}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); @@ -45138,27 +43226,27 @@ string v__ast__Expr_str(v__ast__Expr x) { return _t8; } } - else if (x._typ == 249 /* v.ast.AsCast */) { + else if (x._typ == 251 /* v.ast.AsCast */) { string _t9 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__AsCast).expr)}}, {_SLIT(" as "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__AsCast).typ)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t9; } - else if (x._typ == 251 /* v.ast.AtExpr */) { + else if (x._typ == 253 /* v.ast.AtExpr */) { string _t10 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__AtExpr).val}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t10; } - else if (x._typ == 253 /* v.ast.CTempVar */) { + else if (x._typ == 255 /* v.ast.CTempVar */) { string _t11 = v__ast__Expr_str((*x._v__ast__CTempVar).orig); return _t11; } - else if (x._typ == 252 /* v.ast.BoolLiteral */) { + else if (x._typ == 254 /* v.ast.BoolLiteral */) { string _t12 = bool_str((*x._v__ast__BoolLiteral).val); return _t12; } - else if (x._typ == 255 /* v.ast.CastExpr */) { + else if (x._typ == 257 /* v.ast.CastExpr */) { string _t13 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CastExpr).typname}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__CastExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t13; } - else if (x._typ == 254 /* v.ast.CallExpr */) { + else if (x._typ == 256 /* v.ast.CallExpr */) { string sargs = v__ast__args2str((*x._v__ast__CallExpr).args); string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT(" ?")) : (_SLIT(""))); if ((*x._v__ast__CallExpr).is_method) { @@ -45180,11 +43268,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t18 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = propagate_suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t18; } - else if (x._typ == 257 /* v.ast.CharLiteral */) { + else if (x._typ == 259 /* v.ast.CharLiteral */) { string _t19 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CharLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})); return _t19; } - else if (x._typ == 258 /* v.ast.Comment */) { + else if (x._typ == 260 /* v.ast.Comment */) { if ((*x._v__ast__Comment).is_multi) { Array_string lines = string_split_into_lines((*x._v__ast__Comment).text); string _t20 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* "), /*100 &int*/0xfe07, {.d_i32 = lines.len}}, {_SLIT(" lines comment */"), 0, { .d_c = 0 }}})); @@ -45195,11 +43283,11 @@ string v__ast__Expr_str(v__ast__Expr x) { return _t21; } } - else if (x._typ == 260 /* v.ast.ComptimeSelector */) { + else if (x._typ == 262 /* v.ast.ComptimeSelector */) { string _t22 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ComptimeSelector).left)}}, {_SLIT(".$"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ComptimeSelector).field_expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t22; } - else if (x._typ == 262 /* v.ast.ConcatExpr */) { + else if (x._typ == 264 /* v.ast.ConcatExpr */) { Array_string _t24 = {0}; Array_v__ast__Expr _t24_orig = (*x._v__ast__ConcatExpr).vals; int _t24_len = _t24_orig.len; @@ -45213,27 +43301,27 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t23 = Array_string_join(_t24, _SLIT(",")); return _t23; } - else if (x._typ == 265 /* v.ast.EnumVal */) { + else if (x._typ == 267 /* v.ast.EnumVal */) { string _t26 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__EnumVal).val}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t26; } - else if (x._typ == 266 /* v.ast.FloatLiteral */) { + else if (x._typ == 268 /* v.ast.FloatLiteral */) { string _t27 = (*x._v__ast__FloatLiteral).val; return _t27; } - else if (x._typ == 273 /* v.ast.IntegerLiteral */) { + else if (x._typ == 275 /* v.ast.IntegerLiteral */) { string _t28 = (*x._v__ast__IntegerLiteral).val; return _t28; } - else if (x._typ == 267 /* v.ast.GoExpr */) { + else if (x._typ == 269 /* v.ast.GoExpr */) { string _t29 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("go "), /*115 &v.ast.CallExpr*/0xfe10, {.d_s = v__ast__CallExpr_str((*x._v__ast__GoExpr).call_expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t29; } - else if (x._typ == 268 /* v.ast.Ident */) { + else if (x._typ == 270 /* v.ast.Ident */) { string _t30 = (*x._v__ast__Ident).name; return _t30; } - else if (x._typ == 269 /* v.ast.IfExpr */) { + else if (x._typ == 271 /* v.ast.IfExpr */) { Array_string parts = __new_array_with_default(0, 0, sizeof(string), 0); string dollar = ((*x._v__ast__IfExpr).is_comptime ? (_SLIT("$")) : (_SLIT(""))); for (int i = 0; i < (*x._v__ast__IfExpr).branches.len; ++i) { @@ -45253,15 +43341,15 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t36 = Array_string_join(parts, _SLIT("")); return _t36; } - else if (x._typ == 271 /* v.ast.IndexExpr */) { + else if (x._typ == 273 /* v.ast.IndexExpr */) { string _t37 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); return _t37; } - else if (x._typ == 272 /* v.ast.InfixExpr */) { + else if (x._typ == 274 /* v.ast.InfixExpr */) { string _t38 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t38; } - else if (x._typ == 277 /* v.ast.MapInit */) { + else if (x._typ == 279 /* v.ast.MapInit */) { Array_string pairs = __new_array_with_default(0, 0, sizeof(string), 0); for (int ik = 0; ik < (*x._v__ast__MapInit).keys.len; ++ik) { v__ast__Expr kv = ((v__ast__Expr*)(*x._v__ast__MapInit).keys.data)[ik]; @@ -45271,11 +43359,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t40 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t40; } - else if (x._typ == 283 /* v.ast.ParExpr */) { + else if (x._typ == 285 /* v.ast.ParExpr */) { string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t41; } - else if (x._typ == 284 /* v.ast.PostfixExpr */) { + else if (x._typ == 286 /* v.ast.PostfixExpr */) { if ((*x._v__ast__PostfixExpr).op == v__token__Kind__question) { string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); return _t42; @@ -45283,11 +43371,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t43 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t43; } - else if (x._typ == 285 /* v.ast.PrefixExpr */) { + else if (x._typ == 287 /* v.ast.PrefixExpr */) { string _t44 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); return _t44; } - else if (x._typ == 286 /* v.ast.RangeExpr */) { + else if (x._typ == 288 /* v.ast.RangeExpr */) { string s = _SLIT(".."); if ((*x._v__ast__RangeExpr).has_low) { s = string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__RangeExpr).low)}}, {_SLIT(" "), 0, { .d_c = 0 }}})), s); @@ -45298,15 +43386,15 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t45 = s; return _t45; } - else if (x._typ == 287 /* v.ast.SelectExpr */) { + else if (x._typ == 289 /* v.ast.SelectExpr */) { string _t46 = _SLIT("ast.SelectExpr"); return _t46; } - else if (x._typ == 288 /* v.ast.SelectorExpr */) { + else if (x._typ == 290 /* v.ast.SelectorExpr */) { string _t47 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t47; } - else if (x._typ == 289 /* v.ast.SizeOf */) { + else if (x._typ == 291 /* v.ast.SizeOf */) { if ((*x._v__ast__SizeOf).is_type) { string _t48 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t48; @@ -45314,11 +43402,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t49; } - else if (x._typ == 281 /* v.ast.OffsetOf */) { + else if (x._typ == 283 /* v.ast.OffsetOf */) { string _t50 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t50; } - else if (x._typ == 291 /* v.ast.StringInterLiteral */) { + else if (x._typ == 293 /* v.ast.StringInterLiteral */) { strings__Builder res = strings__new_builder(50); strings__Builder_write_string(&res, _SLIT("'")); for (int i = 0; i < (*x._v__ast__StringInterLiteral).vals.len; ++i) { @@ -45344,35 +43432,35 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t51 = strings__Builder_str(&res); return _t51; } - else if (x._typ == 292 /* v.ast.StringLiteral */) { + else if (x._typ == 294 /* v.ast.StringLiteral */) { string _t52 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); return _t52; } - else if (x._typ == 294 /* v.ast.TypeNode */) { + else if (x._typ == 296 /* v.ast.TypeNode */) { string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t53; } - else if (x._typ == 295 /* v.ast.TypeOf */) { + else if (x._typ == 297 /* v.ast.TypeOf */) { string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t54; } - else if (x._typ == 275 /* v.ast.Likely */) { + else if (x._typ == 277 /* v.ast.Likely */) { string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t55; } - else if (x._typ == 296 /* v.ast.UnsafeExpr */) { + else if (x._typ == 298 /* v.ast.UnsafeExpr */) { string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t56; } - else if (x._typ == 280 /* v.ast.None */) { + else if (x._typ == 282 /* v.ast.None */) { string _t57 = _SLIT("none"); return _t57; } - else if (x._typ == 274 /* v.ast.IsRefType */) { + else if (x._typ == 276 /* v.ast.IsRefType */) { string _t58 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); return _t58; } - else if (x._typ == 270 /* v.ast.IfGuardExpr */) { + else if (x._typ == 272 /* v.ast.IfGuardExpr */) { string s = _SLIT(""); for (int i = 0; i < (*x._v__ast__IfGuardExpr).vars.len; ++i) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*x._v__ast__IfGuardExpr).vars.data)[i]; @@ -45384,48 +43472,48 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t59 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); return _t59; } - else if (x._typ == 293 /* v.ast.StructInit */) { + else if (x._typ == 295 /* v.ast.StructInit */) { string sname = v__ast__Table_sym(global_table, (*x._v__ast__StructInit).typ)->name; string _t60 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); return _t60; } - else if (x._typ == 247 /* v.ast.ArrayDecompose */) { + else if (x._typ == 249 /* v.ast.ArrayDecompose */) { string _t61 = _SLIT("ast.ArrayDecompose"); return _t61; } - else if (x._typ == 250 /* v.ast.Assoc */) { + else if (x._typ == 252 /* v.ast.Assoc */) { string _t62 = _SLIT("ast.Assoc"); return _t62; } - else if (x._typ == 256 /* v.ast.ChanInit */) { + else if (x._typ == 258 /* v.ast.ChanInit */) { string _t63 = _SLIT("ast.ChanInit"); return _t63; } - else if (x._typ == 259 /* v.ast.ComptimeCall */) { + else if (x._typ == 261 /* v.ast.ComptimeCall */) { string _t64 = _SLIT("ast.ComptimeCall"); return _t64; } - else if (x._typ == 264 /* v.ast.EmptyExpr */) { + else if (x._typ == 266 /* v.ast.EmptyExpr */) { string _t65 = _SLIT("ast.EmptyExpr"); return _t65; } - else if (x._typ == 276 /* v.ast.LockExpr */) { + else if (x._typ == 278 /* v.ast.LockExpr */) { string _t66 = _SLIT("ast.LockExpr"); return _t66; } - else if (x._typ == 278 /* v.ast.MatchExpr */) { + else if (x._typ == 280 /* v.ast.MatchExpr */) { string _t67 = _SLIT("ast.MatchExpr"); return _t67; } - else if (x._typ == 279 /* v.ast.NodeError */) { + else if (x._typ == 281 /* v.ast.NodeError */) { string _t68 = _SLIT("ast.NodeError"); return _t68; } - else if (x._typ == 282 /* v.ast.OrExpr */) { + else if (x._typ == 284 /* v.ast.OrExpr */) { string _t69 = _SLIT("ast.OrExpr"); return _t69; } - else if (x._typ == 290 /* v.ast.SqlExpr */) { + else if (x._typ == 292 /* v.ast.SqlExpr */) { string _t70 = _SLIT("ast.SqlExpr"); return _t70; } @@ -45463,15 +43551,15 @@ string v__ast__BranchStmt_str(v__ast__BranchStmt* node) { } string v__ast__Stmt_str(v__ast__Stmt node) { - if (node._typ == 299 /* v.ast.AssertStmt */) { + if (node._typ == 301 /* v.ast.AssertStmt */) { string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("assert "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*node._v__ast__AssertStmt).expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t1; } - else if (node._typ == 300 /* v.ast.AssignStmt */) { + else if (node._typ == 302 /* v.ast.AssignStmt */) { string out = _SLIT(""); for (int i = 0; i < (*node._v__ast__AssignStmt).left.len; ++i) { v__ast__Expr left = ((v__ast__Expr*)(*node._v__ast__AssignStmt).left.data)[i]; - if ((left)._typ == 268 /* v.ast.Ident */) { + if ((left)._typ == 270 /* v.ast.Ident */) { v__ast__IdentVar var_info = v__ast__Ident_var_info(&(*left._v__ast__Ident)); if (var_info.is_mut) { out = /*f*/string__plus(out, _SLIT("mut ")); @@ -45493,11 +43581,11 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t2 = out; return _t2; } - else if (node._typ == 302 /* v.ast.BranchStmt */) { + else if (node._typ == 304 /* v.ast.BranchStmt */) { string _t3 = v__ast__BranchStmt_str(&(*node._v__ast__BranchStmt)); return _t3; } - else if (node._typ == 304 /* v.ast.ConstDecl */) { + else if (node._typ == 306 /* v.ast.ConstDecl */) { Array_string _t4 = {0}; Array_v__ast__ConstField _t4_orig = (*node._v__ast__ConstDecl).fields; int _t4_len = _t4_orig.len; @@ -45512,7 +43600,7 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("const ("), /*115 &string*/0xfe10, {.d_s = Array_string_join(fields, _SLIT(" "))}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t6; } - else if (node._typ == 308 /* v.ast.ExprStmt */) { + else if (node._typ == 310 /* v.ast.ExprStmt */) { string _t7 = v__ast__Expr_str((*node._v__ast__ExprStmt).expr); return _t7; } @@ -45520,15 +43608,15 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t8 = str_intp(4, _MOV((StrIntpData[]){{_SLIT("fn "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__FnDecl).name}}, {_SLIT("( "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__FnDecl).params.len}}, {_SLIT(" params ) { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__FnDecl).stmts.len}}, {_SLIT(" stmts }"), 0, { .d_c = 0 }}})); return _t8; } - else if (node._typ == 307 /* v.ast.EnumDecl */) { + else if (node._typ == 309 /* v.ast.EnumDecl */) { string _t9 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("enum "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__EnumDecl).name}}, {_SLIT(" { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__EnumDecl).fields.len}}, {_SLIT(" fields }"), 0, { .d_c = 0 }}})); return _t9; } - else if (node._typ == 318 /* v.ast.Module */) { + else if (node._typ == 320 /* v.ast.Module */) { string _t10 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("module "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Module).name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t10; } - else if (node._typ == 316 /* v.ast.Import */) { + else if (node._typ == 318 /* v.ast.Import */) { string out = str_intp(2, _MOV((StrIntpData[]){{_SLIT("import "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Import).mod}}, {_SLIT0, 0, { .d_c = 0 }}})); if ((*node._v__ast__Import).alias.len > 0) { out = /*f*/string__plus(out, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" as "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Import).alias}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -45536,7 +43624,7 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t11 = out; return _t11; } - else if (node._typ == 321 /* v.ast.StructDecl */) { + else if (node._typ == 323 /* v.ast.StructDecl */) { string _t12 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("struct "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__StructDecl).name}}, {_SLIT(" { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__StructDecl).fields.len}}, {_SLIT(" fields }"), 0, { .d_c = 0 }}})); return _t12; } @@ -45848,7 +43936,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__Fn new_fn = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -45911,8 +43999,8 @@ _option_v__ast__Fn v__ast__Table_find_method(v__ast__Table* t, v__ast__TypeSymbo Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, v__ast__GetEmbedsOptions options) { Array_Array_v__ast__Type embeds = __new_array_with_default(0, 0, sizeof(Array_v__ast__Type), 0); - v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 433 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); - if ((unalias_sym->info)._typ == 418 /* v.ast.Struct */) { + v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 435 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); + if ((unalias_sym->info)._typ == 420 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*unalias_sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*unalias_sym->info._v__ast__Struct).embeds.data)[_t1]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(t, embed); @@ -45929,7 +44017,7 @@ Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__Type } _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, string method_name) { - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { @@ -45963,7 +44051,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 436 /* v.ast.Interface */) { + } else if ((sym->info)._typ == 438 /* v.ast.Interface */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t11 = 0; _t11 < (*sym->info._v__ast__Interface).embeds.len; ++_t11) { @@ -45997,7 +44085,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 431 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 433 /* v.ast.Aggregate */) { for (int _t21 = 0; _t21 < (*sym->info._v__ast__Aggregate).types.len; ++_t21) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t21]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -46047,7 +44135,7 @@ _option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__as Array_v__ast__Fn v__ast__Table_get_embed_methods(v__ast__Table* t, v__ast__TypeSymbol* sym) { Array_v__ast__Fn methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t1]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(t, embed); @@ -46063,7 +44151,7 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -46105,7 +44193,7 @@ bool v__ast__Table_struct_has_field(v__ast__Table* t, v__ast__TypeSymbol* struct Array_v__ast__StructField v__ast__Table_struct_fields(v__ast__Table* t, v__ast__TypeSymbol* sym) { Array_v__ast__StructField fields = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { _PUSH_MANY(&fields, ((*sym->info._v__ast__Struct).fields), _t1, Array_v__ast__StructField); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Struct).embeds.len; ++_t2) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t2]; @@ -46120,7 +44208,7 @@ Array_v__ast__StructField v__ast__Table_struct_fields(v__ast__Table* t, v__ast__ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__TypeSymbol* s, string name) { v__ast__TypeSymbol* ts = s; for (;;) { - if (ts->info._typ == 418 /* v.ast.Struct */) { + if (ts->info._typ == 420 /* v.ast.Struct */) { _option_v__ast__StructField _t1; if (_t1 = v__ast__Struct_find_field(&(*ts->info._v__ast__Struct), name), _t1.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t1.data; @@ -46129,7 +44217,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t2; } } - else if (ts->info._typ == 431 /* v.ast.Aggregate */) { + else if (ts->info._typ == 433 /* v.ast.Aggregate */) { _option_v__ast__StructField _t3; if (_t3 = v__ast__Aggregate_find_field(&(*ts->info._v__ast__Aggregate), name), _t3.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t3.data; @@ -46148,7 +44236,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t7), sizeof(v__ast__StructField)); return _t7; } - else if (ts->info._typ == 436 /* v.ast.Interface */) { + else if (ts->info._typ == 438 /* v.ast.Interface */) { _option_v__ast__StructField _t8; if (_t8 = v__ast__Interface_find_field(&(*ts->info._v__ast__Interface), name), _t8.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t8.data; @@ -46157,7 +44245,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t9; } } - else if (ts->info._typ == 437 /* v.ast.SumType */) { + else if (ts->info._typ == 439 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, ts); _option_v__ast__StructField _t10; if (_t10 = v__ast__SumType_find_field(&(*ts->info._v__ast__SumType), name), _t10.state == 0) { @@ -46181,7 +44269,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T } _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_field_from_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, string field_name) { - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { Array_v__ast__StructField found_fields = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); Array_v__ast__Type embeds_of_found_fields = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { @@ -46215,7 +44303,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f } else if (found_fields.len > 1) { return (_option_multi_return_v__ast__StructField_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 431 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 433 /* v.ast.Aggregate */) { for (int _t11 = 0; _t11 < (*sym->info._v__ast__Aggregate).types.len; ++_t11) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t11]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -46234,7 +44322,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f return _t13; } } - } else if ((sym->info)._typ == 433 /* v.ast.Alias */) { + } else if ((sym->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* unalias_sym = v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type); _option_multi_return_v__ast__StructField_Array_v__ast__Type _t14 = v__ast__Table_find_field_from_embeds(t, unalias_sym, field_name); return _t14; @@ -46269,20 +44357,22 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeSymbol* sym_) { v__ast__TypeSymbol* sym = sym_; - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; if (info.found_fields) { return; } - Map_string_v__ast__StructField field_map = new_map(sizeof(string), sizeof(v__ast__StructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int field_usages = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__StructField field_map = new_map(sizeof(string), sizeof(v__ast__StructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int field_usages = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < info.variants.len; ++_t1) { v__ast__Type variant = ((v__ast__Type*)info.variants.data)[_t1]; v__ast__TypeSymbol* v_sym = v__ast__Table_final_sym(t, variant); Array_v__ast__StructField _t2 = __new_array(0, 0, sizeof(v__ast__StructField)); - if (v_sym->info._typ == 418 /* v.ast.Struct */) { + if (v_sym->info._typ == 420 /* v.ast.Struct */) { _t2 = v__ast__Table_struct_fields(t, v_sym); } - else if (v_sym->info._typ == 437 /* v.ast.SumType */) { + else if (v_sym->info._typ == 439 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, v_sym); _t2 = (*v_sym->info._v__ast__SumType).fields; } @@ -46370,7 +44460,7 @@ inline v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Typ if (idx > 0) { v__ast__TypeSymbol* current_symbol = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); if (current_symbol->kind == v__ast__Kind__alias) { - idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); } v__ast__TypeSymbol* _t1 = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); return _t1; @@ -46391,7 +44481,7 @@ inline string v__ast__Table_get_type_name(v__ast__Table* t, v__ast__Type typ) { inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; if (pt <= _const_v__ast__char_type && pt >= _const_v__ast__void_type) { v__ast__Type _t1 = pt; return _t1; @@ -46405,7 +44495,7 @@ inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Typ inline v__ast__Type v__ast__Table_unaliased_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; v__ast__Type _t1 = pt; return _t1; } @@ -46530,15 +44620,15 @@ bool v__ast__Table_known_type_idx(v__ast__Table* t, v__ast__Type typ) { return _t2; } else if (sym->kind == (v__ast__Kind__array)) { - bool _t3 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type); + bool _t3 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type); return _t3; } else if (sym->kind == (v__ast__Kind__array_fixed)) { - bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type); + bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type); return _t4; } else if (sym->kind == (v__ast__Kind__map)) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; bool _t5 = v__ast__Table_known_type_idx(t, info.key_type) && v__ast__Table_known_type_idx(t, info.value_type); return _t5; } @@ -46578,7 +44668,7 @@ inline string v__ast__Table_array_cname(v__ast__Table* t, v__ast__Type elem_type inline string v__ast__Table_array_fixed_name(v__ast__Table* t, v__ast__Type elem_type, int size, v__ast__Expr size_expr) { v__ast__TypeSymbol* elem_type_sym = v__ast__Table_sym(t, elem_type); string ptr = (v__ast__Type_is_ptr(elem_type) ? (string_repeat(_SLIT("&"), v__ast__Type_nr_muls(elem_type))) : (_SLIT(""))); - string size_str = ((size_expr)._typ == 264 /* v.ast.EmptyExpr */ || size != 987654321 ? (int_str(size)) : (v__ast__Expr_str(size_expr))); + string size_str = ((size_expr)._typ == 266 /* v.ast.EmptyExpr */ || size != 987654321 ? (int_str(size)) : (v__ast__Expr_str(size_expr))); string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT("["), /*115 &string*/0xfe10, {.d_s = size_str}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = ptr}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t1; } @@ -46836,22 +44926,22 @@ int v__ast__Table_add_placeholder_type(v__ast__Table* t, string name, v__ast__La inline v__ast__Type v__ast__Table_value_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(t, typ); if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type _t1 = array_info.elem_type; return _t1; } if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type _t2 = info.elem_type; return _t2; } if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__ast__Type _t3 = info.elem_type; return _t3; } if (sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; v__ast__Type _t4 = info.value_type; return _t4; } @@ -46904,7 +44994,7 @@ bool v__ast__Table_register_fn_concrete_types(v__ast__Table* t, string fn_name, bool v__ast__Table_sumtype_has_variant(v__ast__Table* t, v__ast__Type parent, v__ast__Type variant, bool is_as) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent); if (parent_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; v__ast__TypeSymbol* var_sym = v__ast__Table_sym(t, variant); if (var_sym->kind == (v__ast__Kind__aggregate)) { @@ -46937,7 +45027,7 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_variant_in_type(v__ast__Table* } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type* aggregate_type, bool is_as) { - v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ; + v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; for (int _t1 = 0; _t1 < aggregate_sym.types.len; ++_t1) { v__ast__Type var_type = ((v__ast__Type*)aggregate_sym.types.data)[_t1]; if (!v__ast__Table_sumtype_has_variant(t, parent_type, var_type, is_as)) { @@ -46950,9 +45040,9 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_alias_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type alias_type, bool is_as) { - v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; if (!v__ast__Table_sumtype_check_variant_in_type(t, parent_sym, alias_type, is_as)) { - v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; bool _t1 = v__ast__Type_alias_eq(parent_type, alias_info.parent_type) || v__ast__Table_sumtype_has_variant(t, parent_type, alias_info.parent_type, is_as); return _t1; } @@ -46995,7 +45085,7 @@ Array_string v__ast__Table_known_type_names(v__ast__Table* t) { } bool v__ast__Table_has_deep_child_no_ref(v__ast__Table* t, v__ast__TypeSymbol* ts, string name) { - if ((ts->info)._typ == 418 /* v.ast.Struct */) { + if ((ts->info)._typ == 420 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*ts->info._v__ast__Struct).fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)(*ts->info._v__ast__Struct).fields.data)[_t1]; v__ast__TypeSymbol* sym = v__ast__Table_sym(t, field.typ); @@ -47094,7 +45184,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t3 = false; return _t3; } - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { bool _t4 = false; return _t4; @@ -47105,7 +45195,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t5 = false; return _t5; } - if ((inter_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; @@ -47196,12 +45286,12 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t5; } } - if (sym->info._typ == 413 /* v.ast.Array */) { + if (sym->info._typ == 415 /* v.ast.Array */) { v__ast__Type elem_type = (*sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 413 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 415 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; @@ -47221,7 +45311,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { _option_v__ast__Type _t9; if (_t9 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types), _t9.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t9.data; @@ -47237,7 +45327,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 442 /* v.ast.Chan */) { + else if (sym->info._typ == 444 /* v.ast.Chan */) { _option_v__ast__Type _t12; if (_t12 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__Chan).elem_type, generic_names, concrete_types), _t12.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t12.data; @@ -47253,7 +45343,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 445 /* v.ast.FnType */) { + else if (sym->info._typ == 447 /* v.ast.FnType */) { v__ast__Fn func = (*sym->info._v__ast__FnType).func; bool has_generic = false; if (v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic)) { @@ -47292,7 +45382,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t19; } } - else if (sym->info._typ == 444 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 446 /* v.ast.MultiReturn */) { Array_v__ast__Type types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool type_changed = false; for (int _t20 = 0; _t20 < (*sym->info._v__ast__MultiReturn).types.len; ++_t20) { @@ -47330,7 +45420,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 414 /* v.ast.Map */) { + else if (sym->info._typ == 416 /* v.ast.Map */) { bool type_changed = false; v__ast__Type unwrapped_key_type = (*sym->info._v__ast__Map).key_type; v__ast__Type unwrapped_value_type = (*sym->info._v__ast__Map).value_type; @@ -47359,7 +45449,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 418 /* v.ast.Struct */) { + else if (sym->info._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Struct).generic_types.len; ++i) { @@ -47383,7 +45473,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t33; } } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { @@ -47407,7 +45497,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t35; } } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { @@ -47445,12 +45535,12 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty string nrt = _SLIT(""); string c_nrt = _SLIT(""); v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); - if (ts->info._typ == 413 /* v.ast.Array */) { + if (ts->info._typ == 415 /* v.ast.Array */) { v__ast__Type elem_type = (*ts->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 413 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 415 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; @@ -47460,26 +45550,26 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t1 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t1; } - else if (ts->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 443 /* v.ast.ArrayFixed */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_array_fixed(t, unwrap_typ, (*ts->info._v__ast__ArrayFixed).size, v__ast__None_to_sumtype_v__ast__Expr(ADDR(v__ast__None, (((v__ast__None){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}))))); v__ast__Type _t2 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t2; } - else if (ts->info._typ == 442 /* v.ast.Chan */) { + else if (ts->info._typ == 444 /* v.ast.Chan */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_chan(t, unwrap_typ, v__ast__Type_nr_muls(unwrap_typ) > 0); v__ast__Type _t3 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t3; } - else if (ts->info._typ == 414 /* v.ast.Map */) { + else if (ts->info._typ == 416 /* v.ast.Map */) { v__ast__Type unwrap_key_type = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Map).key_type, generic_names, concrete_types); v__ast__Type unwrap_value_type = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Map).value_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_map(t, unwrap_key_type, unwrap_value_type); v__ast__Type _t4 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t4; } - else if (ts->info._typ == 418 /* v.ast.Struct */) { + else if (ts->info._typ == 420 /* v.ast.Struct */) { if (!(*ts->info._v__ast__Struct).is_generic) { v__ast__Type _t5 = typ; return _t5; @@ -47547,7 +45637,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 436 /* v.ast.Interface */) { + else if (ts->info._typ == 438 /* v.ast.Interface */) { if (!(*ts->info._v__ast__Interface).is_generic) { v__ast__Type _t14 = typ; return _t14; @@ -47615,7 +45705,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 437 /* v.ast.SumType */) { + else if (ts->info._typ == 439 /* v.ast.SumType */) { if (!(*ts->info._v__ast__SumType).is_generic) { v__ast__Type _t23 = typ; return _t23; @@ -47687,7 +45777,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty else { } ; - if (ts->info._typ == 418 /* v.ast.Struct */) { + if (ts->info._typ == 420 /* v.ast.Struct */) { v__ast__Struct info = (*ts->info._v__ast__Struct); info.is_generic = false; info.concrete_types = final_concrete_types; @@ -47701,7 +45791,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t33 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t33; } - else if (ts->info._typ == 437 /* v.ast.SumType */) { + else if (ts->info._typ == 439 /* v.ast.SumType */) { Array_v__ast__Type variants = array_clone_to_depth(&(*ts->info._v__ast__SumType).variants, 0); for (int i = 0; i < variants.len; ++i) { if (v__ast__Type_has_flag((*(v__ast__Type*)/*ee elem_sym */array_get(variants, i)), v__ast__TypeFlag__generic)) { @@ -47731,7 +45821,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t36 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t36; } - else if (ts->info._typ == 436 /* v.ast.Interface */) { + else if (ts->info._typ == 438 /* v.ast.Interface */) { Array_v__ast__Fn imethods = array_clone_to_depth(&(*ts->info._v__ast__Interface).methods, 0); for (int _t37 = 0; _t37 < imethods.len; ++_t37) { v__ast__Fn* method = ((v__ast__Fn*)imethods.data) + _t37; @@ -47784,29 +45874,29 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Array_v__ast__Type generic_types) { v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); - if (ts->info._typ == 413 /* v.ast.Array */) { + if (ts->info._typ == 415 /* v.ast.Array */) { v__ast__Type elem_type = (*ts->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 413 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 415 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; } v__ast__Table_replace_generic_type(t, elem_type, generic_types); } - else if (ts->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 443 /* v.ast.ArrayFixed */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_types); } - else if (ts->info._typ == 442 /* v.ast.Chan */) { + else if (ts->info._typ == 444 /* v.ast.Chan */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_types); } - else if (ts->info._typ == 414 /* v.ast.Map */) { + else if (ts->info._typ == 416 /* v.ast.Map */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Map).key_type, generic_types); v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Map).value_type, generic_types); } - else if (ts->info._typ == 418 /* v.ast.Struct */) { + else if (ts->info._typ == 420 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*ts->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -47829,7 +45919,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Struct).generic_types = generic_types; } - else if (ts->info._typ == 436 /* v.ast.Interface */) { + else if (ts->info._typ == 438 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*ts->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -47852,7 +45942,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Interface).generic_types = generic_types; } - else if (ts->info._typ == 437 /* v.ast.SumType */) { + else if (ts->info._typ == 439 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*ts->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -47885,13 +45975,13 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { for (int _t1 = 0; _t1 < t->type_symbols.len; ++_t1) { v__ast__TypeSymbol** typ = ((v__ast__TypeSymbol**)t->type_symbols.data) + _t1; if ((*typ)->kind == v__ast__Kind__generic_inst) { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 446) /*expected idx: 446, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 448) /*expected idx: 448, name: v.ast.GenericInst */ ; v__ast__TypeSymbol* parent = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, info.parent_idx)); if (parent->kind == v__ast__Kind__placeholder) { (*typ)->kind = v__ast__Kind__placeholder; continue; } - if (parent->info._typ == 418 /* v.ast.Struct */) { + if (parent->info._typ == 420 /* v.ast.Struct */) { v__ast__Struct parent_info = (*parent->info._v__ast__Struct); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic struct, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -47942,7 +46032,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 436 /* v.ast.Interface */) { + else if (parent->info._typ == 438 /* v.ast.Interface */) { v__ast__Interface parent_info = (*parent->info._v__ast__Interface); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -48008,7 +46098,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 437 /* v.ast.SumType */) { + else if (parent->info._typ == 439 /* v.ast.SumType */) { v__ast__SumType parent_info = (*parent->info._v__ast__SumType); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -48540,6 +46630,18 @@ v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ) { return _t2; } +bool v__ast__Table_type_is_for_pointer_arithmetic(v__ast__Table* t, v__ast__Type typ) { + v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(t, typ); + if (typ_sym->kind == v__ast__Kind__struct_) { + bool _t1 = false; + return _t1; + } else { + bool _t2 = v__ast__Type_is_any_kind_of_pointer(typ) || v__ast__Type_is_int_valptr(typ); + return _t2; + } + return 0; +} + string v__ast__TypeSymbol_str(v__ast__TypeSymbol* t) { string _t1 = t->name; return _t1; @@ -48554,13 +46656,13 @@ VNORETURN VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymb // Attr: [inline] inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 447 /* v.ast.Enum */) { + if ((t->info)._typ == 449 /* v.ast.Enum */) { v__ast__Enum _t1 = (*t->info._v__ast__Enum); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 447 /* v.ast.Enum */) { + if ((fsym->info)._typ == 449 /* v.ast.Enum */) { v__ast__Enum _t2 = (*fsym->info._v__ast__Enum); return _t2; } @@ -48572,13 +46674,13 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 444 /* v.ast.MultiReturn */) { + if ((t->info)._typ == 446 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t1 = (*t->info._v__ast__MultiReturn); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 444 /* v.ast.MultiReturn */) { + if ((fsym->info)._typ == 446 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t2 = (*fsym->info._v__ast__MultiReturn); return _t2; } @@ -48590,13 +46692,13 @@ inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 413 /* v.ast.Array */) { + if ((t->info)._typ == 415 /* v.ast.Array */) { v__ast__Array _t1 = (*t->info._v__ast__Array); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 413 /* v.ast.Array */) { + if ((fsym->info)._typ == 415 /* v.ast.Array */) { v__ast__Array _t2 = (*fsym->info._v__ast__Array); return _t2; } @@ -48608,13 +46710,13 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 441 /* v.ast.ArrayFixed */) { + if ((t->info)._typ == 443 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t1 = (*t->info._v__ast__ArrayFixed); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 441 /* v.ast.ArrayFixed */) { + if ((fsym->info)._typ == 443 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t2 = (*fsym->info._v__ast__ArrayFixed); return _t2; } @@ -48626,13 +46728,13 @@ inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol // Attr: [inline] inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 442 /* v.ast.Chan */) { + if ((t->info)._typ == 444 /* v.ast.Chan */) { v__ast__Chan _t1 = (*t->info._v__ast__Chan); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 442 /* v.ast.Chan */) { + if ((fsym->info)._typ == 444 /* v.ast.Chan */) { v__ast__Chan _t2 = (*fsym->info._v__ast__Chan); return _t2; } @@ -48644,13 +46746,13 @@ inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 443 /* v.ast.Thread */) { + if ((t->info)._typ == 445 /* v.ast.Thread */) { v__ast__Thread _t1 = (*t->info._v__ast__Thread); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 443 /* v.ast.Thread */) { + if ((fsym->info)._typ == 445 /* v.ast.Thread */) { v__ast__Thread _t2 = (*fsym->info._v__ast__Thread); return _t2; } @@ -48662,13 +46764,13 @@ inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 414 /* v.ast.Map */) { + if ((t->info)._typ == 416 /* v.ast.Map */) { v__ast__Map _t1 = (*t->info._v__ast__Map); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 414 /* v.ast.Map */) { + if ((fsym->info)._typ == 416 /* v.ast.Map */) { v__ast__Map _t2 = (*fsym->info._v__ast__Map); return _t2; } @@ -48680,13 +46782,13 @@ inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 418 /* v.ast.Struct */) { + if ((t->info)._typ == 420 /* v.ast.Struct */) { v__ast__Struct _t1 = (*t->info._v__ast__Struct); return _t1; } - if ((t->info)._typ == 433 /* v.ast.Alias */) { + if ((t->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 418 /* v.ast.Struct */) { + if ((fsym->info)._typ == 420 /* v.ast.Struct */) { v__ast__Struct _t2 = (*fsym->info._v__ast__Struct); return _t2; } @@ -48698,13 +46800,13 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 437 /* v.ast.SumType */) { + if ((t->info)._typ == 439 /* v.ast.SumType */) { v__ast__SumType _t1 = (*t->info._v__ast__SumType); return _t1; } - if ((t->info)._typ == 437 /* v.ast.SumType */) { + if ((t->info)._typ == 439 /* v.ast.SumType */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__SumType).parent_type); - if ((fsym->info)._typ == 437 /* v.ast.SumType */) { + if ((fsym->info)._typ == 439 /* v.ast.SumType */) { v__ast__SumType _t2 = (*fsym->info._v__ast__SumType); return _t2; } @@ -48716,7 +46818,7 @@ inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { if (t->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((t->info)._v__ast__Struct,(t->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((t->info)._v__ast__Struct,(t->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; bool _t1 = info.is_heap; return _t1; } else { @@ -48770,7 +46872,7 @@ inline bool v__ast__TypeSymbol_is_pointer(v__ast__TypeSymbol* t) { inline bool v__ast__TypeSymbol_is_int(v__ast__TypeSymbol* t) { bool res = (t->kind == v__ast__Kind__i8 || t->kind == v__ast__Kind__i16 || t->kind == v__ast__Kind__int || t->kind == v__ast__Kind__i64 || t->kind == v__ast__Kind__isize || t->kind == v__ast__Kind__u8 || t->kind == v__ast__Kind__u16 || t->kind == v__ast__Kind__u32 || t->kind == v__ast__Kind__u64 || t->kind == v__ast__Kind__usize || t->kind == v__ast__Kind__int_literal || t->kind == v__ast__Kind__rune); if (!res && t->kind == v__ast__Kind__alias) { - bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); return _t1; } bool _t2 = res; @@ -48880,9 +46982,9 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__alias: { - multi_return_int_int mr_21154 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); - size = mr_21154.arg0; - align = mr_21154.arg1; + multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); + size = mr_21365.arg0; + align = mr_21365.arg1; break; } case v__ast__Kind__struct_: @@ -48892,7 +46994,7 @@ multi_return_int_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 _t4; /* if prepend */ - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { Array_v__ast__Type _t5 = {0}; Array_v__ast__StructField _t5_orig = (*sym->info._v__ast__Struct).fields; int _t5_len = _t5_orig.len; @@ -48905,14 +47007,14 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } _t4 =_t5; } else { - _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ).types; } 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_21465 = v__ast__Table_type_size(t, ftyp); - int field_size = mr_21465.arg0; - int alignment = mr_21465.arg1; + multi_return_int_int mr_21676 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21676.arg0; + int alignment = mr_21676.arg1; if (alignment > max_alignment) { max_alignment = alignment; } @@ -48926,21 +47028,21 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) case v__ast__Kind__interface_: case v__ast__Kind__aggregate: { - if (sym->info._typ == 437 /* v.ast.SumType */) { + if (sym->info._typ == 439 /* v.ast.SumType */) { size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 431 /* v.ast.Aggregate */) { + else if (sym->info._typ == 433 /* v.ast.Aggregate */) { size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; - multi_return_int_int mr_22026 = v__ast__Table_type_size(t, etyp); - int esize = mr_22026.arg0; + multi_return_int_int mr_22237 = v__ast__Table_type_size(t, etyp); + int esize = mr_22237.arg0; size += esize - 2 * t->pointer_size; } } @@ -48952,10 +47054,10 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; - multi_return_int_int mr_22223 = v__ast__Table_type_size(t, info.elem_type); - int elem_size = mr_22223.arg0; - int elem_align = mr_22223.arg1; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + multi_return_int_int mr_22434 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22434.arg0; + int elem_align = mr_22434.arg1; size = info.size * elem_size; align = elem_align; break; @@ -49202,7 +47304,8 @@ string Array_v__ast__Kind_str(Array_v__ast__Kind kinds) { } string v__ast__Table_type_to_str(v__ast__Table* t, v__ast__Type typ) { - string _t1 = v__ast__Table_type_to_str_using_aliases(t, typ, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string _t1 = v__ast__Table_type_to_str_using_aliases(t, typ, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); return _t1; } @@ -49213,7 +47316,8 @@ string v__ast__Table_type_to_code(v__ast__Table* mytable, v__ast__Type t) { return _t1; } else { - string _t2 = v__ast__Table_type_to_str_using_aliases(mytable, t, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string _t2 = v__ast__Table_type_to_str_using_aliases(mytable, t, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); return _t2; }; return (string){.str=(byteptr)"", .is_lit=1}; @@ -49267,7 +47371,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { res = v__ast__Table_type_to_str_using_aliases(t, v__ast__Table_value_type(t, typ), import_aliases); } else { - if ((sym->info)._typ == 413 /* v.ast.Array */) { + if ((sym->info)._typ == 415 /* v.ast.Array */) { string elem_str = v__ast__Table_type_to_str_using_aliases(t, (*sym->info._v__ast__Array).elem_type, import_aliases); res = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { @@ -49278,9 +47382,9 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; string elem_str = v__ast__Table_type_to_str_using_aliases(t, info.elem_type, import_aliases); - if ((info.size_expr)._typ == 264 /* v.ast.EmptyExpr */) { + if ((info.size_expr)._typ == 266 /* v.ast.EmptyExpr */) { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(info.size_expr)}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -49290,7 +47394,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__chan: { if (!string__eq(sym->mod, _SLIT("builtin")) && !string__eq(sym->name, _SLIT("chan"))) { - v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 442) /*expected idx: 442, name: v.ast.Chan */ ; + v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ; v__ast__Type elem_type = info.elem_type; string mut_str = _SLIT(""); if (info.is_mut) { @@ -49304,7 +47408,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__function: { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; if (!t->is_fmt) { res = v__ast__Table_fn_signature(t, (voidptr)&/*qq*/info.func, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = true,})); } else { @@ -49333,7 +47437,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty string _t4 = _SLIT("map"); return _t4; } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; string key_str = v__ast__Table_type_to_str_using_aliases(t, info.key_type, import_aliases); string val_str = v__ast__Table_type_to_str_using_aliases(t, info.value_type, import_aliases); res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("map["), /*115 &string*/0xfe10, {.d_s = key_str}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = val_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -49342,7 +47446,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__multi_return: { res = _SLIT("("); - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; for (int i = 0; i < info.types.len; ++i) { v__ast__Type typ2 = ((v__ast__Type*)info.types.data)[i]; if (i > 0) { @@ -49358,7 +47462,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__sum_type: { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Struct).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Struct).generic_types.data)[i]; @@ -49369,7 +47473,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).generic_types.data)[i]; @@ -49380,7 +47484,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__SumType).generic_types.data)[i]; @@ -49395,7 +47499,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty else { } ; - } else if ((sym->info)._typ == 437 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ).is_anon) { + } else if ((sym->info)._typ == 439 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).is_anon) { Array_string _t5 = {0}; Array_v__ast__Type _t5_orig = (*sym->info._v__ast__SumType).variants; int _t5_len = _t5_orig.len; @@ -49415,7 +47519,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__generic_inst: { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 448) /*expected idx: 448, name: v.ast.GenericInst */ ; res = v__ast__Table_shorten_user_defined_typenames(t, string_all_before(sym->name, _SLIT("<")), import_aliases); res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < info.concrete_types.len; ++i) { @@ -49524,7 +47628,8 @@ VV_LOCAL_SYMBOL string v__ast__Table_shorten_user_defined_typenames(v__ast__Tabl } string v__ast__Table_fn_signature(v__ast__Table* t, v__ast__Fn* func, v__ast__FnSignatureOpts opts) { - string _t1 = v__ast__Table_fn_signature_using_aliases(t, func, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), opts); + string _t1 = v__ast__Table_fn_signature_using_aliases(t, func, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + , opts); return _t1; } @@ -49637,13 +47742,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty return _t2; } v__ast__Table* table = global_table; - if (t->info._typ == 418 /* v.ast.Struct */) { + if (t->info._typ == 420 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*t->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Struct).parent_type); _option_v__ast__Fn _t3; if (_t3 = v__ast__TypeSymbol_find_method(parent_sym, name), _t3.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t3.data; - if (parent_sym->info._typ == 418 /* v.ast.Struct */) { + if (parent_sym->info._typ == 420 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -49679,7 +47784,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t9), sizeof(v__ast__Fn)); return _t9; } - else if (parent_sym->info._typ == 436 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t10 = {0}; Array_v__ast__Type _t10_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -49715,7 +47820,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t15), sizeof(v__ast__Fn)); return _t15; } - else if (parent_sym->info._typ == 437 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t16 = {0}; Array_v__ast__Type _t16_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -49758,13 +47863,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 436 /* v.ast.Interface */) { + else if (t->info._typ == 438 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*t->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Interface).parent_type); _option_v__ast__Fn _t22; if (_t22 = v__ast__TypeSymbol_find_method(parent_sym, name), _t22.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t22.data; - if (parent_sym->info._typ == 418 /* v.ast.Struct */) { + if (parent_sym->info._typ == 420 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t23 = {0}; Array_v__ast__Type _t23_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -49800,7 +47905,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t28), sizeof(v__ast__Fn)); return _t28; } - else if (parent_sym->info._typ == 436 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t29 = {0}; Array_v__ast__Type _t29_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -49836,7 +47941,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t34), sizeof(v__ast__Fn)); return _t34; } - else if (parent_sym->info._typ == 437 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t35 = {0}; Array_v__ast__Type _t35_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -49879,13 +47984,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 437 /* v.ast.SumType */) { + else if (t->info._typ == 439 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*t->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__SumType).parent_type); _option_v__ast__Fn _t41; if (_t41 = v__ast__TypeSymbol_find_method(parent_sym, name), _t41.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t41.data; - if (parent_sym->info._typ == 418 /* v.ast.Struct */) { + if (parent_sym->info._typ == 420 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t42 = {0}; Array_v__ast__Type _t42_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -49921,7 +48026,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t47), sizeof(v__ast__Fn)); return _t47; } - else if (parent_sym->info._typ == 436 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t48 = {0}; Array_v__ast__Type _t48_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -49957,7 +48062,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t53), sizeof(v__ast__Fn)); return _t53; } - else if (parent_sym->info._typ == 437 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t54 = {0}; Array_v__ast__Type _t54_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -50021,7 +48126,7 @@ bool v__ast__TypeSymbol_is_js_compatible(v__ast__TypeSymbol* t) { bool _t3 = true; return _t3; } - if (t->info._typ == 437 /* v.ast.SumType */) { + if (t->info._typ == 439 /* v.ast.SumType */) { for (int _t4 = 0; _t4 < (*t->info._v__ast__SumType).variants.len; ++_t4) { v__ast__Type variant = ((v__ast__Type*)(*t->info._v__ast__SumType).variants.data)[_t4]; v__ast__TypeSymbol* sym = v__ast__Table_final_sym(table, variant); @@ -50059,19 +48164,19 @@ multi_return_bool_bool_int v__ast__TypeSymbol_str_method_info(v__ast__TypeSymbol } _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, string name) { - if (t->info._typ == 431 /* v.ast.Aggregate */) { + if (t->info._typ == 433 /* v.ast.Aggregate */) { _option_v__ast__StructField _t1 = v__ast__Aggregate_find_field(&(*t->info._v__ast__Aggregate), name); return _t1; } - else if (t->info._typ == 418 /* v.ast.Struct */) { + else if (t->info._typ == 420 /* v.ast.Struct */) { _option_v__ast__StructField _t2 = v__ast__Struct_find_field(&(*t->info._v__ast__Struct), name); return _t2; } - else if (t->info._typ == 436 /* v.ast.Interface */) { + else if (t->info._typ == 438 /* v.ast.Interface */) { _option_v__ast__StructField _t3 = v__ast__Interface_find_field(&(*t->info._v__ast__Interface), name); return _t3; } - else if (t->info._typ == 437 /* v.ast.SumType */) { + else if (t->info._typ == 439 /* v.ast.SumType */) { _option_v__ast__StructField _t4 = v__ast__SumType_find_field(&(*t->info._v__ast__SumType), name); return _t4; } @@ -50197,8 +48302,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__ast__Type right_type0 = _const_v__ast__void_type; for (int i = 0; i < node->right.len; ++i) { v__ast__Expr* right = ((v__ast__Expr*)node->right.data) + i; - if ((right)->_typ == 254 /* v.ast.CallExpr */ || (right)->_typ == 269 /* v.ast.IfExpr */ || (right)->_typ == 276 /* v.ast.LockExpr */ || (right)->_typ == 278 /* v.ast.MatchExpr */) { - if (((right)->_typ == 269 /* v.ast.IfExpr */ || (right)->_typ == 278 /* v.ast.MatchExpr */) && node->left.len == node->right.len && !is_decl && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 268 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 288 /* v.ast.SelectorExpr */) && !v__ast__Expr_is_blank_ident((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))) { + if ((right)->_typ == 256 /* v.ast.CallExpr */ || (right)->_typ == 271 /* v.ast.IfExpr */ || (right)->_typ == 278 /* v.ast.LockExpr */ || (right)->_typ == 280 /* v.ast.MatchExpr */) { + if (((right)->_typ == 271 /* v.ast.IfExpr */ || (right)->_typ == 280 /* v.ast.MatchExpr */) && node->left.len == node->right.len && !is_decl && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 270 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 290 /* v.ast.SelectorExpr */) && !v__ast__Expr_is_blank_ident((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))) { c->expected_type = v__checker__Checker_expr(c, (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i))); } v__ast__Type right_type = v__checker__Checker_expr(c, *right); @@ -50218,22 +48323,22 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; right_len = 0; } } - if ((right)->_typ == 272 /* v.ast.InfixExpr */) { + if ((right)->_typ == 274 /* v.ast.InfixExpr */) { if ((*right->_v__ast__InfixExpr).op == v__token__Kind__arrow) { v__checker__Checker_error(c, _SLIT("cannot use `<-` on the right-hand side of an assignment, as it does not return any values"), (*right->_v__ast__InfixExpr).pos); } } - if ((right)->_typ == 268 /* v.ast.Ident */) { + if ((right)->_typ == 270 /* v.ast.Ident */) { if ((*right->_v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("unexpected `mut` on right-hand side of assignment"), (*right->_v__ast__Ident).mut_pos); } } - if ((right)->_typ == 280 /* v.ast.None */) { + if ((right)->_typ == 282 /* v.ast.None */) { v__checker__Checker_error(c, _SLIT("you can not assign a `none` value to a variable"), (*right->_v__ast__None).pos); } } if (node->left.len != right_len) { - if ((right_first)._typ == 254 /* v.ast.CallExpr */) { + if ((right_first)._typ == 256 /* v.ast.CallExpr */) { if (node->left_types.len > 0 && v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, 0)), _const_v__ast__void_type)) { // Defer begin if (v__checker__Checker_assign_stmt_defer_0) { @@ -50255,21 +48360,21 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } for (int i = 0; i < node->left.len; ++i) { v__ast__Expr* left = ((v__ast__Expr*)node->left.data) + i; - if ((left)->_typ == 254 /* v.ast.CallExpr */) { + if ((left)->_typ == 256 /* v.ast.CallExpr */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot call function `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__CallExpr).name}}, {_SLIT("()` on the left side of an assignment"), 0, { .d_c = 0 }}})), (*left->_v__ast__CallExpr).pos); - } else if ((left)->_typ == 285 /* v.ast.PrefixExpr */) { - if (((*left->_v__ast__PrefixExpr).right)._typ == 254 /* v.ast.CallExpr */ && (*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { + } else if ((left)->_typ == 287 /* v.ast.PrefixExpr */) { + if (((*left->_v__ast__PrefixExpr).right)._typ == 256 /* v.ast.CallExpr */ && (*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { v__checker__Checker_error(c, _SLIT("cannot dereference a function call on the left side of an assignment, use a temporary variable"), (*left->_v__ast__PrefixExpr).pos); } - } else if ((left)->_typ == 271 /* v.ast.IndexExpr */) { - if (((*left->_v__ast__IndexExpr).index)._typ == 286 /* v.ast.RangeExpr */) { + } else if ((left)->_typ == 273 /* v.ast.IndexExpr */) { + if (((*left->_v__ast__IndexExpr).index)._typ == 288 /* v.ast.RangeExpr */) { v__checker__Checker_error(c, _SLIT("cannot reassign using range expression on the left side of an assignment"), (*left->_v__ast__IndexExpr).pos); } } bool is_blank_ident = v__ast__Expr_is_blank_ident(/*rec*/*left); v__ast__Type left_type = _const_v__ast__void_type; if (!is_decl && !is_blank_ident) { - if ((left)->_typ == 268 /* v.ast.Ident */ || (left)->_typ == 288 /* v.ast.SelectorExpr */) { + if ((left)->_typ == 270 /* v.ast.Ident */ || (left)->_typ == 290 /* v.ast.SelectorExpr */) { c->prevent_sum_type_unwrapping_once = true; } left_type = v__checker__Checker_expr(c, *left); @@ -50277,8 +48382,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } if (node->right_types.len < node->left.len) { bool old_inside_ref_lit = c->inside_ref_lit; - if ((left)->_typ == 268 /* v.ast.Ident */) { - if (((*left->_v__ast__Ident).info)._typ == 378 /* v.ast.IdentVar */) { + if ((left)->_typ == 270 /* v.ast.Ident */) { + if (((*left->_v__ast__Ident).info)._typ == 380 /* v.ast.IdentVar */) { c->inside_ref_lit = c->inside_ref_lit || (*(*left->_v__ast__Ident).info._v__ast__IdentVar).share == v__ast__ShareType__shared_t; } } @@ -50292,9 +48397,9 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } v__ast__Expr right = (i < node->right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, i))) : ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, 0)))); v__ast__Type right_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->right_types, i)); - if ((right)._typ == 268 /* v.ast.Ident */) { + if ((right)._typ == 270 /* v.ast.Ident */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); - if ((right_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((right_sym->info)._typ == 420 /* v.ast.Struct */) { if ((*right_sym->info._v__ast__Struct).generic_types.len > 0) { _option_v__ast__ScopeObject _t2; if (_t2 = v__ast__Scope_find((*right._v__ast__Ident).scope, (*right._v__ast__Ident).name), _t2.state == 0) { @@ -50303,17 +48408,17 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - } else if ((right)._typ == 260 /* v.ast.ComptimeSelector */) { + } else if ((right)._typ == 262 /* v.ast.ComptimeSelector */) { right_type = c->comptime_fields_default_type; } if (is_decl) { - if ((right)._typ == 293 /* v.ast.StructInit */) { + if ((right)._typ == 295 /* v.ast.StructInit */) { if (v__ast__Type_has_flag((*right._v__ast__StructInit).typ, v__ast__TypeFlag__generic)) { v__checker__Checker_expr(c, right); right_type = (*right._v__ast__StructInit).typ; } - } else if ((right)._typ == 285 /* v.ast.PrefixExpr */) { - if ((*right._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*right._v__ast__PrefixExpr).right)._typ == 293 /* v.ast.StructInit */) { + } else if ((right)._typ == 287 /* v.ast.PrefixExpr */) { + if ((*right._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*right._v__ast__PrefixExpr).right)._typ == 295 /* v.ast.StructInit */) { right_type = v__checker__Checker_expr(c, right); } } @@ -50323,7 +48428,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; left_type = v__ast__mktyp(right_type); } if (v__ast__Type_alias_eq(left_type, _const_v__ast__int_type)) { - if ((right)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((right)._typ == 275 /* v.ast.IntegerLiteral */) { bool is_large = (*right._v__ast__IntegerLiteral).val.len > 13; if (!is_large && (*right._v__ast__IntegerLiteral).val.len > 8) { i64 val = string_i64((*right._v__ast__IntegerLiteral).val); @@ -50338,8 +48443,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_fail_if_immutable(c, *left); } if (v__ast__Type_is_ptr(right_type) && v__ast__Type_is_ptr(left_type)) { - if ((right)._typ == 268 /* v.ast.Ident */) { - if (((*right._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((right)._typ == 270 /* v.ast.Ident */) { + if (((*right._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Var* obj = &(*(*right._v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t3 = v__ast__Scope_find_var(c->fn_scope, (*(*right._v__ast__Ident).obj._v__ast__Var).name); @@ -50360,21 +48465,21 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - if (!is_decl && (left)->_typ == 268 /* v.ast.Ident */ && !is_blank_ident && !v__ast__Type_is_real_pointer(left_type) && v__ast__Type_is_real_pointer(right_type) && !v__ast__Type_has_flag(right_type, v__ast__TypeFlag__shared_f)) { + if (!is_decl && (left)->_typ == 270 /* v.ast.Ident */ && !is_blank_ident && !v__ast__Type_is_real_pointer(left_type) && v__ast__Type_is_real_pointer(right_type) && !v__ast__Type_has_flag(right_type, v__ast__TypeFlag__shared_f)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); if (left_sym->kind != v__ast__Kind__function) { v__checker__Checker_warn(c, string__plus( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot assign a reference to a value (this will be an error soon) left="), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_str(c->table, left_type)}}, {_SLIT(" "), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_ptr(left_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" "), 0, { .d_c = 0 }}})), str_intp(4, _MOV((StrIntpData[]){{_SLIT("right="), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_str(c->table, right_type)}}, {_SLIT(" "), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_real_pointer(right_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" ptr="), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_ptr(right_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))), node->pos); } } array_push((array*)&node->left_types, _MOV((v__ast__Type[]){ left_type })); - if (left->_typ == 268 /* v.ast.Ident */) { + if (left->_typ == 270 /* v.ast.Ident */) { if ((*left->_v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { left_type = right_type; array_set(&node->left_types, i, &(v__ast__Type[]) { right_type }); if (!(node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign)) { v__checker__Checker_error(c, _SLIT("cannot modify blank `_` identifier"), (*left->_v__ast__Ident).pos); } - } else if (((*left->_v__ast__Ident).info)._typ != 378 /* v.ast.IdentVar */) { + } else if (((*left->_v__ast__Ident).info)._typ != 380 /* v.ast.IdentVar */) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot assign to "), /*115 &v.ast.IdentKind*/0xfe10, {.d_s = v__ast__IdentKind_str((*left->_v__ast__Ident).kind)}}, {_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } else { if (is_decl) { @@ -50383,7 +48488,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid use of reserved type `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__Ident).name}}, {_SLIT("` as a variable name"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } } - v__ast__IdentVar ident_var_info = /* as */ *(v__ast__IdentVar*)__as_cast(((*left->_v__ast__Ident).info)._v__ast__IdentVar,((*left->_v__ast__Ident).info)._typ, 378) /*expected idx: 378, name: v.ast.IdentVar */ ; + v__ast__IdentVar ident_var_info = /* as */ *(v__ast__IdentVar*)__as_cast(((*left->_v__ast__Ident).info)._v__ast__IdentVar,((*left->_v__ast__Ident).info)._typ, 380) /*expected idx: 380, name: v.ast.IdentVar */ ; if (ident_var_info.share == v__ast__ShareType__shared_t) { left_type = v__ast__Type_set_flag(left_type, v__ast__TypeFlag__shared_f); if (is_decl) { @@ -50393,7 +48498,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; left_type = v__ast__Type_set_nr_muls(left_type, 1); } } else if (v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f)) { - left_type = v__ast__Type_clear_flag(left_type, v__ast__TypeFlag__shared_f); + left_type = v__ast__Type_deref(v__ast__Type_clear_flag(left_type, v__ast__TypeFlag__shared_f)); } if (ident_var_info.share == v__ast__ShareType__atomic_t) { left_type = v__ast__Type_set_flag(left_type, v__ast__TypeFlag__atomic_f); @@ -50402,7 +48507,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; ident_var_info.typ = left_type; (*left->_v__ast__Ident).info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(&ident_var_info); if (left_type != 0) { - if ((*left->_v__ast__Ident).obj._typ == 326 /* v.ast.Var */) { + if ((*left->_v__ast__Ident).obj._typ == 328 /* v.ast.Var */) { (*(*left->_v__ast__Ident).obj._v__ast__Var).typ = left_type; if ((*(*left->_v__ast__Ident).obj._v__ast__Var).is_auto_deref) { (*(*left->_v__ast__Ident).obj._v__ast__Var).is_used = true; @@ -50413,14 +48518,14 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } if (Array_int_contains(_const_v__ast__unsigned_integer_type_idxs, left_type)) { - if ((right)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((right)._typ == 275 /* v.ast.IntegerLiteral */) { if (string_at((*right._v__ast__IntegerLiteral).val, 0) == '-') { v__checker__Checker_error(c, _SLIT("Cannot assign negative value to unsigned integer type"), (*right._v__ast__IntegerLiteral).pos); } } } } - else if ((*left->_v__ast__Ident).obj._typ == 325 /* v.ast.GlobalField */) { + else if ((*left->_v__ast__Ident).obj._typ == 327 /* v.ast.GlobalField */) { (*(*left->_v__ast__Ident).obj._v__ast__GlobalField).typ = left_type; } @@ -50433,19 +48538,19 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; _option_v__ast__ScopeObject _t5; if (_t5 = v__ast__Scope_find(c->file->global_scope, full_name), _t5.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t5.data; - if ((obj)._typ == 324 /* v.ast.ConstField */) { + if ((obj)._typ == 326 /* v.ast.ConstField */) { v__checker__Checker_warn(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate of a const name `"), /*115 &string*/0xfe10, {.d_s = full_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } } } } } - else if (left->_typ == 285 /* v.ast.PrefixExpr */) { + else if (left->_typ == 287 /* v.ast.PrefixExpr */) { if ((*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { if (!c->inside_unsafe && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("modifying variables via dereferencing can only be done in `unsafe` blocks"), node->pos); - } else if (((*left->_v__ast__PrefixExpr).right)._typ == 268 /* v.ast.Ident */) { - if (((*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + } else if (((*left->_v__ast__PrefixExpr).right)._typ == 270 /* v.ast.Ident */) { + if (((*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { (*(*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj._v__ast__Var).is_used = true; } } @@ -50454,8 +48559,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_error(c, _SLIT("non-name on the left side of `:=`"), (*left->_v__ast__PrefixExpr).pos); } } - else if (left->_typ == 288 /* v.ast.SelectorExpr */) { - if (((*left->_v__ast__SelectorExpr).expr)._typ == 271 /* v.ast.IndexExpr */) { + else if (left->_typ == 290 /* v.ast.SelectorExpr */) { + if (((*left->_v__ast__SelectorExpr).expr)._typ == 273 /* v.ast.IndexExpr */) { if ((*(*left->_v__ast__SelectorExpr).expr._v__ast__IndexExpr).is_map) { (*(*left->_v__ast__SelectorExpr).expr._v__ast__IndexExpr).is_setter = true; } @@ -50463,7 +48568,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } else { - if ((left)->_typ == 271 /* v.ast.IndexExpr */) { + if ((left)->_typ == 273 /* v.ast.IndexExpr */) { if ((*left->_v__ast__IndexExpr).is_map && (*left->_v__ast__IndexExpr).is_setter) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*left->_v__ast__IndexExpr), true); } @@ -50486,26 +48591,26 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type_unwrapped); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type_unwrapped); - if (left_sym->kind == v__ast__Kind__array && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array && (left)->_typ == 268 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 268 /* v.ast.Ident */) { + if (left_sym->kind == v__ast__Kind__array && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array && (left)->_typ == 270 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 270 /* v.ast.Ident */) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("use `array2 "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" array1.clone()` instead of `array2 "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" array1` (or use `unsafe`)"), 0, { .d_c = 0 }}})), node->pos); } if (left_sym->kind == v__ast__Kind__array && right_sym->kind == v__ast__Kind__array) { - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type left_elem_type = v__ast__Table_unaliased_type(c->table, left_info.elem_type); - v__ast__Array right_info = /* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array right_info = /* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type right_elem_type = v__ast__Table_unaliased_type(c->table, right_info.elem_type); if (v__ast__Type_nr_muls(left_type_unwrapped) == v__ast__Type_nr_muls(right_type_unwrapped) && left_info.nr_dims == right_info.nr_dims && v__ast__Type_alias_eq(left_elem_type, right_elem_type)) { continue; } } - if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 268 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 268 /* v.ast.Ident */) { - if ((right_sym->info)._typ == 441 /* v.ast.ArrayFixed */) { + if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 270 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 270 /* v.ast.Ident */) { + if ((right_sym->info)._typ == 443 /* v.ast.ArrayFixed */) { if (v__ast__Type_is_ptr((*right_sym->info._v__ast__ArrayFixed).elem_type)) { v__checker__Checker_error(c, _SLIT("assignment from one fixed array to another with a pointer element type is prohibited outside of `unsafe`"), node->pos); } } } - if (left_sym->kind == v__ast__Kind__map && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__map && !v__ast__Expr_is_blank_ident(/*rec*/*left) && v__ast__Expr_is_lvalue(right) && (!v__ast__Type_is_ptr(right_type) || ((right)._typ == 268 /* v.ast.Ident */ && v__ast__Expr_is_auto_deref_var(right)))) { + if (left_sym->kind == v__ast__Kind__map && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__map && !v__ast__Expr_is_blank_ident(/*rec*/*left) && v__ast__Expr_is_lvalue(right) && (!v__ast__Type_is_ptr(right_type) || ((right)._typ == 270 /* v.ast.Ident */ && v__ast__Expr_is_auto_deref_var(right)))) { v__checker__Checker_error(c, _SLIT("cannot copy map: call `move` or `clone` method (or use a reference)"), v__ast__Expr_pos(right)); } bool left_is_ptr = v__ast__Type_is_ptr(left_type) || v__ast__TypeSymbol_is_pointer(left_sym); @@ -50517,7 +48622,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; if (!right_is_ptr && node->op == v__token__Kind__assign && v__ast__Type_is_number(right_type_unwrapped)) { v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot assign to `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(*left)}}, {_SLIT("`: "), 0, { .d_c = 0 }}})), v__checker__Checker_expected_msg(c, right_type_unwrapped, left_type_unwrapped)), v__ast__Expr_pos(right)); } - if (!v__ast__TypeSymbol_is_number(right_sym) && !v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f) && ((right)._typ == 293 /* v.ast.StructInit */ || !right_is_ptr)) { + if (!v__ast__TypeSymbol_is_number(right_sym) && !v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f) && ((right)._typ == 295 /* v.ast.StructInit */ || !right_is_ptr)) { string left_name = v__ast__Table_type_to_str(c->table, left_type_unwrapped); v__ast__Type rtype = right_type_unwrapped; if (v__ast__Type_is_ptr(rtype)) { @@ -50632,7 +48737,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; else { _t7 = _SLIT("unknown op"); }string extracted_op = _t7; - if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).generic_types.len > 0) { + if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { continue; } _option_v__ast__Fn _t8; @@ -50677,13 +48782,13 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - if ((right_first)._typ == 285 /* v.ast.PrefixExpr */) { + if ((right_first)._typ == 287 /* v.ast.PrefixExpr */) { v__ast__PrefixExpr right_node = (*right_first._v__ast__PrefixExpr); v__ast__Expr left_first = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)); - if ((left_first)._typ == 268 /* v.ast.Ident */) { + if ((left_first)._typ == 270 /* v.ast.Ident */) { v__ast__Ident assigned_var = (*left_first._v__ast__Ident); bool is_shared = false; - if (((*left_first._v__ast__Ident).info)._typ == 378 /* v.ast.IdentVar */) { + if (((*left_first._v__ast__Ident).info)._typ == 380 /* v.ast.IdentVar */) { is_shared = (*(*left_first._v__ast__Ident).info._v__ast__IdentVar).share == v__ast__ShareType__shared_t; } bool old_inside_ref_lit = c->inside_ref_lit; @@ -50691,8 +48796,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_expr(c, right_node.right); c->inside_ref_lit = old_inside_ref_lit; if (right_node.op == v__token__Kind__amp) { - if ((right_node.right)._typ == 268 /* v.ast.Ident */) { - if (((*right_node.right._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((right_node.right)._typ == 270 /* v.ast.Ident */) { + if (((*right_node.right._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Var v = (*(*right_node.right._v__ast__Ident).obj._v__ast__Var); right_type0 = v.typ; } @@ -50763,16 +48868,16 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v 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__array && expected_sym->kind == v__ast__Kind__array) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type)) { bool _t8 = true; return _t8; } } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t10 = true; return _t10; } @@ -50792,8 +48897,8 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v bool _t13 = true; return _t13; } else if (got_sym->kind == v__ast__Kind__array) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; - v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { bool _t14 = true; return _t14; @@ -50897,7 +49002,7 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type expected = expected_; if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* exp_type_sym = v__ast__Table_sym(c->table, expected_); - v__ast__Array exp_info = /* as */ *(v__ast__Array*)__as_cast((exp_type_sym->info)._v__ast__Array,(exp_type_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array exp_info = /* as */ *(v__ast__Array*)__as_cast((exp_type_sym->info)._v__ast__Array,(exp_type_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; expected = exp_info.elem_type; } if (language == v__ast__Language__c) { @@ -51066,8 +49171,8 @@ bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v } bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym) { - v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; - v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; v__ast__Fn got_fn = got_info.func; v__ast__Fn exp_fn = exp_info.func; if (got_fn.params.len != exp_fn.params.len) { @@ -51108,7 +49213,7 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker* c, v__ast__InfixExpr* node, v__ast__Type left_type, v__ast__Type right_type) { if (!v__ast__Type_is_int(left_type)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); - if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type)) { + if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)) { v__ast__Type _t1 = left_type; return _t1; } @@ -51151,7 +49256,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker v__checker__Checker_note(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("shifting a value from a signed type `"), /*115 &string*/0xfe10, {.d_s = left_sym_final->name}}, {_SLIT("` can change the sign"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->left)); } if (node->ct_right_value_evaled) { - if ((node->ct_right_value)._typ != 264 /* v.ast.EmptyExpr */) { + if ((node->ct_right_value)._typ != 266 /* v.ast.EmptyExpr */) { _option_i64 _t7 = v__ast__ComptTimeConstValue_i64(node->ct_right_value); if (_t7.state != 0) { /*or block*/ IError err = _t7.err; @@ -51330,7 +49435,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ v__ast__Type to_set = _const_v__ast__void_type; if (node->is_method && v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->receiver_type); - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -51354,7 +49459,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -51378,7 +49483,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -51417,7 +49522,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && string__eq(param_type_sym->name, gt_name)) { to_set = v__ast__mktyp(arg.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, arg.typ); - if ((sym->info)._typ == 445 /* v.ast.FnType */) { + if ((sym->info)._typ == 447 /* v.ast.FnType */) { v__ast__Fn func_ = (*sym->info._v__ast__FnType).func; func_.name = _SLIT(""); int idx = v__ast__Table_find_or_register_fn_type(c->table, c->mod, func_, true, false); @@ -51437,15 +49542,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__variadic)) { to_set = v__ast__mktyp(arg.typ); } else if (arg_sym->kind == v__ast__Kind__array && param_type_sym->kind == v__ast__Kind__array) { - v__ast__Array arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_sym->info)._v__ast__Array,(arg_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; - v__ast__Array param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_type_sym->info)._v__ast__Array,(param_type_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_sym->info)._v__ast__Array,(arg_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; + v__ast__Array param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_type_sym->info)._v__ast__Array,(param_type_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -51455,15 +49560,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__array_fixed && param_type_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; - v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -51473,8 +49578,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__map && param_type_sym->kind == v__ast__Kind__map) { - v__ast__Map arg_map_info = /* as */ *(v__ast__Map*)__as_cast((arg_sym->info)._v__ast__Map,(arg_sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; - v__ast__Map param_map_info = /* as */ *(v__ast__Map*)__as_cast((param_type_sym->info)._v__ast__Map,(param_type_sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map arg_map_info = /* as */ *(v__ast__Map*)__as_cast((arg_sym->info)._v__ast__Map,(arg_sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; + v__ast__Map param_map_info = /* as */ *(v__ast__Map*)__as_cast((param_type_sym->info)._v__ast__Map,(param_type_sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; if (v__ast__Type_has_flag(param_map_info.key_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_map_info.key_type)->name, gt_name)) { typ = arg_map_info.key_type; } @@ -51482,8 +49587,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ typ = arg_map_info.value_type; } } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { - v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 445) /*expected idx: 445, 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, 445) /*expected idx: 445, name: v.ast.FnType */ ).func; + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; 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]; @@ -51498,15 +49603,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } 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); - if (arg_sym->info._typ == 418 /* v.ast.Struct */) { + if (arg_sym->info._typ == 420 /* v.ast.Struct */) { generic_types = (*arg_sym->info._v__ast__Struct).generic_types; concrete_types = (*arg_sym->info._v__ast__Struct).concrete_types; } - else if (arg_sym->info._typ == 436 /* v.ast.Interface */) { + else if (arg_sym->info._typ == 438 /* v.ast.Interface */) { generic_types = (*arg_sym->info._v__ast__Interface).generic_types; concrete_types = (*arg_sym->info._v__ast__Interface).concrete_types; } - else if (arg_sym->info._typ == 437 /* v.ast.SumType */) { + else if (arg_sym->info._typ == 439 /* v.ast.SumType */) { generic_types = (*arg_sym->info._v__ast__SumType).generic_types; concrete_types = (*arg_sym->info._v__ast__SumType).concrete_types; } @@ -51638,7 +49743,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t2 = 0; _t2 < ast_file->stmts.len; ++_t2) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t2; - if ((stmt)->_typ == 304 /* v.ast.ConstDecl */ || (stmt)->_typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 306 /* v.ast.ConstDecl */ || (stmt)->_typ == 310 /* v.ast.ExprStmt */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -51649,7 +49754,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t3 = 0; _t3 < ast_file->stmts.len; ++_t3) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t3; - if ((stmt)->_typ == 312 /* v.ast.GlobalDecl */) { + if ((stmt)->_typ == 314 /* v.ast.GlobalDecl */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -51660,7 +49765,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t4 = 0; _t4 < ast_file->stmts.len; ++_t4) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t4; - if ((stmt)->_typ != 304 /* v.ast.ConstDecl */ && (stmt)->_typ != 312 /* v.ast.GlobalDecl */ && (stmt)->_typ != 308 /* v.ast.ExprStmt */) { + if ((stmt)->_typ != 306 /* v.ast.ConstDecl */ && (stmt)->_typ != 314 /* v.ast.GlobalDecl */ && (stmt)->_typ != 310 /* v.ast.ExprStmt */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -51684,7 +49789,7 @@ void v__checker__Checker_check_scope_vars(v__checker__Checker* c, v__ast__Scope* } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { if (!(*obj._v__ast__Var).is_used && string_at((*obj._v__ast__Var).name, 0) != '_') { v__checker__Checker_warn(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unused variable: `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__Var).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*obj._v__ast__Var).pos); } @@ -51942,13 +50047,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_valid_pascal_case(v__checker__Che } void v__checker__Checker_type_decl(v__checker__Checker* c, v__ast__TypeDecl node) { - if (node._typ == 242 /* v.ast.AliasTypeDecl */) { + if (node._typ == 244 /* v.ast.AliasTypeDecl */) { v__checker__Checker_alias_type_decl(c, (*node._v__ast__AliasTypeDecl)); } - else if (node._typ == 243 /* v.ast.FnTypeDecl */) { + else if (node._typ == 245 /* v.ast.FnTypeDecl */) { v__checker__Checker_fn_type_decl(c, (*node._v__ast__FnTypeDecl)); } - else if (node._typ == 244 /* v.ast.SumTypeDecl */) { + else if (node._typ == 246 /* v.ast.SumTypeDecl */) { v__checker__Checker_sum_type_decl(c, (*node._v__ast__SumTypeDecl)); } ; @@ -51969,7 +50074,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy if (typ_sym->kind == v__ast__Kind__placeholder || typ_sym->kind == v__ast__Kind__int_literal || typ_sym->kind == v__ast__Kind__float_literal) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__alias) { - v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_str(typ_sym)}}, {_SLIT("` is an alias, use the original alias type `"), /*115 &string*/0xfe10, {.d_s = orig_sym->name}}, {_SLIT("` instead"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__chan) { v__checker__Checker_error(c, _SLIT("aliases of `chan` types are not allowed."), node.type_pos); @@ -51979,7 +50084,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy void v__checker__Checker_fn_type_decl(v__checker__Checker* c, v__ast__FnTypeDecl node) { v__checker__Checker_check_valid_pascal_case(c, node.name, _SLIT("fn type"), node.pos); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, node.typ); - v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; v__ast__Fn fn_info = fn_typ_info.func; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, fn_info.return_type, fn_info.return_type_pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -52030,7 +50135,7 @@ void v__checker__Checker_sum_type_decl(v__checker__Checker* c, v__ast__SumTypeDe v__checker__Checker_error(c, _SLIT("sum type cannot hold an interface"), variant.pos); } else if (sym->kind == v__ast__Kind__struct_ && sym->language == v__ast__Language__js) { v__checker__Checker_error(c, _SLIT("sum type cannot hold a JS struct"), variant.pos); - } else if ((sym->info)._typ == 418 /* v.ast.Struct */) { + } else if ((sym->info)._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { if (!v__ast__Type_has_flag(variant.typ, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("generic struct `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` must specify generic type names, e.g. Foo"), 0, { .d_c = 0 }}})), variant.pos); @@ -52088,7 +50193,8 @@ Array_v__ast__InterfaceEmbedding v__checker__Checker_expand_iface_embeds(v__chec Array_v__ast__InterfaceEmbedding _t2 = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); return _t2; } - Map_int_v__ast__InterfaceEmbedding res = new_map(sizeof(int), sizeof(v__ast__InterfaceEmbedding), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop); + Map_int_v__ast__InterfaceEmbedding res = new_map(sizeof(int), sizeof(v__ast__InterfaceEmbedding), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop) + ; Array_v__ast__InterfaceEmbedding ares = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (int _t3 = 0; _t3 < iface_embeds.len; ++_t3) { v__ast__InterfaceEmbedding ie = ((v__ast__InterfaceEmbedding*)iface_embeds.data)[_t3]; @@ -52136,14 +50242,14 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); bool explicit_lock_needed = false; v__ast__Expr expr = expr_; - if (expr._typ == 255 /* v.ast.CastExpr */) { + if (expr._typ == 257 /* v.ast.CastExpr */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 260 /* v.ast.ComptimeSelector */) { + else if (expr._typ == 262 /* v.ast.ComptimeSelector */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + else if (expr._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if (!(*(*expr._v__ast__Ident).obj._v__ast__Var).is_mut && !c->pref->translated && !c->file->is_translated && !c->inside_unsafe) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__Ident).name}}, {_SLIT("` is immutable, declare it with `mut` to make it mutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__Ident).pos); } @@ -52161,25 +50267,25 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im pos = (*expr._v__ast__Ident).pos; } } - } else if (((*expr._v__ast__Ident).obj)._typ == 324 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { + } else if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { 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); } } } - else if (expr._typ == 271 /* v.ast.IndexExpr */) { + else if (expr._typ == 273 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, (*expr._v__ast__IndexExpr).left_type); v__ast__Type elem_type = ((v__ast__Type)(0)); string kind = _SLIT(""); - if (left_sym->info._typ == 413 /* v.ast.Array */) { + if (left_sym->info._typ == 415 /* v.ast.Array */) { elem_type = (*left_sym->info._v__ast__Array).elem_type; kind = _SLIT("array"); } - else if (left_sym->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (left_sym->info._typ == 443 /* v.ast.ArrayFixed */) { elem_type = (*left_sym->info._v__ast__ArrayFixed).elem_type; kind = _SLIT("fixed array"); } - else if (left_sym->info._typ == 414 /* v.ast.Map */) { + else if (left_sym->info._typ == 416 /* v.ast.Map */) { elem_type = (*left_sym->info._v__ast__Map).value_type; kind = _SLIT("map"); } @@ -52194,17 +50300,17 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im to_lock = mr_21955.arg0; pos = mr_21955.arg1; } - else if (expr._typ == 283 /* v.ast.ParExpr */) { + else if (expr._typ == 285 /* v.ast.ParExpr */) { multi_return_string_v__token__Pos mr_22024 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); to_lock = mr_22024.arg0; pos = mr_22024.arg1; } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { multi_return_string_v__token__Pos mr_22096 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); to_lock = mr_22096.arg0; pos = mr_22096.arg1; } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -52263,7 +50369,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__interface_: { - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; _option_v__ast__StructField _t9 = v__ast__Interface_find_field(&interface_info, (*expr._v__ast__SelectorExpr).field_name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -52283,7 +50389,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__sum_type: { - v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; _option_v__ast__StructField _t12 = v__ast__SumType_find_field(&sumtype_info, (*expr._v__ast__SelectorExpr).field_name); if (_t12.state != 0) { /*or block*/ IError err = _t12.err; @@ -52358,7 +50464,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } ; } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { multi_return_string_v__token__Pos mr_25383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); to_lock = mr_25383.arg0; @@ -52368,14 +50474,14 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } } } - else if (expr._typ == 248 /* v.ast.ArrayInit */) { + else if (expr._typ == 250 /* v.ast.ArrayInit */) { v__checker__Checker_error(c, _SLIT("array literal can not be modified"), (*expr._v__ast__ArrayInit).pos); return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 293 /* v.ast.StructInit */) { + else if (expr._typ == 295 /* v.ast.StructInit */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 272 /* v.ast.InfixExpr */) { + else if (expr._typ == 274 /* v.ast.InfixExpr */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -52410,12 +50516,12 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t2 = true; return _t2; } - if ((inter_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { v__ast__Type generic_type = interface_type; v__ast__Interface generic_info = (*inter_sym->info._v__ast__Interface); if (v__ast__Type_has_flag((*inter_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*inter_sym->info._v__ast__Interface).parent_type); - if ((parent_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((parent_sym->info)._typ == 438 /* v.ast.Interface */) { generic_type = (*inter_sym->info._v__ast__Interface).parent_type; generic_info = (*parent_sym->info._v__ast__Interface); } @@ -52437,7 +50543,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, return _t5; } } - if ((inter_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { for (int _t6 = 0; _t6 < (*inter_sym->info._v__ast__Interface).types.len; ++_t6) { v__ast__Type t = ((v__ast__Type*)(*inter_sym->info._v__ast__Interface).types.data)[_t6]; if (v__ast__Type_idx(t) == v__ast__Type_idx(utyp)) { @@ -52458,7 +50564,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, if (typ_sym->kind == v__ast__Kind__interface_ && inter_sym->kind == v__ast__Kind__interface_ && !string_starts_with(styp, _SLIT("JS.")) && !string_starts_with(inter_sym->name, _SLIT("JS."))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot implement interface `"), /*115 &string*/0xfe10, {.d_s = inter_sym->name}}, {_SLIT("` with a different interface `"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); + Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); if (!v__ast__Type_alias_eq(utyp, _const_v__ast__voidptr_type)) { for (int _t10 = 0; _t10 < imethods.len; ++_t10) { v__ast__Fn imethod = ((v__ast__Fn*)imethods.data)[_t10]; @@ -52492,7 +50598,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - if ((inter_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { for (int _t14 = 0; _t14 < (*inter_sym->info._v__ast__Interface).fields.len; ++_t14) { v__ast__StructField ifield = ((v__ast__StructField*)(*inter_sym->info._v__ast__Interface).fields.data)[_t14]; _option_v__ast__StructField _t15; @@ -52525,7 +50631,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ast__Expr expr, v__ast__Type ret_type) { - if ((expr)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 256 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) || v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__result)) { string return_modifier_kind = (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) ? (_SLIT("an option")) : (_SLIT("a result"))); string return_modifier = (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) ? (_SLIT("?")) : (_SLIT("!"))); @@ -52545,7 +50651,7 @@ v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ } else if ((*expr._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected `?`, the function `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__CallExpr).name}}, {_SLIT("` does not return an optional"), 0, { .d_c = 0 }}})), (*expr._v__ast__CallExpr).or_block.pos); } - } else if ((expr)._typ == 271 /* v.ast.IndexExpr */) { + } else if ((expr)._typ == 273 /* v.ast.IndexExpr */) { if ((*expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { v__checker__Checker_check_or_expr(c, (*expr._v__ast__IndexExpr).or_expr, ret_type, v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional)); } @@ -52560,7 +50666,11 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__optional)) { - v__checker__Checker_error(c, _SLIT("to propagate an option, the call must also return an optional type"), node.pos); + if (v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__result)) { + v__checker__Checker_warn(c, _SLIT("propagating a result like an option is deprecated, use `foo()!` instead of `foo()?`"), node.pos); + } else { + v__checker__Checker_error(c, _SLIT("to propagate an option, the call must also return an optional type"), node.pos); + } } return; } @@ -52586,7 +50696,7 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* c, v__ast__Stmt stmt, v__ast__Type ret_type, v__ast__Type expr_return_type) { if (!v__ast__Type_alias_eq(ret_type, _const_v__ast__void_type)) { - if (stmt._typ == 308 /* v.ast.ExprStmt */) { + if (stmt._typ == 310 /* v.ast.ExprStmt */) { c->expected_type = ret_type; c->expected_or_type = v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional); v__ast__Type last_stmt_typ = v__checker__Checker_expr(c, (*stmt._v__ast__ExprStmt).expr); @@ -52598,13 +50708,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* } string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__void_type)) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 269 /* v.ast.IfExpr */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 271 /* v.ast.IfExpr */) { for (int _t1 = 0; _t1 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t1) { v__ast__IfBranch branch = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t1]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); } return; - } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 278 /* v.ast.MatchExpr */) { + } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 280 /* v.ast.MatchExpr */) { for (int _t2 = 0; _t2 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t2) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t2]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); @@ -52617,13 +50727,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("wrong return type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` in the `or {}` block, expected `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } } - else if (stmt._typ == 302 /* v.ast.BranchStmt */) { + else if (stmt._typ == 304 /* v.ast.BranchStmt */) { if (!((*stmt._v__ast__BranchStmt).kind == v__token__Kind__key_continue || (*stmt._v__ast__BranchStmt).kind == v__token__Kind__key_break)) { v__checker__Checker_error(c, _SLIT("only break/continue is allowed as a branch statement in the end of an `or {}` block"), (*stmt._v__ast__BranchStmt).pos); return; } } - else if (stmt._typ == 319 /* v.ast.Return */) { + else if (stmt._typ == 321 /* v.ast.Return */) { } else { @@ -52631,14 +50741,14 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("last statement in the `or {}` block should be an expression of type `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("` or exit parent scope"), 0, { .d_c = 0 }}})), (*(stmt.pos))); } ; - } else if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).expr._typ == 269 /* v.ast.IfExpr */) { + } else if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 271 /* v.ast.IfExpr */) { for (int _t3 = 0; _t3 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t3) { v__ast__IfBranch branch = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t3]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 278 /* v.ast.MatchExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 280 /* v.ast.MatchExpr */) { for (int _t4 = 0; _t4 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t4) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t4]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); @@ -52671,14 +50781,14 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S c->using_new_err_struct = true; } int name_type = 0; - if (node->expr._typ == 268 /* v.ast.Ident */) { + if (node->expr._typ == 270 /* v.ast.Ident */) { string name = (*node->expr._v__ast__Ident).name; bool valid_generic = v__util__is_generic_type_name(name) && Array_string_contains(c->table->cur_fn->generic_names, name); if (valid_generic) { name_type = v__ast__Type_set_flag(((v__ast__Table_find_type_idx(c->table, name))), v__ast__TypeFlag__generic); } } - else if (node->expr._typ == 295 /* v.ast.TypeOf */) { + else if (node->expr._typ == 297 /* v.ast.TypeOf */) { name_type = v__checker__Checker_expr(c, (*node->expr._v__ast__TypeOf).expr); } @@ -52713,8 +50823,8 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S c->inside_selector_expr = true; v__ast__Type typ = v__checker__Checker_expr(c, node->expr); if (v__ast__Expr_is_auto_deref_var(node->expr)) { - if ((node->expr)._typ == 268 /* v.ast.Ident */) { - if (((*node->expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((node->expr)._typ == 270 /* v.ast.Ident */) { + if (((*node->expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { typ = (*(*node->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -52726,7 +50836,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S return _t6; } node->expr_type = typ; - if (v__ast__Type_has_flag(node->expr_type, v__ast__TypeFlag__optional) && !((node->expr)._typ == 268 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->expr)._v__ast__Ident,(node->expr)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).kind == v__ast__IdentKind__constant)) { + if (v__ast__Type_has_flag(node->expr_type, v__ast__TypeFlag__optional) && !((node->expr)._typ == 270 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->expr)._v__ast__Ident,(node->expr)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).kind == v__ast__IdentKind__constant)) { v__checker__Checker_error(c, _SLIT("cannot access fields of an optional, handle the error with `or {...}` or propagate it with `?`"), node->pos); } string field_name = node->field_name; @@ -52750,7 +50860,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); - if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 418 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { + if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 420 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(c->table, embed); @@ -52780,16 +50890,16 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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_39477 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_39477.arg0; - embed_types = mr_39477.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_39652 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_39652.arg0; + embed_types = mr_39652.arg1; 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); } } if (!c->inside_unsafe) { - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_union && !Array_v__token__Kind_contains(_const_v__token__assign_tokens, node->next_token)) { v__checker__Checker_warn(c, _SLIT("reading a union field (or its address) requires `unsafe`"), node->pos); } @@ -52816,9 +50926,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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_40308 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40308.arg0; - embed_types = mr_40308.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40483 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40483.arg0; + embed_types = mr_40483.arg1; node->from_embed_types = embed_types; } } @@ -52896,7 +51006,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("` has no property `"), /*115 &string*/0xfe10, {.d_s = node->field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } else { - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); } @@ -52974,7 +51084,7 @@ void v__checker__Checker_enum_decl(v__checker__Checker* c, v__ast__EnumDecl* nod } } if (field->has_expr) { - if (field->expr._typ == 273 /* v.ast.IntegerLiteral */) { + if (field->expr._typ == 275 /* v.ast.IntegerLiteral */) { i64 val = string_i64((*field->expr._v__ast__IntegerLiteral).val); if (val < _const_v__checker__int_min || val > _const_v__checker__int_max) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("enum value `"), /*100 &i64*/0xfe09, {.d_i64 = val}}, {_SLIT("` overflows int"), 0, { .d_c = 0 }}})), (*field->expr._v__ast__IntegerLiteral).pos); @@ -52983,14 +51093,14 @@ void v__checker__Checker_enum_decl(v__checker__Checker* c, v__ast__EnumDecl* nod } array_push((array*)&seen, _MOV((i64[]){ ((i64)(val)) })); } - else if (field->expr._typ == 285 /* v.ast.PrefixExpr */) { + else if (field->expr._typ == 287 /* v.ast.PrefixExpr */) { } - else if (field->expr._typ == 272 /* v.ast.InfixExpr */) { + else if (field->expr._typ == 274 /* v.ast.InfixExpr */) { v__checker__Checker_infix_expr(c, (voidptr)&/*qq*/(*field->expr._v__ast__InfixExpr)); } else { - if ((field->expr)._typ == 268 /* v.ast.Ident */) { + if ((field->expr)._typ == 270 /* v.ast.Ident */) { if ((*field->expr._v__ast__Ident).language == v__ast__Language__c) { continue; } @@ -53039,38 +51149,38 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St } #endif c->expected_type = _const_v__ast__void_type; - if (node._typ == 306 /* v.ast.EmptyStmt */) { + if (node._typ == 308 /* v.ast.EmptyStmt */) { if (c->pref->is_verbose) { eprintln(_SLIT("Checker.stmt() EmptyStmt")); print_backtrace(); } } - else if (node._typ == 279 /* v.ast.NodeError */) { + else if (node._typ == 281 /* v.ast.NodeError */) { } - else if (node._typ == 298 /* v.ast.AsmStmt */) { + else if (node._typ == 300 /* v.ast.AsmStmt */) { v__checker__Checker_asm_stmt(c, (voidptr)&/*qq*/(*node._v__ast__AsmStmt)); } - else if (node._typ == 299 /* v.ast.AssertStmt */) { + else if (node._typ == 301 /* v.ast.AssertStmt */) { v__checker__Checker_assert_stmt(c, (*node._v__ast__AssertStmt)); } - else if (node._typ == 300 /* v.ast.AssignStmt */) { + else if (node._typ == 302 /* v.ast.AssignStmt */) { v__checker__Checker_assign_stmt(c, (voidptr)&/*qq*/(*node._v__ast__AssignStmt)); } - else if (node._typ == 301 /* v.ast.Block */) { + else if (node._typ == 303 /* v.ast.Block */) { v__checker__Checker_block(c, (*node._v__ast__Block)); } - else if (node._typ == 302 /* v.ast.BranchStmt */) { + else if (node._typ == 304 /* v.ast.BranchStmt */) { v__checker__Checker_branch_stmt(c, (*node._v__ast__BranchStmt)); } - else if (node._typ == 303 /* v.ast.ComptimeFor */) { + else if (node._typ == 305 /* v.ast.ComptimeFor */) { v__checker__Checker_comptime_for(c, (*node._v__ast__ComptimeFor)); } - else if (node._typ == 304 /* v.ast.ConstDecl */) { + else if (node._typ == 306 /* v.ast.ConstDecl */) { c->inside_const = true; v__checker__Checker_const_decl(c, (voidptr)&/*qq*/(*node._v__ast__ConstDecl)); c->inside_const = false; } - else if (node._typ == 305 /* v.ast.DeferStmt */) { + else if (node._typ == 307 /* v.ast.DeferStmt */) { if ((*node._v__ast__DeferStmt).idx_in_fn < 0) { (*node._v__ast__DeferStmt).idx_in_fn = c->table->cur_fn->defer_stmts.len; array_push((array*)&c->table->cur_fn->defer_stmts, _MOV((v__ast__DeferStmt[]){ *&(*node._v__ast__DeferStmt) })); @@ -53081,7 +51191,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St for (int i = 0; i < (*node._v__ast__DeferStmt).defer_vars.len; ++i) { v__ast__Ident ident = ((v__ast__Ident*)(*node._v__ast__DeferStmt).defer_vars.data)[i]; v__ast__Ident id = ident; - if ((id.info)._typ == 378 /* v.ast.IdentVar */) { + if ((id.info)._typ == 380 /* v.ast.IdentVar */) { if (id.comptime && Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, id.name)) { array_set(&(*node._v__ast__DeferStmt).defer_vars, i, &(v__ast__Ident[]) { ((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; @@ -53098,20 +51208,20 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__checker__Checker_stmts(c, (*node._v__ast__DeferStmt).stmts); c->inside_defer = false; } - else if (node._typ == 307 /* v.ast.EnumDecl */) { + else if (node._typ == 309 /* v.ast.EnumDecl */) { v__checker__Checker_enum_decl(c, (voidptr)&/*qq*/(*node._v__ast__EnumDecl)); } - else if (node._typ == 308 /* v.ast.ExprStmt */) { + else if (node._typ == 310 /* v.ast.ExprStmt */) { (*node._v__ast__ExprStmt).typ = v__checker__Checker_expr(c, (*node._v__ast__ExprStmt).expr); c->expected_type = _const_v__ast__void_type; v__ast__Type or_typ = _const_v__ast__void_type; - if ((*node._v__ast__ExprStmt).expr._typ == 271 /* v.ast.IndexExpr */) { + if ((*node._v__ast__ExprStmt).expr._typ == 273 /* v.ast.IndexExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { (*node._v__ast__ExprStmt).is_expr = true; or_typ = (*node._v__ast__ExprStmt).typ; } } - else if ((*node._v__ast__ExprStmt).expr._typ == 285 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__ExprStmt).expr._typ == 287 /* v.ast.PrefixExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent) { (*node._v__ast__ExprStmt).is_expr = true; or_typ = (*node._v__ast__ExprStmt).typ; @@ -53122,7 +51232,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St } ; if (!c->pref->is_repl && (c->stmt_level == 1 || (c->stmt_level > 1 && !c->is_last_stmt))) { - if (((*node._v__ast__ExprStmt).expr)._typ == 272 /* v.ast.InfixExpr */) { + if (((*node._v__ast__ExprStmt).expr)._typ == 274 /* v.ast.InfixExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__InfixExpr).op == v__token__Kind__left_shift) { v__ast__TypeSymbol* left_sym = v__ast__Table_final_sym(c->table, (*(*node._v__ast__ExprStmt).expr._v__ast__InfixExpr).left_type); if (left_sym->kind != v__ast__Kind__array) { @@ -53136,21 +51246,21 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St else if (node._typ == 185 /* v.ast.FnDecl */) { v__checker__Checker_fn_decl(c, (voidptr)&/*qq*/(*node._v__ast__FnDecl)); } - else if (node._typ == 309 /* v.ast.ForCStmt */) { + else if (node._typ == 311 /* v.ast.ForCStmt */) { v__checker__Checker_for_c_stmt(c, (*node._v__ast__ForCStmt)); } - else if (node._typ == 310 /* v.ast.ForInStmt */) { + else if (node._typ == 312 /* v.ast.ForInStmt */) { v__checker__Checker_for_in_stmt(c, (voidptr)&/*qq*/(*node._v__ast__ForInStmt)); } - else if (node._typ == 311 /* v.ast.ForStmt */) { + else if (node._typ == 313 /* v.ast.ForStmt */) { v__checker__Checker_for_stmt(c, (voidptr)&/*qq*/(*node._v__ast__ForStmt)); } - else if (node._typ == 312 /* v.ast.GlobalDecl */) { + else if (node._typ == 314 /* v.ast.GlobalDecl */) { v__checker__Checker_global_decl(c, (voidptr)&/*qq*/(*node._v__ast__GlobalDecl)); } - else if (node._typ == 313 /* v.ast.GotoLabel */) { + else if (node._typ == 315 /* v.ast.GotoLabel */) { } - else if (node._typ == 314 /* v.ast.GotoStmt */) { + else if (node._typ == 316 /* v.ast.GotoStmt */) { if (c->inside_defer) { v__checker__Checker_error(c, _SLIT("goto is not allowed in defer statements"), (*node._v__ast__GotoStmt).pos); } @@ -53161,32 +51271,32 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown label `"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__GotoStmt).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__GotoStmt).pos); } } - else if (node._typ == 315 /* v.ast.HashStmt */) { + else if (node._typ == 317 /* v.ast.HashStmt */) { v__checker__Checker_hash_stmt(c, (voidptr)&/*qq*/(*node._v__ast__HashStmt)); } - else if (node._typ == 316 /* v.ast.Import */) { + else if (node._typ == 318 /* v.ast.Import */) { v__checker__Checker_import_stmt(c, (*node._v__ast__Import)); } - else if (node._typ == 317 /* v.ast.InterfaceDecl */) { + else if (node._typ == 319 /* v.ast.InterfaceDecl */) { v__checker__Checker_interface_decl(c, (voidptr)&/*qq*/(*node._v__ast__InterfaceDecl)); } - else if (node._typ == 318 /* v.ast.Module */) { + else if (node._typ == 320 /* v.ast.Module */) { c->mod = (*node._v__ast__Module).name; c->is_just_builtin_mod = string__eq((*node._v__ast__Module).name, _SLIT("builtin")); c->is_builtin_mod = c->is_just_builtin_mod || (string__eq((*node._v__ast__Module).name, _SLIT("os")) || string__eq((*node._v__ast__Module).name, _SLIT("strconv"))); v__checker__Checker_check_valid_snake_case(c, (*node._v__ast__Module).name, _SLIT("module name"), (*node._v__ast__Module).pos); } - else if (node._typ == 319 /* v.ast.Return */) { + else if (node._typ == 321 /* v.ast.Return */) { v__checker__Checker_return_stmt(c, (voidptr)&/*qq*/(*node._v__ast__Return)); c->scope_returns = true; } - else if (node._typ == 320 /* v.ast.SqlStmt */) { + else if (node._typ == 322 /* v.ast.SqlStmt */) { v__checker__Checker_sql_stmt(c, (voidptr)&/*qq*/(*node._v__ast__SqlStmt)); } - else if (node._typ == 321 /* v.ast.StructDecl */) { + else if (node._typ == 323 /* v.ast.StructDecl */) { v__checker__Checker_struct_decl(c, (voidptr)&/*qq*/(*node._v__ast__StructDecl)); } - else if (node._typ == 245 /* v.ast.TypeDecl */) { + else if (node._typ == 247 /* v.ast.TypeDecl */) { v__checker__Checker_type_decl(c, (*node._v__ast__TypeDecl)); } ; @@ -53239,7 +51349,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_global_decl(v__checker__Checker* c, v__ v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), field->typ_pos); } if (field->has_expr) { - if ((field->expr)._typ == 246 /* v.ast.AnonFn */ && string__eq(field->name, _SLIT("main"))) { + if ((field->expr)._typ == 248 /* v.ast.AnonFn */ && string__eq(field->name, _SLIT("main"))) { v__checker__Checker_error(c, _SLIT("the `main` function is the program entry point, cannot redefine it"), field->pos); } field->typ = v__checker__Checker_expr(c, field->expr); @@ -53290,9 +51400,9 @@ VV_LOCAL_SYMBOL void v__checker__Checker_asm_stmt(v__checker__Checker* c, v__ast } VV_LOCAL_SYMBOL void v__checker__Checker_asm_arg(v__checker__Checker* c, v__ast__AsmArg arg, v__ast__AsmStmt stmt, Array_string aliases) { - if (arg._typ == 399 /* v.ast.AsmAlias */) { + if (arg._typ == 401 /* v.ast.AsmAlias */) { } - else if (arg._typ == 398 /* v.ast.AsmAddressing */) { + else if (arg._typ == 400 /* v.ast.AsmAddressing */) { if (!((*arg._v__ast__AsmAddressing).scale == -1 || (*arg._v__ast__AsmAddressing).scale == 1 || (*arg._v__ast__AsmAddressing).scale == 2 || (*arg._v__ast__AsmAddressing).scale == 4 || (*arg._v__ast__AsmAddressing).scale == 8)) { v__checker__Checker_error(c, _SLIT("scale must be one of 1, 2, 4, or 8"), (*arg._v__ast__AsmAddressing).pos); } @@ -53300,17 +51410,17 @@ VV_LOCAL_SYMBOL void v__checker__Checker_asm_arg(v__checker__Checker* c, v__ast_ v__checker__Checker_asm_arg(c, (*arg._v__ast__AsmAddressing).base, stmt, aliases); v__checker__Checker_asm_arg(c, (*arg._v__ast__AsmAddressing).index, stmt, aliases); } - else if (arg._typ == 252 /* v.ast.BoolLiteral */) { + else if (arg._typ == 254 /* v.ast.BoolLiteral */) { } - else if (arg._typ == 266 /* v.ast.FloatLiteral */) { + else if (arg._typ == 268 /* v.ast.FloatLiteral */) { } - else if (arg._typ == 257 /* v.ast.CharLiteral */) { + else if (arg._typ == 259 /* v.ast.CharLiteral */) { } - else if (arg._typ == 273 /* v.ast.IntegerLiteral */) { + else if (arg._typ == 275 /* v.ast.IntegerLiteral */) { } - else if (arg._typ == 323 /* v.ast.AsmRegister */) { + else if (arg._typ == 325 /* v.ast.AsmRegister */) { } - else if (arg._typ == 400 /* v.ast.AsmDisp */) { + else if (arg._typ == 402 /* v.ast.AsmDisp */) { } else if (arg._typ == 20 /* string */) { } @@ -53615,7 +51725,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmts_ending_with_expression(v__checker } } v__checker__Checker_stmt(c, stmt); - if ((stmt)._typ == 313 /* v.ast.GotoLabel */) { + if ((stmt)._typ == 315 /* v.ast.GotoLabel */) { unreachable = ((v__token__Pos){.len = 0,.line_nr = -1,.pos = 0,.col = 0,.last_line = 0,}); c->scope_returns = false; } @@ -53659,15 +51769,15 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t1; } - if (node._typ == 279 /* v.ast.NodeError */) { + if (node._typ == 281 /* v.ast.NodeError */) { } - else if (node._typ == 261 /* v.ast.ComptimeType */) { + else if (node._typ == 263 /* v.ast.ComptimeType */) { v__checker__Checker_error(c, _SLIT("incorrect use of compile-time type"), (*node._v__ast__ComptimeType).pos); } - else if (node._typ == 264 /* v.ast.EmptyExpr */) { + else if (node._typ == 266 /* v.ast.EmptyExpr */) { v__checker__Checker_error(c, _SLIT("checker.expr(): unhandled EmptyExpr"), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); } - else if (node._typ == 253 /* v.ast.CTempVar */) { + else if (node._typ == 255 /* v.ast.CTempVar */) { v__ast__Type _t2 = (*node._v__ast__CTempVar).typ; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53676,7 +51786,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t2; } - else if (node._typ == 246 /* v.ast.AnonFn */) { + else if (node._typ == 248 /* v.ast.AnonFn */) { v__ast__Type _t3 = v__checker__Checker_anon_fn(c, (voidptr)&/*qq*/(*node._v__ast__AnonFn)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53685,7 +51795,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t3; } - else if (node._typ == 247 /* v.ast.ArrayDecompose */) { + else if (node._typ == 249 /* v.ast.ArrayDecompose */) { v__ast__Type typ = v__checker__Checker_expr(c, (*node._v__ast__ArrayDecompose).expr); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, typ); if (type_sym->kind != v__ast__Kind__array) { @@ -53698,7 +51808,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t4; } - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type elem_type = v__ast__Type_set_flag(array_info.elem_type, v__ast__TypeFlag__variadic); (*node._v__ast__ArrayDecompose).expr_type = typ; (*node._v__ast__ArrayDecompose).arg_type = elem_type; @@ -53710,7 +51820,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t5; } - else if (node._typ == 248 /* v.ast.ArrayInit */) { + else if (node._typ == 250 /* v.ast.ArrayInit */) { v__ast__Type _t6 = v__checker__Checker_array_init(c, (voidptr)&/*qq*/(*node._v__ast__ArrayInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53719,7 +51829,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t6; } - else if (node._typ == 249 /* v.ast.AsCast */) { + else if (node._typ == 251 /* v.ast.AsCast */) { (*node._v__ast__AsCast).expr_type = v__checker__Checker_expr(c, (*node._v__ast__AsCast).expr); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(c->table, (*node._v__ast__AsCast).expr_type); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, (*node._v__ast__AsCast).typ); @@ -53756,7 +51866,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t9; } - else if (node._typ == 250 /* v.ast.Assoc */) { + else if (node._typ == 252 /* v.ast.Assoc */) { _option_v__ast__Var_ptr _t10 = v__ast__Scope_find_var((*node._v__ast__Assoc).scope, (*node._v__ast__Assoc).var_name); if (_t10.state != 0) { /*or block*/ IError err = _t10.err; @@ -53778,7 +51888,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t11; } - else if (node._typ == 252 /* v.ast.BoolLiteral */) { + else if (node._typ == 254 /* v.ast.BoolLiteral */) { v__ast__Type _t12 = _const_v__ast__bool_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53787,7 +51897,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t12; } - else if (node._typ == 255 /* v.ast.CastExpr */) { + else if (node._typ == 257 /* v.ast.CastExpr */) { v__ast__Type _t13 = v__checker__Checker_cast_expr(c, (voidptr)&/*qq*/(*node._v__ast__CastExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53796,7 +51906,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t13; } - else if (node._typ == 254 /* v.ast.CallExpr */) { + else if (node._typ == 256 /* v.ast.CallExpr */) { v__ast__Type ret_type = v__checker__Checker_call_expr(c, (voidptr)&/*qq*/(*node._v__ast__CallExpr)); if (!v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__optional) && !v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__result)) { if ((*node._v__ast__CallExpr).or_block.kind == v__ast__OrKind__block) { @@ -53821,7 +51931,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t14; } - else if (node._typ == 256 /* v.ast.ChanInit */) { + else if (node._typ == 258 /* v.ast.ChanInit */) { v__ast__Type _t15 = v__checker__Checker_chan_init(c, (voidptr)&/*qq*/(*node._v__ast__ChanInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53830,7 +51940,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t15; } - else if (node._typ == 257 /* v.ast.CharLiteral */) { + else if (node._typ == 259 /* v.ast.CharLiteral */) { v__ast__Type _t16 = _const_v__ast__rune_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53839,7 +51949,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t16; } - else if (node._typ == 258 /* v.ast.Comment */) { + else if (node._typ == 260 /* v.ast.Comment */) { v__ast__Type _t17 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53848,7 +51958,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t17; } - else if (node._typ == 251 /* v.ast.AtExpr */) { + else if (node._typ == 253 /* v.ast.AtExpr */) { v__ast__Type _t18 = v__checker__Checker_at_expr(c, (voidptr)&/*qq*/(*node._v__ast__AtExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53857,7 +51967,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t18; } - else if (node._typ == 259 /* v.ast.ComptimeCall */) { + else if (node._typ == 261 /* v.ast.ComptimeCall */) { v__ast__Type _t19 = v__checker__Checker_comptime_call(c, (voidptr)&/*qq*/(*node._v__ast__ComptimeCall)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53866,7 +51976,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t19; } - else if (node._typ == 260 /* v.ast.ComptimeSelector */) { + else if (node._typ == 262 /* v.ast.ComptimeSelector */) { v__ast__Type _t20 = v__checker__Checker_comptime_selector(c, (voidptr)&/*qq*/(*node._v__ast__ComptimeSelector)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53875,7 +51985,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t20; } - else if (node._typ == 262 /* v.ast.ConcatExpr */) { + else if (node._typ == 264 /* v.ast.ConcatExpr */) { v__ast__Type _t21 = v__checker__Checker_concat_expr(c, (voidptr)&/*qq*/(*node._v__ast__ConcatExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53884,7 +51994,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t21; } - else if (node._typ == 263 /* v.ast.DumpExpr */) { + else if (node._typ == 265 /* v.ast.DumpExpr */) { (*node._v__ast__DumpExpr).expr_type = v__checker__Checker_expr(c, (*node._v__ast__DumpExpr).expr); v__checker__Checker_check_expr_opt_call(c, (*node._v__ast__DumpExpr).expr, (*node._v__ast__DumpExpr).expr_type); int etidx = v__ast__Type_idx((*node._v__ast__DumpExpr).expr_type); @@ -53918,7 +52028,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t24; } - else if (node._typ == 265 /* v.ast.EnumVal */) { + else if (node._typ == 267 /* v.ast.EnumVal */) { v__ast__Type _t25 = v__checker__Checker_enum_val(c, (voidptr)&/*qq*/(*node._v__ast__EnumVal)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53927,7 +52037,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t25; } - else if (node._typ == 266 /* v.ast.FloatLiteral */) { + else if (node._typ == 268 /* v.ast.FloatLiteral */) { v__ast__Type _t26 = _const_v__ast__float_literal_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53936,7 +52046,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t26; } - else if (node._typ == 267 /* v.ast.GoExpr */) { + else if (node._typ == 269 /* v.ast.GoExpr */) { v__ast__Type _t27 = v__checker__Checker_go_expr(c, (voidptr)&/*qq*/(*node._v__ast__GoExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53945,7 +52055,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t27; } - else if (node._typ == 268 /* v.ast.Ident */) { + else if (node._typ == 270 /* v.ast.Ident */) { v__ast__Type res = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); v__ast__Type _t28 = res; // Defer begin @@ -53955,7 +52065,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t28; } - else if (node._typ == 269 /* v.ast.IfExpr */) { + else if (node._typ == 271 /* v.ast.IfExpr */) { v__ast__Type _t29 = v__checker__Checker_if_expr(c, (voidptr)&/*qq*/(*node._v__ast__IfExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -53964,21 +52074,21 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t29; } - else if (node._typ == 270 /* v.ast.IfGuardExpr */) { + else if (node._typ == 272 /* v.ast.IfGuardExpr */) { bool old_inside_if_guard = c->inside_if_guard; c->inside_if_guard = true; (*node._v__ast__IfGuardExpr).expr_type = v__checker__Checker_expr(c, (*node._v__ast__IfGuardExpr).expr); c->inside_if_guard = old_inside_if_guard; - if (!v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { - bool no_opt = true; - if ((*node._v__ast__IfGuardExpr).expr._typ == 271 /* v.ast.IndexExpr */) { - no_opt = false; + if (!v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional) && !v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + bool no_opt_or_res = true; + if ((*node._v__ast__IfGuardExpr).expr._typ == 273 /* v.ast.IndexExpr */) { + no_opt_or_res = false; (*node._v__ast__IfGuardExpr).expr_type = v__ast__Type_set_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); (*(*node._v__ast__IfGuardExpr).expr._v__ast__IndexExpr).is_option = true; } - else if ((*node._v__ast__IfGuardExpr).expr._typ == 285 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__IfGuardExpr).expr._typ == 287 /* v.ast.PrefixExpr */) { if ((*(*node._v__ast__IfGuardExpr).expr._v__ast__PrefixExpr).op == v__token__Kind__arrow) { - no_opt = false; + no_opt_or_res = false; (*node._v__ast__IfGuardExpr).expr_type = v__ast__Type_set_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); (*(*node._v__ast__IfGuardExpr).expr._v__ast__PrefixExpr).is_option = true; } @@ -53987,8 +52097,8 @@ bool v__checker__Checker_expr_defer_0 = false; else { } ; - if (no_opt) { - v__checker__Checker_error(c, _SLIT("expression should return an option"), v__ast__Expr_pos((*node._v__ast__IfGuardExpr).expr)); + if (no_opt_or_res) { + v__checker__Checker_error(c, _SLIT("expression should either return an option or a result"), v__ast__Expr_pos((*node._v__ast__IfGuardExpr).expr)); } } v__ast__Type _t30 = _const_v__ast__bool_type; @@ -53999,7 +52109,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t30; } - else if (node._typ == 271 /* v.ast.IndexExpr */) { + else if (node._typ == 273 /* v.ast.IndexExpr */) { v__ast__Type _t31 = v__checker__Checker_index_expr(c, (voidptr)&/*qq*/(*node._v__ast__IndexExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54008,7 +52118,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t31; } - else if (node._typ == 272 /* v.ast.InfixExpr */) { + else if (node._typ == 274 /* v.ast.InfixExpr */) { v__ast__Type _t32 = v__checker__Checker_infix_expr(c, (voidptr)&/*qq*/(*node._v__ast__InfixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54017,7 +52127,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t32; } - else if (node._typ == 273 /* v.ast.IntegerLiteral */) { + else if (node._typ == 275 /* v.ast.IntegerLiteral */) { v__ast__Type _t33 = v__checker__Checker_int_lit(c, (voidptr)&/*qq*/(*node._v__ast__IntegerLiteral)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54026,7 +52136,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t33; } - else if (node._typ == 276 /* v.ast.LockExpr */) { + else if (node._typ == 278 /* v.ast.LockExpr */) { v__ast__Type _t34 = v__checker__Checker_lock_expr(c, (voidptr)&/*qq*/(*node._v__ast__LockExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54035,7 +52145,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t34; } - else if (node._typ == 277 /* v.ast.MapInit */) { + else if (node._typ == 279 /* v.ast.MapInit */) { v__ast__Type _t35 = v__checker__Checker_map_init(c, (voidptr)&/*qq*/(*node._v__ast__MapInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54044,7 +52154,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t35; } - else if (node._typ == 278 /* v.ast.MatchExpr */) { + else if (node._typ == 280 /* v.ast.MatchExpr */) { v__ast__Type _t36 = v__checker__Checker_match_expr(c, (voidptr)&/*qq*/(*node._v__ast__MatchExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54053,7 +52163,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t36; } - else if (node._typ == 284 /* v.ast.PostfixExpr */) { + else if (node._typ == 286 /* v.ast.PostfixExpr */) { v__ast__Type _t37 = v__checker__Checker_postfix_expr(c, (voidptr)&/*qq*/(*node._v__ast__PostfixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54062,7 +52172,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t37; } - else if (node._typ == 285 /* v.ast.PrefixExpr */) { + else if (node._typ == 287 /* v.ast.PrefixExpr */) { v__ast__Type _t38 = v__checker__Checker_prefix_expr(c, (voidptr)&/*qq*/(*node._v__ast__PrefixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54071,7 +52181,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t38; } - else if (node._typ == 280 /* v.ast.None */) { + else if (node._typ == 282 /* v.ast.None */) { v__ast__Type _t39 = _const_v__ast__none_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54080,7 +52190,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t39; } - else if (node._typ == 282 /* v.ast.OrExpr */) { + else if (node._typ == 284 /* v.ast.OrExpr */) { v__ast__Type _t40 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54089,8 +52199,8 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t40; } - else if (node._typ == 283 /* v.ast.ParExpr */) { - if (((*node._v__ast__ParExpr).expr)._typ == 283 /* v.ast.ParExpr */) { + else if (node._typ == 285 /* v.ast.ParExpr */) { + if (((*node._v__ast__ParExpr).expr)._typ == 285 /* v.ast.ParExpr */) { v__checker__Checker_warn(c, _SLIT("redundant parentheses are used"), (*node._v__ast__ParExpr).pos); } v__ast__Type _t41 = v__checker__Checker_expr(c, (*node._v__ast__ParExpr).expr); @@ -54101,7 +52211,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t41; } - else if (node._typ == 286 /* v.ast.RangeExpr */) { + else if (node._typ == 288 /* v.ast.RangeExpr */) { v__ast__Type _t42 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54110,7 +52220,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t42; } - else if (node._typ == 287 /* v.ast.SelectExpr */) { + else if (node._typ == 289 /* v.ast.SelectExpr */) { v__ast__Type _t43 = v__checker__Checker_select_expr(c, (voidptr)&/*qq*/(*node._v__ast__SelectExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54119,7 +52229,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t43; } - else if (node._typ == 288 /* v.ast.SelectorExpr */) { + else if (node._typ == 290 /* v.ast.SelectorExpr */) { v__ast__Type _t44 = v__checker__Checker_selector_expr(c, (voidptr)&/*qq*/(*node._v__ast__SelectorExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54128,7 +52238,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t44; } - else if (node._typ == 289 /* v.ast.SizeOf */) { + else if (node._typ == 291 /* v.ast.SizeOf */) { if (!(*node._v__ast__SizeOf).is_type) { (*node._v__ast__SizeOf).typ = v__checker__Checker_expr(c, (*node._v__ast__SizeOf).expr); } @@ -54140,7 +52250,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t45; } - else if (node._typ == 274 /* v.ast.IsRefType */) { + else if (node._typ == 276 /* v.ast.IsRefType */) { if (!(*node._v__ast__IsRefType).is_type) { (*node._v__ast__IsRefType).typ = v__checker__Checker_expr(c, (*node._v__ast__IsRefType).expr); } @@ -54152,7 +52262,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t46; } - else if (node._typ == 281 /* v.ast.OffsetOf */) { + else if (node._typ == 283 /* v.ast.OffsetOf */) { v__ast__Type _t47 = v__checker__Checker_offset_of(c, (*node._v__ast__OffsetOf)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54161,7 +52271,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t47; } - else if (node._typ == 290 /* v.ast.SqlExpr */) { + else if (node._typ == 292 /* v.ast.SqlExpr */) { v__ast__Type _t48 = v__checker__Checker_sql_expr(c, (voidptr)&/*qq*/(*node._v__ast__SqlExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54170,7 +52280,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t48; } - else if (node._typ == 292 /* v.ast.StringLiteral */) { + else if (node._typ == 294 /* v.ast.StringLiteral */) { if ((*node._v__ast__StringLiteral).language == v__ast__Language__c) { v__ast__Type _t49 = v__ast__Type_set_nr_muls(_const_v__ast__byte_type, 1); // Defer begin @@ -54188,7 +52298,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t50; } - else if (node._typ == 291 /* v.ast.StringInterLiteral */) { + else if (node._typ == 293 /* v.ast.StringInterLiteral */) { v__ast__Type _t51 = v__checker__Checker_string_inter_lit(c, (voidptr)&/*qq*/(*node._v__ast__StringInterLiteral)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54197,7 +52307,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t51; } - else if (node._typ == 293 /* v.ast.StructInit */) { + else if (node._typ == 295 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).unresolved) { v__ast__Type _t52 = v__checker__Checker_expr(c, v__ast__resolve_init((*node._v__ast__StructInit), v__checker__Checker_unwrap_generic(c, (*node._v__ast__StructInit).typ), c->table)); // Defer begin @@ -54215,7 +52325,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t53; } - else if (node._typ == 294 /* v.ast.TypeNode */) { + else if (node._typ == 296 /* v.ast.TypeNode */) { v__ast__Type _t54 = (*node._v__ast__TypeNode).typ; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54224,7 +52334,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t54; } - else if (node._typ == 295 /* v.ast.TypeOf */) { + else if (node._typ == 297 /* v.ast.TypeOf */) { (*node._v__ast__TypeOf).expr_type = v__checker__Checker_expr(c, (*node._v__ast__TypeOf).expr); v__ast__Type _t55 = _const_v__ast__string_type; // Defer begin @@ -54234,7 +52344,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t55; } - else if (node._typ == 296 /* v.ast.UnsafeExpr */) { + else if (node._typ == 298 /* v.ast.UnsafeExpr */) { v__ast__Type _t56 = v__checker__Checker_unsafe_expr(c, (voidptr)&/*qq*/(*node._v__ast__UnsafeExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -54243,7 +52353,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t56; } - else if (node._typ == 275 /* v.ast.Likely */) { + else if (node._typ == 277 /* v.ast.Likely */) { v__ast__Type ltype = v__checker__Checker_expr(c, (*node._v__ast__Likely).expr); if (!v__checker__Checker_check_types(c, ltype, _const_v__ast__bool_type)) { v__ast__TypeSymbol* ltype_sym = v__ast__Table_sym(c->table, ltype); @@ -54276,6 +52386,9 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__ast__Type to_type = node->typ; v__ast__TypeSymbol* to_sym = v__ast__Table_sym(c->table, to_type); v__ast__TypeSymbol* final_to_sym = v__ast__Table_final_sym(c->table, to_type); + if (v__ast__Type_has_flag(to_type, v__ast__TypeFlag__optional)) { + v__checker__Checker_error(c, _SLIT("casting to optional type is forbidden"), node->pos); + } if ((v__ast__TypeSymbol_is_number(to_sym) && string__eq(from_sym->name, _SLIT("JS.Number"))) || (v__ast__TypeSymbol_is_number(to_sym) && string__eq(from_sym->name, _SLIT("JS.BigInt"))) || (v__ast__TypeSymbol_is_string(to_sym) && string__eq(from_sym->name, _SLIT("JS.String"))) || (v__ast__Type_is_bool(to_type) && string__eq(from_sym->name, _SLIT("JS.Boolean"))) || (v__ast__Type_is_bool(from_type) && string__eq(to_sym->name, _SLIT("JS.Boolean"))) || (v__ast__TypeSymbol_is_number(from_sym) && string__eq(to_sym->name, _SLIT("JS.Number"))) || (v__ast__TypeSymbol_is_number(from_sym) && string__eq(to_sym->name, _SLIT("JS.BigInt"))) || (v__ast__TypeSymbol_is_string(from_sym) && string__eq(to_sym->name, _SLIT("JS.String")))) { v__ast__Type _t1 = to_type; return _t1; @@ -54305,17 +52418,17 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - } else if ((to_sym->info)._typ == 433 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { + } else if ((to_sym->info)._typ == 435 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { if (!v__checker__Checker_check_types(c, from_type, (*to_sym->info._v__ast__Alias).parent_type) && !(v__ast__TypeSymbol_is_int(final_to_sym) && (final_from_sym->kind == v__ast__Kind__enum_ || final_from_sym->kind == v__ast__Kind__bool || final_from_sym->kind == v__ast__Kind__i8 || final_from_sym->kind == v__ast__Kind__char))) { string ft = v__ast__Table_type_to_str(c->table, from_type); string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("` (alias to `"), /*115 &string*/0xfe10, {.d_s = final_to_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } - } else if (to_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(to_type) && !(/* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).is_typedef) { + } else if (to_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(to_type) && !(/* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_typedef) { if (from_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(from_type)) { v__checker__Checker_warn(c, _SLIT("casting to struct is deprecated, use e.g. `Struct{...expr}` instead"), node->pos); - v__ast__Struct from_type_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; - v__ast__Struct to_type_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct from_type_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; + v__ast__Struct to_type_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (!v__checker__Checker_check_struct_signature(c, from_type_info, to_type_info)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot convert struct `"), /*115 &string*/0xfe10, {.d_s = from_sym->name}}, {_SLIT("` to struct `"), /*115 &string*/0xfe10, {.d_s = to_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -54328,7 +52441,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE if (!v__ast__Type_is_ptr(from_type) && !v__ast__Type_is_pointer(from_type) && from_sym->kind != v__ast__Kind__interface_ && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->expr, true); } - if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ).is_generic) { + if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).is_generic) { v__ast__Type inferred_type = v__checker__Checker_resolve_generic_interface(c, from_type, to_type, node->pos); if (inferred_type != 0) { to_type = inferred_type; @@ -54408,7 +52521,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot cast function `"), /*115 &string*/0xfe10, {.d_s = fnexpr}}, {_SLIT("` to string"), 0, { .d_c = 0 }}})), node->pos); } else if (!v__ast__Type_alias_eq(to_type, _const_v__ast__string_type) && v__ast__Type_alias_eq(from_type, _const_v__ast__string_type) && (!(to_sym->kind == v__ast__Kind__alias && string__eq(final_to_sym->name, _SLIT("string"))))) { string error_msg = str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot cast a string to a type `"), /*115 &string*/0xfe10, {.d_s = final_to_sym->name}}, {_SLIT("`, that is not an alias of string"), 0, { .d_c = 0 }}})); - if ((node->expr)._typ == 292 /* v.ast.StringLiteral */) { + if ((node->expr)._typ == 294 /* v.ast.StringLiteral */) { if ((*node->expr._v__ast__StringLiteral).val.len == 1) { error_msg = /*f*/string__plus(error_msg, str_intp(3, _MOV((StrIntpData[]){{_SLIT(", for denoting characters use `"), /*115 &string*/0xfe10, {.d_s = (*node->expr._v__ast__StringLiteral).val}}, {_SLIT("` instead of '"), /*115 &string*/0xfe10, {.d_s = (*node->expr._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } @@ -54420,7 +52533,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__checker__Checker_expr(c, node->arg); } if (to_sym->kind == v__ast__Kind__enum_) { - if ((node->expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((node->expr)._typ == 275 /* v.ast.IntegerLiteral */) { string enum_typ_name = v__ast__Table_get_type_name(c->table, to_type); int node_val = string_int((*node->expr._v__ast__IntegerLiteral).val); v__ast__EnumDecl* _t4 = (v__ast__EnumDecl*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, c->table->enum_decls), &(string[]){to_sym->name})); @@ -54441,7 +52554,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE int enum_val = 0; for (int _t5 = 0; _t5 < enum_decl.fields.len; ++_t5) { v__ast__EnumField enum_field = ((v__ast__EnumField*)enum_decl.fields.data)[_t5]; - if ((enum_field.expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((enum_field.expr)._typ == 275 /* v.ast.IntegerLiteral */) { enum_val = string_int((*enum_field.expr._v__ast__IntegerLiteral).val); } if (node_val == enum_val) { @@ -54587,11 +52700,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no return _t3; } if (node->kind == v__ast__IdentKind__constant || node->kind == v__ast__IdentKind__global || node->kind == v__ast__IdentKind__variable) { - v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 378) /*expected idx: 378, name: v.ast.IdentVar */ ; + v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 380) /*expected idx: 380, name: v.ast.IdentVar */ ; v__ast__Type _t4 = info.typ; return _t4; } else if (node->kind == v__ast__IdentKind__function) { - v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 377) /*expected idx: 377, name: v.ast.IdentFn */ ; + v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 379) /*expected idx: 379, name: v.ast.IdentFn */ ; v__ast__Type _t5 = info.typ; return _t5; } else if (node->kind == v__ast__IdentKind__unresolved) { @@ -54601,14 +52714,14 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no _option_v__ast__ScopeObject _t6; if (_t6 = v__ast__Scope_find(node->scope, node->name), _t6.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; - if (obj._typ == 325 /* v.ast.GlobalField */) { + if (obj._typ == 327 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; return _t7; } - else if (obj._typ == 326 /* v.ast.Var */) { + else if (obj._typ == 328 /* v.ast.Var */) { int node_pos = (c->pref->is_vweb && !_IN_MAP(ADDR(string, node->name), ADDR(map, node->scope->objects)) && node->scope->start_pos < c->comptime_call_pos ? (c->comptime_call_pos) : (node->pos.pos)); if (node_pos < (*obj._v__ast__Var).pos.pos) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` (used before declaration)"), 0, { .d_c = 0 }}})), node->pos); @@ -54623,17 +52736,17 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } v__ast__Type typ = _t8; if (typ == 0) { - if (((*obj._v__ast__Var).expr)._typ == 268 /* v.ast.Ident */) { + if (((*obj._v__ast__Var).expr)._typ == 270 /* v.ast.Ident */) { if ((*(*obj._v__ast__Var).expr._v__ast__Ident).kind == v__ast__IdentKind__unresolved) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unresolved variable: `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t9 = _const_v__ast__void_type; return _t9; } } - if (((*obj._v__ast__Var).expr)._typ == 270 /* v.ast.IfGuardExpr */) { + if (((*obj._v__ast__Var).expr)._typ == 272 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len) { for (int vi = 0; vi < (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len; ++vi) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.data)[vi]; @@ -54643,7 +52756,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } } } else { - typ = v__ast__Type_clear_flag((*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); + typ = v__ast__Type_clear_flag(v__ast__Type_clear_flag((*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional), v__ast__TypeFlag__result); } } else { typ = v__checker__Checker_expr(c, (*obj._v__ast__Var).expr); @@ -54677,7 +52790,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no _option_v__ast__ScopeObject _t12; if (_t12 = v__ast__Scope_find(c->file->global_scope, name), _t12.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t12.data; - if (obj._typ == 324 /* v.ast.ConstField */) { + if (obj._typ == 326 /* v.ast.ConstField */) { if (!((*obj._v__ast__ConstField).is_pub || string__eq((*obj._v__ast__ConstField).mod, c->mod) || c->pref->is_test)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("constant `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); } @@ -54689,7 +52802,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no typ = v__checker__Checker_expr(c, (*obj._v__ast__ConstField).expr); c->inside_const = false; c->mod = old_c_mod; - if (((*obj._v__ast__ConstField).expr)._typ == 254 /* v.ast.CallExpr */) { + if (((*obj._v__ast__ConstField).expr)._typ == 256 /* v.ast.CallExpr */) { if ((*(*obj._v__ast__ConstField).expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { typ = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); } @@ -54767,7 +52880,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } if (!DenseArray_has_index(&_t21.key_values, _t22)) {continue;} v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t21.key_values, _t22)); - if ((so)._typ == 324 /* v.ast.ConstField */) { + if ((so)._typ == 326 /* v.ast.ConstField */) { if (string__eq((*so._v__ast__ConstField).mod, cname_mod)) { array_push((array*)&const_names_in_mod, _MOV((string[]){ string_clone((*so._v__ast__ConstField).name) })); } @@ -54812,7 +52925,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, cur_type); v__ast__Type to_type = (sym->kind == v__ast__Kind__interface_ ? (v__ast__Type_ref(to_type_)) : (to_type_)); v__ast__Expr expr = expr_; - if (expr._typ == 288 /* v.ast.SelectorExpr */) { + if (expr._typ == 290 /* v.ast.SelectorExpr */) { bool is_mut = false; Array_v__ast__Type smartcasts = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*expr._v__ast__SelectorExpr).expr_type); @@ -54854,12 +52967,12 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as c->smartcast_mut_pos = (*expr._v__ast__SelectorExpr).pos; } } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { bool is_mut = false; Array_v__ast__Type smartcasts = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool is_already_casted = false; int orig_type = 0; - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { is_mut = (*(*expr._v__ast__Ident).obj._v__ast__Var).is_mut; _PUSH_MANY(&smartcasts, ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts), _t7, Array_v__ast__Type); is_already_casted = (*(*expr._v__ast__Ident).obj._v__ast__Var).pos.pos == (*expr._v__ast__Ident).pos.pos; @@ -54906,15 +53019,15 @@ v__ast__Type v__checker__Checker_select_expr(v__checker__Checker* c, v__ast__Sel for (int _t1 = 0; _t1 < node->branches.len; ++_t1) { v__ast__SelectBranch branch = ((v__ast__SelectBranch*)node->branches.data)[_t1]; v__checker__Checker_stmt(c, branch.stmt); - if (branch.stmt._typ == 308 /* v.ast.ExprStmt */) { + if (branch.stmt._typ == 310 /* v.ast.ExprStmt */) { if (branch.is_timeout) { if (!v__ast__Type_is_int((*branch.stmt._v__ast__ExprStmt).typ)) { v__ast__TypeSymbol* tsym = v__ast__Table_sym(c->table, (*branch.stmt._v__ast__ExprStmt).typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid type `"), /*115 &string*/0xfe10, {.d_s = tsym->name}}, {_SLIT("` for timeout - expected integer number of nanoseconds aka `time.Duration`"), 0, { .d_c = 0 }}})), (*branch.stmt._v__ast__ExprStmt).pos); } } else { - if (((*branch.stmt._v__ast__ExprStmt).expr)._typ == 272 /* v.ast.InfixExpr */) { - if (((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 268 /* v.ast.Ident */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 288 /* v.ast.SelectorExpr */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 271 /* v.ast.IndexExpr */) { + if (((*branch.stmt._v__ast__ExprStmt).expr)._typ == 274 /* v.ast.InfixExpr */) { + if (((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 270 /* v.ast.Ident */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 290 /* v.ast.SelectorExpr */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 273 /* v.ast.IndexExpr */) { v__checker__Checker_error(c, _SLIT("channel in `select` key must be predefined"), v__ast__Expr_pos((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)); } } else { @@ -54922,10 +53035,10 @@ v__ast__Type v__checker__Checker_select_expr(v__checker__Checker* c, v__ast__Sel } } } - else if (branch.stmt._typ == 300 /* v.ast.AssignStmt */) { + else if (branch.stmt._typ == 302 /* v.ast.AssignStmt */) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)); - if (expr._typ == 285 /* v.ast.PrefixExpr */) { - if (((*expr._v__ast__PrefixExpr).right)._typ != 268 /* v.ast.Ident */ && ((*expr._v__ast__PrefixExpr).right)._typ != 288 /* v.ast.SelectorExpr */ && ((*expr._v__ast__PrefixExpr).right)._typ != 271 /* v.ast.IndexExpr */) { + if (expr._typ == 287 /* v.ast.PrefixExpr */) { + if (((*expr._v__ast__PrefixExpr).right)._typ != 270 /* v.ast.Ident */ && ((*expr._v__ast__PrefixExpr).right)._typ != 290 /* v.ast.SelectorExpr */ && ((*expr._v__ast__PrefixExpr).right)._typ != 273 /* v.ast.IndexExpr */) { v__checker__Checker_error(c, _SLIT("channel in `select` key must be predefined"), v__ast__Expr_pos((*expr._v__ast__PrefixExpr).right)); } if ((*expr._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent) { @@ -54961,7 +53074,7 @@ v__ast__Type v__checker__Checker_lock_expr(v__checker__Checker* c, v__ast__LockE v__ast__Type e_typ = v__checker__Checker_expr(c, (*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i))); string id_name = v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i))); if (!v__ast__Type_has_flag(e_typ, v__ast__TypeFlag__shared_f)) { - string obj_type = (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))._typ == 268 /* v.ast.Ident */ ? (_SLIT("variable")) : (_SLIT("struct element"))); + string obj_type = (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))._typ == 270 /* v.ast.Ident */ ? (_SLIT("variable")) : (_SLIT("struct element"))); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = id_name}}, {_SLIT("` must be declared as `shared` "), /*115 &string*/0xfe10, {.d_s = obj_type}}, {_SLIT(" to be locked"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))); } if (Array_string_contains(c->locked_names, id_name)) { @@ -54979,7 +53092,7 @@ v__ast__Type v__checker__Checker_lock_expr(v__checker__Checker* c, v__ast__LockE v__ast__Type ret_type = _const_v__ast__void_type; if (node->stmts.len > 0) { v__ast__Stmt last_stmt = (*(v__ast__Stmt*)array_last(node->stmts)); - if ((last_stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((last_stmt)._typ == 310 /* v.ast.ExprStmt */) { c->expected_type = expected_type; ret_type = v__checker__Checker_expr(c, (*last_stmt._v__ast__ExprStmt).expr); } @@ -55022,31 +53135,31 @@ VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_definition(v__chec VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_obj_definition(v__checker__Checker* c, v__ast__ScopeObject obj) { string name = _SLIT(""); - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { name = (*obj._v__ast__Var).name; } - else if (obj._typ == 324 /* v.ast.ConstField */) { + else if (obj._typ == 326 /* v.ast.ConstField */) { name = (*obj._v__ast__ConstField).name; } - else if (obj._typ == 325 /* v.ast.GlobalField */) { + else if (obj._typ == 327 /* v.ast.GlobalField */) { name = (*obj._v__ast__GlobalField).name; } - else if (obj._typ == 323 /* v.ast.AsmRegister */) { + else if (obj._typ == 325 /* v.ast.AsmRegister */) { name = (*obj._v__ast__AsmRegister).name; } ; v__ast__Expr expr = v__ast__empty_expr(); - if ((obj)._typ == 326 /* v.ast.Var */) { + if ((obj)._typ == 328 /* v.ast.Var */) { if ((*obj._v__ast__Var).is_mut) { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is mut and may have changed since its definition"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } expr = (*obj._v__ast__Var).expr; - } else if ((obj)._typ == 324 /* v.ast.ConstField */) { + } else if ((obj)._typ == 326 /* v.ast.ConstField */) { expr = (*obj._v__ast__ConstField).expr; } else { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is a global variable and is unknown at compile time"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { _option_v__ast__Expr _t3 = v__checker__Checker_find_definition(c, (*expr._v__ast__Ident)); return _t3; } @@ -55062,8 +53175,8 @@ VV_LOCAL_SYMBOL _option_bool v__checker__Checker_has_return(v__checker__Checker* bool has_complexity = false; for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt s = ((v__ast__Stmt*)stmts.data)[_t1]; - if ((s)._typ == 308 /* v.ast.ExprStmt */) { - if (((*s._v__ast__ExprStmt).expr)._typ == 269 /* v.ast.IfExpr */ || ((*s._v__ast__ExprStmt).expr)._typ == 278 /* v.ast.MatchExpr */) { + if ((s)._typ == 310 /* v.ast.ExprStmt */) { + if (((*s._v__ast__ExprStmt).expr)._typ == 271 /* v.ast.IfExpr */ || ((*s._v__ast__ExprStmt).expr)._typ == 280 /* v.ast.MatchExpr */) { has_complexity = true; break; } @@ -55088,16 +53201,16 @@ 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_95884 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_95884.arg0; + multi_return_string_v__token__Pos mr_96262 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_96262.arg0; } v__ast__Type _t1 = typ; return _t1; } void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr* node, bool as_interface) { - if (node->_typ == 268 /* v.ast.Ident */) { - if (((*node->_v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (node->_typ == 270 /* v.ast.Ident */) { + if (((*node->_v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Var* obj = &(*(*node->_v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t1 = v__ast__Scope_find_var(c->fn_scope, (*(*node->_v__ast__Ident).obj._v__ast__Var).name); @@ -55121,7 +53234,7 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } else { if (type_sym->kind == (v__ast__Kind__struct_)) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (!info.is_heap) { (*(*node->_v__ast__Ident).obj._v__ast__Var).is_auto_heap = true; } @@ -55134,12 +53247,12 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } } } - else if (node->_typ == 288 /* v.ast.SelectorExpr */) { + else if (node->_typ == 290 /* v.ast.SelectorExpr */) { if (!v__ast__Type_is_ptr((*node->_v__ast__SelectorExpr).expr_type)) { v__checker__Checker_mark_as_referenced(c, &(*node->_v__ast__SelectorExpr).expr, as_interface); } } - else if (node->_typ == 271 /* v.ast.IndexExpr */) { + else if (node->_typ == 273 /* v.ast.IndexExpr */) { v__checker__Checker_mark_as_referenced(c, &(*node->_v__ast__IndexExpr).left, as_interface); } @@ -55149,15 +53262,15 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } string v__checker__Checker_get_base_name(v__checker__Checker* c, v__ast__Expr* node) { - if (node->_typ == 268 /* v.ast.Ident */) { + if (node->_typ == 270 /* v.ast.Ident */) { string _t1 = (*node->_v__ast__Ident).name; return _t1; } - else if (node->_typ == 288 /* v.ast.SelectorExpr */) { + else if (node->_typ == 290 /* v.ast.SelectorExpr */) { string _t2 = v__checker__Checker_get_base_name(c, &(*node->_v__ast__SelectorExpr).expr); return _t2; } - else if (node->_typ == 271 /* v.ast.IndexExpr */) { + else if (node->_typ == 273 /* v.ast.IndexExpr */) { string _t3 = v__checker__Checker_get_base_name(c, &(*node->_v__ast__IndexExpr).left); return _t3; } @@ -55177,14 +53290,14 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre c->inside_ref_lit = old_inside_ref_lit; node->right_type = right_type; if (node->op == v__token__Kind__amp) { - if ((node->right)._typ == 285 /* v.ast.PrefixExpr */) { + if ((node->right)._typ == 287 /* v.ast.PrefixExpr */) { 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 == 288 /* v.ast.SelectorExpr */) { + } else if ((node->right)._typ == 290 /* v.ast.SelectorExpr */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); - if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 418) /*expected idx: 418, 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, 447) /*expected idx: 447, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ).uses_exprs))) { + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).uses_exprs))) { 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)); } } @@ -55192,19 +53305,19 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre if (node->op == v__token__Kind__amp && !v__ast__Type_is_ptr(right_type)) { v__ast__Expr expr = node->right; for (;;) { - if (!((expr)._typ == 283 /* v.ast.ParExpr */)) break; + if (!((expr)._typ == 285 /* v.ast.ParExpr */)) break; expr = (*expr._v__ast__ParExpr).expr; } - if ((expr)._typ == 252 /* v.ast.BoolLiteral */ || (expr)._typ == 254 /* v.ast.CallExpr */ || (expr)._typ == 257 /* v.ast.CharLiteral */ || (expr)._typ == 266 /* v.ast.FloatLiteral */ || (expr)._typ == 273 /* v.ast.IntegerLiteral */ || (expr)._typ == 272 /* v.ast.InfixExpr */ || (expr)._typ == 292 /* v.ast.StringLiteral */ || (expr)._typ == 291 /* v.ast.StringInterLiteral */) { + if ((expr)._typ == 254 /* v.ast.BoolLiteral */ || (expr)._typ == 256 /* v.ast.CallExpr */ || (expr)._typ == 259 /* v.ast.CharLiteral */ || (expr)._typ == 268 /* v.ast.FloatLiteral */ || (expr)._typ == 275 /* v.ast.IntegerLiteral */ || (expr)._typ == 274 /* v.ast.InfixExpr */ || (expr)._typ == 294 /* v.ast.StringLiteral */ || (expr)._typ == 293 /* v.ast.StringInterLiteral */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take the address of "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(expr)}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } - if ((node->right)._typ == 271 /* v.ast.IndexExpr */) { + if ((node->right)._typ == 273 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__IndexExpr).left_type); bool is_mut = false; - if (((*node->right._v__ast__IndexExpr).left)._typ == 268 /* v.ast.Ident */) { + if (((*node->right._v__ast__IndexExpr).left)._typ == 270 /* v.ast.Ident */) { v__ast__Ident ident = (*(*node->right._v__ast__IndexExpr).left._v__ast__Ident); v__ast__ScopeObject ident_obj = ident.obj; - if ((ident_obj)._typ == 326 /* v.ast.Var */) { + if ((ident_obj)._typ == 328 /* v.ast.Var */) { is_mut = (*ident_obj._v__ast__Var).is_mut; } } @@ -55222,7 +53335,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre } v__ast__Type _t1 = v__ast__Type_ref(right_type); return _t1; - } else if (node->op == v__token__Kind__amp && (node->right)._typ != 255 /* v.ast.CastExpr */) { + } else if (node->op == v__token__Kind__amp && (node->right)._typ != 257 /* v.ast.CastExpr */) { if (!c->inside_fn_arg && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->right, false); } @@ -55269,16 +53382,16 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) { v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type); if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) { - if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { + if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos); } - if ((index)._typ == 273 /* v.ast.IntegerLiteral */ && !is_gated) { + if ((index)._typ == 275 /* v.ast.IntegerLiteral */ && !is_gated) { if (string_at((*index._v__ast__IntegerLiteral).val, 0) == '-') { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative index `"), /*115 &string*/0xfe10, {.d_s = (*index._v__ast__IntegerLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } else if (typ_sym->kind == v__ast__Kind__array_fixed) { int i = string_int((*index._v__ast__IntegerLiteral).val); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; if ((!range_index && i >= info.size) || (range_index && i > info.size)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("index out of range (index: "), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT(", len: "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT(")"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } @@ -55301,7 +53414,7 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } else if (typ_sym->kind == (v__ast__Kind__array)) { node->is_array = true; - if (node->or_expr.kind != v__ast__OrKind__absent && (node->index)._typ == 286 /* v.ast.RangeExpr */) { + if (node->or_expr.kind != v__ast__OrKind__absent && (node->index)._typ == 288 /* v.ast.RangeExpr */) { v__checker__Checker_error(c, _SLIT("custom error handling on range expressions for arrays is not supported yet."), node->or_expr.pos); } } @@ -55325,19 +53438,19 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } if ((v__ast__Type_is_ptr(typ) && !v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f) && !v__ast__Expr_is_auto_deref_var(node->left)) || v__ast__Type_is_pointer(typ)) { bool is_ok = false; - if ((node->left)._typ == 268 /* v.ast.Ident */) { - if (((*node->left._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((node->left)._typ == 270 /* v.ast.Ident */) { + if (((*node->left._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { is_ok = (*(*node->left._v__ast__Ident).obj._v__ast__Var).is_mut && (*(*node->left._v__ast__Ident).obj._v__ast__Var).is_arg && !v__ast__Type_is_ptr(v__ast__Type_deref(typ)); } } - if (!is_ok && (node->index)._typ == 286 /* v.ast.RangeExpr */) { + if (!is_ok && (node->index)._typ == 288 /* v.ast.RangeExpr */) { string s = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("` does not support slicing"), 0, { .d_c = 0 }}})), node->pos); } else if (!c->inside_unsafe && !is_ok && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_warn(c, _SLIT("pointer indexing is only allowed in `unsafe` blocks"), node->pos); } } - if ((node->index)._typ == 286 /* v.ast.RangeExpr */) { + if ((node->index)._typ == 288 /* v.ast.RangeExpr */) { if ((*node->index._v__ast__RangeExpr).has_low) { v__ast__Type index_type = v__checker__Checker_expr(c, (*node->index._v__ast__RangeExpr).low); v__checker__Checker_check_index(c, typ_sym, (*node->index._v__ast__RangeExpr).low, index_type, node->pos, true, node->is_gated); @@ -55355,7 +53468,7 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } } else { if (typ_sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((typ_sym->info)._v__ast__Map,(typ_sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((typ_sym->info)._v__ast__Map,(typ_sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; c->expected_type = info.key_type; v__ast__Type index_type = v__checker__Checker_expr(c, node->index); if (!v__checker__Checker_check_types(c, index_type, info.key_type)) { @@ -55414,7 +53527,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, typ); if (typ_sym->kind == v__ast__Kind__array && node->enum_name.len == 0) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((typ_sym->info)._v__ast__Array,(typ_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((typ_sym->info)._v__ast__Array,(typ_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; typ = array_info.elem_type; typ_sym = v__ast__Table_sym(c->table, typ); } @@ -55424,7 +53537,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - if ((fsym->info)._typ != 447 /* v.ast.Enum */) { + if ((fsym->info)._typ != 449 /* v.ast.Enum */) { v__checker__Checker_error(c, _SLIT("not an enum"), node->pos); v__ast__Type _t6 = _const_v__ast__void_type; return _t6; @@ -55475,19 +53588,19 @@ v__ast__Type v__checker__Checker_offset_of(v__checker__Checker* c, v__ast__Offse void v__checker__Checker_check_dup_keys(v__checker__Checker* c, v__ast__MapInit* node, int i) { v__ast__Expr key_i = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, i)); - if ((key_i)._typ == 292 /* v.ast.StringLiteral */) { + if ((key_i)._typ == 294 /* v.ast.StringLiteral */) { for (int j = 0; j < i; ++j) { v__ast__Expr key_j = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, j)); - if ((key_j)._typ == 292 /* v.ast.StringLiteral */) { + if ((key_j)._typ == 294 /* v.ast.StringLiteral */) { if (string__eq((*key_i._v__ast__StringLiteral).val, (*key_j._v__ast__StringLiteral).val)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate key \""), /*115 &string*/0xfe10, {.d_s = (*key_i._v__ast__StringLiteral).val}}, {_SLIT("\" in map literal"), 0, { .d_c = 0 }}})), (*key_i._v__ast__StringLiteral).pos); } } } - } else if ((key_i)._typ == 273 /* v.ast.IntegerLiteral */) { + } else if ((key_i)._typ == 275 /* v.ast.IntegerLiteral */) { for (int j = 0; j < i; ++j) { v__ast__Expr key_j = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, j)); - if ((key_j)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((key_j)._typ == 275 /* v.ast.IntegerLiteral */) { if (string__eq((*key_i._v__ast__IntegerLiteral).val, (*key_j._v__ast__IntegerLiteral).val)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate key \""), /*115 &string*/0xfe10, {.d_s = (*key_i._v__ast__IntegerLiteral).val}}, {_SLIT("\" in map literal"), 0, { .d_c = 0 }}})), (*key_i._v__ast__IntegerLiteral).pos); } @@ -55675,10 +53788,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array: { - _option_void _t1 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type, pos); + _option_void _t1 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type, pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -55687,10 +53800,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array_fixed: { - _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type, pos); + _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type, pos); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -55699,11 +53812,11 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__map: { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; _option_void _t5 = v__checker__Checker_ensure_type_exists(c, info.key_type, pos); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -55711,7 +53824,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ _option_void _t7 = v__checker__Checker_ensure_type_exists(c, info.value_type, pos); if (_t7.state != 0 && _t7.err._typ != _IError_None___index) { _option_void _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -55720,13 +53833,13 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__sum_type: { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; for (int _t9 = 0; _t9 < info.concrete_types.len; ++_t9) { v__ast__Type concrete_typ = ((v__ast__Type*)info.concrete_types.data)[_t9]; _option_void _t10 = v__checker__Checker_ensure_type_exists(c, concrete_typ, pos); if (_t10.state != 0 && _t10.err._typ != _IError_None___index) { _option_void _t11; - memcpy(&_t11, &_t10, sizeof(Option)); + memcpy(&_t11, &_t10, sizeof(_option)); return _t11; } @@ -55777,7 +53890,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr expr, v__ast__Type typ, string what) { v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); - if (expr._typ == 268 /* v.ast.Ident */) { + if (expr._typ == 270 /* v.ast.Ident */) { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f)) { if (!Array_string_contains(c->rlocked_names, (*expr._v__ast__Ident).name) && !Array_string_contains(c->locked_names, (*expr._v__ast__Ident).name)) { string action = (string__eq(what, _SLIT("argument")) ? (_SLIT("passed")) : (_SLIT("used"))); @@ -55786,7 +53899,7 @@ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr } return; } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { pos = (*expr._v__ast__SelectorExpr).pos; if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f)) { string expr_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -55799,21 +53912,21 @@ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__SelectorExpr).expr, (*expr._v__ast__SelectorExpr).expr_type, what); } } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { pos = (*expr._v__ast__CallExpr).pos; if ((*expr._v__ast__CallExpr).is_method) { v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__CallExpr).left, (*expr._v__ast__CallExpr).left_type, what); } return; } - else if (expr._typ == 276 /* v.ast.LockExpr */) { + else if (expr._typ == 278 /* v.ast.LockExpr */) { return; } - else if (expr._typ == 271 /* v.ast.IndexExpr */) { + else if (expr._typ == 273 /* v.ast.IndexExpr */) { pos = v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__IndexExpr).left, (*expr._v__ast__IndexExpr).left_type, what); } - else if (expr._typ == 272 /* v.ast.InfixExpr */) { + else if (expr._typ == 274 /* v.ast.InfixExpr */) { pos = v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__InfixExpr).left), (*expr._v__ast__InfixExpr).pos); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__InfixExpr).left, (*expr._v__ast__InfixExpr).left_type, what); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__InfixExpr).right, (*expr._v__ast__InfixExpr).right_type, what); @@ -55874,7 +53987,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).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); @@ -55920,7 +54033,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check return _t17; } string method_name = _SLIT(""); - if ((v->expr)._typ == 292 /* v.ast.StringLiteral */) { + if ((v->expr)._typ == 294 /* v.ast.StringLiteral */) { method_name = (*v->expr._v__ast__StringLiteral).val; } else { v__checker__Checker_error(c, _SLIT("todo: not a string literal"), node->method_pos); @@ -55947,7 +54060,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_selector(v__checker__C if (!v__ast__Type_alias_eq(expr_type, _const_v__ast__string_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected `string` instead of `"), /*115 &string*/0xfe10, {.d_s = expr_sym->name}}, {_SLIT("` (e.g. `field.name`)"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->field_expr)); } - if ((node->field_expr)._typ == 288 /* v.ast.SelectorExpr */) { + if ((node->field_expr)._typ == 290 /* v.ast.SelectorExpr */) { v__token__Pos left_pos = v__ast__Expr_pos((*node->field_expr._v__ast__SelectorExpr).expr); if (c->comptime_fields_type.len == 0) { v__checker__Checker_error(c, _SLIT("compile time field access can only be used when iterating over `T.fields`"), left_pos); @@ -55973,7 +54086,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_comptime_for(v__checker__Checker* c, v_ } if (node.kind == v__ast__ComptimeForKind__fields) { if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; c->inside_comptime_for_field = true; for (int _t1 = 0; _t1 < sym_info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)sym_info.fields.data)[_t1]; @@ -55992,24 +54105,24 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com if (nlevel > 100) { return (_option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - if (expr._typ == 283 /* v.ast.ParExpr */) { + if (expr._typ == 285 /* v.ast.ParExpr */) { _option_v__ast__ComptTimeConstValue _t2 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__ParExpr).expr, nlevel + 1); return _t2; } - else if (expr._typ == 289 /* v.ast.SizeOf */) { + else if (expr._typ == 291 /* v.ast.SizeOf */) { multi_return_int_int mr_4820 = v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ); int s = mr_4820.arg0; _option_v__ast__ComptTimeConstValue _t3; opt_ok2(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(&s) }, (_option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); return _t3; } - else if (expr._typ == 266 /* v.ast.FloatLiteral */) { + else if (expr._typ == 268 /* v.ast.FloatLiteral */) { f64 x = string_f64((*expr._v__ast__FloatLiteral).val); _option_v__ast__ComptTimeConstValue _t4; opt_ok2(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (_option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); return _t4; } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { u64 x = string_u64((*expr._v__ast__IntegerLiteral).val); if (x > 9223372036854775807U) { _option_v__ast__ComptTimeConstValue _t5; @@ -56020,12 +54133,12 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com opt_ok2(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (_option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); return _t6; } - else if (expr._typ == 292 /* v.ast.StringLiteral */) { + else if (expr._typ == 294 /* v.ast.StringLiteral */) { _option_v__ast__ComptTimeConstValue _t7; opt_ok2(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (_option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); return _t7; } - else if (expr._typ == 257 /* v.ast.CharLiteral */) { + else if (expr._typ == 259 /* v.ast.CharLiteral */) { Array_rune runes = string_runes((*expr._v__ast__CharLiteral).val); if (runes.len > 0) { _option_v__ast__ComptTimeConstValue _t8; @@ -56034,13 +54147,13 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com } return (_option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - else if (expr._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 324 /* v.ast.ConstField */) { + else if (expr._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.ConstField */) { _option_v__ast__ComptTimeConstValue _t10 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); return _t10; } } - else if (expr._typ == 255 /* v.ast.CastExpr */) { + else if (expr._typ == 257 /* v.ast.CastExpr */) { _option_v__ast__ComptTimeConstValue _t11 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); if (_t11.state != 0) { /*or block*/ IError err = _t11.err; @@ -56159,11 +54272,11 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com return _t40; } } - else if (expr._typ == 272 /* v.ast.InfixExpr */) { + else if (expr._typ == 274 /* v.ast.InfixExpr */) { _option_v__ast__ComptTimeConstValue _t43 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); if (_t43.state != 0) { /*or block*/ _option_v__ast__ComptTimeConstValue _t44; - memcpy(&_t44, &_t43, sizeof(Option)); + memcpy(&_t44, &_t43, sizeof(_option)); return _t44; } @@ -56171,7 +54284,7 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com _option_v__ast__ComptTimeConstValue _t45 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); if (_t45.state != 0) { /*or block*/ _option_v__ast__ComptTimeConstValue _t46; - memcpy(&_t46, &_t45, sizeof(Option)); + memcpy(&_t46, &_t45, sizeof(_option)); return _t46; } @@ -57210,7 +55323,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ bool _t1 = node->ct_skip; return _t1; } - if ((node->ct_expr)._typ == 268 /* v.ast.Ident */) { + if ((node->ct_expr)._typ == 270 /* v.ast.Ident */) { if (node->ct_opt) { if (Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, (*node->ct_expr._v__ast__Ident).name)) { v__checker__Checker_error(c, _SLIT("optional `[if expression ?]` tags, can be used only for user defined identifiers"), node->pos); @@ -57247,15 +55360,15 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ } 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 == 252 /* v.ast.BoolLiteral */) { + if (cond._typ == 254 /* v.ast.BoolLiteral */) { v__checker__ComptimeBranchSkipState _t1 = ((*cond._v__ast__BoolLiteral).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t1; } - else if (cond._typ == 283 /* v.ast.ParExpr */) { + else if (cond._typ == 285 /* v.ast.ParExpr */) { v__checker__ComptimeBranchSkipState _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); return _t2; } - else if (cond._typ == 285 /* v.ast.PrefixExpr */) { + else if (cond._typ == 287 /* 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); } @@ -57263,17 +55376,17 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 == 284 /* v.ast.PostfixExpr */) { + else if (cond._typ == 286 /* 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 == 268 /* v.ast.Ident */) { + } else if (((*cond._v__ast__PostfixExpr).expr)._typ == 270 /* v.ast.Ident */) { 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); } } - else if (cond._typ == 272 /* v.ast.InfixExpr */) { + else if (cond._typ == 274 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and)) { v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); @@ -57296,19 +55409,19 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 == 294 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 294 /* v.ast.TypeNode */) { + if (((*cond._v__ast__InfixExpr).left)._typ == 296 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*cond._v__ast__InfixExpr).right._v__ast__TypeNode).typ); if (sym->kind != v__ast__Kind__interface_) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); } v__checker__ComptimeBranchSkipState _t9 = v__checker__ComptimeBranchSkipState__unknown; return _t9; - } else if (((*cond._v__ast__InfixExpr).left)._typ == 294 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 261 /* 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, 294) /*expected idx: 294, name: v.ast.TypeNode */ ; + } else if (((*cond._v__ast__InfixExpr).left)._typ == 296 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 263 /* 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, 296) /*expected idx: 296, name: v.ast.TypeNode */ ; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, left.typ); 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 == 288 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 294 /* v.ast.TypeNode */) { + } else if (((*cond._v__ast__InfixExpr).left)._typ == 290 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 296 /* v.ast.TypeNode */) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); v__checker__ComptimeBranchSkipState _t11 = v__checker__ComptimeBranchSkipState__unknown; return _t11; @@ -57317,8 +55430,8 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime } } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__eq) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__ne)) { - if (((*cond._v__ast__InfixExpr).left)._typ == 288 /* v.ast.SelectorExpr */ && ((*cond._v__ast__InfixExpr).right)._typ == 273 /* v.ast.IntegerLiteral */) { - } else if (((*cond._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */) { + if (((*cond._v__ast__InfixExpr).left)._typ == 290 /* v.ast.SelectorExpr */ && ((*cond._v__ast__InfixExpr).right)._typ == 275 /* v.ast.IntegerLiteral */) { + } else if (((*cond._v__ast__InfixExpr).left)._typ == 270 /* 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 _t12 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); @@ -57346,7 +55459,7 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__InfixExpr).pos); }; } - else if (cond._typ == 268 /* v.ast.Ident */) { + else if (cond._typ == 270 /* 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_equal = true; @@ -57464,7 +55577,7 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 != 326 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 324 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 325 /* v.ast.GlobalField */) { + if (((*cond._v__ast__Ident).obj)._typ != 328 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 326 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 327 /* 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); } @@ -57484,11 +55597,11 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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); } - v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 252) /*expected idx: 252, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 254) /*expected idx: 254, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t44; } } - else if (cond._typ == 259 /* v.ast.ComptimeCall */) { + else if (cond._typ == 261 /* v.ast.ComptimeCall */) { if ((*cond._v__ast__ComptimeCall).is_pkgconfig) { _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*/ @@ -57526,7 +55639,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra if (node->elem_type != 0) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, node->elem_type); if (elem_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct elem_info = /* as */ *(v__ast__Struct*)__as_cast((elem_sym->info)._v__ast__Struct,(elem_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct elem_info = /* as */ *(v__ast__Struct*)__as_cast((elem_sym->info)._v__ast__Struct,(elem_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (elem_info.generic_types.len > 0 && elem_info.concrete_types.len == 0 && !v__ast__Type_has_flag(node->elem_type, v__ast__TypeFlag__generic)) { if (c->table->cur_concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic struct must specify type parameter, e.g. Foo"), node->elem_type_pos); @@ -57599,7 +55712,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } v__ast__Array array_info = v__ast__TypeSymbol_array_info(type_sym); node->elem_type = array_info.elem_type; - v__ast__Type _t6 = v__ast__Type_clear_flag(c->expected_type, v__ast__TypeFlag__optional); + v__ast__Type _t6 = v__ast__Type_clear_flag((v__ast__Type_has_flag(c->expected_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(v__ast__Type_clear_flag(c->expected_type, v__ast__TypeFlag__shared_f))) : (c->expected_type)), v__ast__TypeFlag__optional); return _t6; } if (node->exprs.len > 0 && v__ast__Type_alias_eq(node->elem_type, _const_v__ast__void_type)) { @@ -57659,7 +55772,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra c->expected_type = elem_type; continue; } - if ((expr)->_typ != 294 /* v.ast.TypeNode */) { + if ((expr)->_typ != 296 /* v.ast.TypeNode */) { if (v__ast__Table_type_kind(c->table, elem_type) == v__ast__Kind__interface_) { if (v__checker__Checker_type_implements(c, typ, elem_type, v__ast__Expr_pos(/*rec*/*expr))) { continue; @@ -57695,11 +55808,11 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra i64 fixed_size = ((i64)(0)); v__ast__Expr init_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, 0)); v__checker__Checker_expr(c, init_expr); - if (init_expr._typ == 273 /* v.ast.IntegerLiteral */) { + if (init_expr._typ == 275 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*init_expr._v__ast__IntegerLiteral).val); } - else if (init_expr._typ == 268 /* v.ast.Ident */) { - if (((*init_expr._v__ast__Ident).obj)._typ == 324 /* v.ast.ConstField */) { + else if (init_expr._typ == 270 /* v.ast.Ident */) { + if (((*init_expr._v__ast__Ident).obj)._typ == 326 /* v.ast.ConstField */) { _option_v__ast__ComptTimeConstValue _t9; if (_t9 = v__checker__Checker_eval_comptime_const_expr(c, (*(*init_expr._v__ast__Ident).obj._v__ast__ConstField).expr, 0), _t9.state == 0) { v__ast__ComptTimeConstValue comptime_value = *(v__ast__ComptTimeConstValue*)_t9.data; @@ -57715,7 +55828,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-constant array bound `"), /*115 &string*/0xfe10, {.d_s = (*init_expr._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*init_expr._v__ast__Ident).pos); } } - else if (init_expr._typ == 272 /* v.ast.InfixExpr */) { + else if (init_expr._typ == 274 /* v.ast.InfixExpr */) { _option_v__ast__ComptTimeConstValue _t11; if (_t11 = v__checker__Checker_eval_comptime_const_expr(c, init_expr, 0), _t11.state == 0) { v__ast__ComptTimeConstValue comptime_value = *(v__ast__ComptTimeConstValue*)_t11.data; @@ -57789,7 +55902,7 @@ v__ast__Type v__checker__Checker_map_init(v__checker__Checker* c, v__ast__MapIni if (info.value_type != 0) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(c->table, info.value_type); if (val_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct val_info = /* as */ *(v__ast__Struct*)__as_cast((val_sym->info)._v__ast__Struct,(val_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct val_info = /* as */ *(v__ast__Struct*)__as_cast((val_sym->info)._v__ast__Struct,(val_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (val_info.generic_types.len > 0 && val_info.concrete_types.len == 0 && !v__ast__Type_has_flag(info.value_type, v__ast__TypeFlag__generic)) { if (c->table->cur_concrete_types.len == 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("generic struct `"), /*115 &string*/0xfe10, {.d_s = val_sym->name}}, {_SLIT("` must specify type parameter, e.g. Foo"), 0, { .d_c = 0 }}})), node->pos); @@ -57946,14 +56059,14 @@ v__ast__Scope* prev_fn_scope; } if (node->generic_names.len > 0) { v__ast__TypeSymbol* gs = v__ast__Table_sym(c->table, node->return_type); - if ((gs->info)._typ == 418 /* v.ast.Struct */) { + if ((gs->info)._typ == 420 /* v.ast.Struct */) { if ((*gs->info._v__ast__Struct).is_generic && !v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, _SLIT("return generic struct in fn declaration must specify the generic type names, e.g. Foo"), node->return_type_pos); } } } v__ast__TypeSymbol* return_sym = v__ast__Table_final_sym(c->table, node->return_type); - if ((return_sym->info)._typ == 444 /* v.ast.MultiReturn */) { + if ((return_sym->info)._typ == 446 /* v.ast.MultiReturn */) { for (int _t4 = 0; _t4 < (*return_sym->info._v__ast__MultiReturn).types.len; ++_t4) { v__ast__Type multi_type = ((v__ast__Type*)(*return_sym->info._v__ast__MultiReturn).types.data)[_t4]; v__ast__TypeSymbol* multi_sym = v__ast__Table_sym(c->table, multi_type); @@ -58004,13 +56117,13 @@ v__ast__Scope* prev_fn_scope; return; } if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - if ((sym->info)._typ == 436 /* v.ast.Interface */) { + if ((sym->info)._typ == 438 /* v.ast.Interface */) { if (v__ast__Interface_has_method(&(*sym->info._v__ast__Interface), node->name)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` cannot implement its own interface method `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } } - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { _option_v__ast__StructField _t6; if (_t6 = v__ast__Table_find_field(c->table, sym, node->name), _t6.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t6.data; @@ -58069,7 +56182,7 @@ v__ast__Scope* prev_fn_scope; if (!v__ast__Type_is_ptr(param->typ)) { v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, param->typ); if (arg_typ_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (info.is_heap) { _option_v__ast__Var_ptr _t9 = v__ast__Scope_find_var(node->scope, param->name); if (_t9.state != 0) { /*or block*/ @@ -58084,12 +56197,12 @@ v__ast__Scope* prev_fn_scope; v__checker__Checker_error(c, _SLIT("generic struct in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__interface_) { - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic interface in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic sumtype in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } @@ -58166,7 +56279,7 @@ v__ast__Scope* prev_fn_scope; if (!c->pref->is_test) { for (int _t11 = 0; _t11 < node->stmts.len; ++_t11) { v__ast__Stmt st = ((v__ast__Stmt*)node->stmts.data)[_t11]; - if ((st)._typ == 299 /* v.ast.AssertStmt */) { + if ((st)._typ == 301 /* v.ast.AssertStmt */) { v__checker__Checker_warn(c, _SLIT("tests will not be run, because filename does not end with `_test.v`"), node->pos); break; } @@ -58181,13 +56294,13 @@ v__ast__Scope* prev_fn_scope; } c->expected_type = _const_v__ast__void_type; c->table->cur_fn = node; - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__optional) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 319 /* v.ast.Return */)) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__optional) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 321 /* v.ast.Return */)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->return_type); if (sym->kind == v__ast__Kind__void) { array_push((array*)&node->stmts, _MOV((v__ast__Stmt[]){ v__ast__Return_to_sumtype_v__ast__Stmt(ADDR(v__ast__Return, (((v__ast__Return){.pos = node->pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),})))) })); } } - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__result) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 319 /* v.ast.Return */)) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__result) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 321 /* v.ast.Return */)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->return_type); if (sym->kind == v__ast__Kind__void) { array_push((array*)&node->stmts, _MOV((v__ast__Stmt[]){ v__ast__Return_to_sumtype_v__ast__Stmt(ADDR(v__ast__Return, (((v__ast__Return){.pos = node->pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),})))) })); @@ -58291,12 +56404,12 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE if (!v__ast__Type_alias_eq(arg.typ, _const_v__ast__string_type)) { continue; } - if ((arg.expr)._typ == 268 /* v.ast.Ident */ || (arg.expr)._typ == 292 /* v.ast.StringLiteral */ || (arg.expr)._typ == 288 /* v.ast.SelectorExpr */) { + if ((arg.expr)._typ == 270 /* v.ast.Ident */ || (arg.expr)._typ == 294 /* v.ast.StringLiteral */ || (arg.expr)._typ == 290 /* v.ast.SelectorExpr */) { continue; } (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).is_tmp_autofree = true; } - if (v__ast__Type_alias_eq(node->receiver_type, _const_v__ast__string_type) && !((node->left)._typ == 268 /* v.ast.Ident */ || (node->left)._typ == 292 /* v.ast.StringLiteral */ || (node->left)._typ == 288 /* v.ast.SelectorExpr */)) { + if (v__ast__Type_alias_eq(node->receiver_type, _const_v__ast__string_type) && !((node->left)._typ == 270 /* v.ast.Ident */ || (node->left)._typ == 294 /* v.ast.StringLiteral */ || (node->left)._typ == 290 /* v.ast.SelectorExpr */)) { node->free_receiver = true; } } @@ -58360,7 +56473,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp return _t5; } c->table->cur_fn->has_await = true; - if (tsym->info._typ == 418 /* v.ast.Struct */) { + if (tsym->info._typ == 420 /* v.ast.Struct */) { v__ast__Type ret_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*tsym->info._v__ast__Struct).concrete_types, 0)); ret_type = v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional); node->return_type = ret_type; @@ -58383,11 +56496,11 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp return _t8; } v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr; - if ((expr)._typ == 294 /* v.ast.TypeNode */) { + if ((expr)._typ == 296 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, (*expr._v__ast__TypeNode).typ)); if (v__ast__Table_known_type(c->table, sym->name) && sym->kind != v__ast__Kind__placeholder) { v__ast__Kind kind = sym->kind; - if ((sym->info)._typ == 433 /* v.ast.Alias */) { + if ((sym->info)._typ == 435 /* v.ast.Alias */) { kind = v__ast__Table_sym(c->table, (*sym->info._v__ast__Alias).parent_type)->kind; } if (!(kind == v__ast__Kind__struct_ || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__map || kind == v__ast__Kind__array)) { @@ -58407,7 +56520,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (!v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 1)).typ, _const_v__ast__string_type)) { v__checker__Checker_error(c, _SLIT("json.decode: second argument needs to be a string"), node->pos); } - v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast((expr)._v__ast__TypeNode,(expr)._typ, 294) /*expected idx: 294, name: v.ast.TypeNode */ ; + v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast((expr)._v__ast__TypeNode,(expr)._typ, 296) /*expected idx: 296, name: v.ast.TypeNode */ ; v__ast__Type ret_type = v__ast__Type_set_flag(typ.typ, v__ast__TypeFlag__optional); node->return_type = ret_type; v__ast__Type _t10 = ret_type; @@ -58416,12 +56529,12 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp 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 == 246 /* v.ast.AnonFn */) { + if ((node->left)._typ == 248 /* v.ast.AnonFn */) { node->name = _SLIT(""); v__checker__Checker_expr(c, node->left); if (!v__ast__Type_alias_eq((*node->left._v__ast__AnonFn).typ, ((v__ast__Type)(0)))) { v__ast__TypeSymbol* anon_fn_sym = v__ast__Table_sym(c->table, (*node->left._v__ast__AnonFn).typ); - func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; found = true; } } @@ -58436,54 +56549,48 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp (*(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 == 271 /* v.ast.IndexExpr */) { + if (!found && (node->left)._typ == 273 /* v.ast.IndexExpr */) { v__checker__Checker_expr(c, node->left); - v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); - if ((sym->info)._typ == 413 /* v.ast.Array */) { + v__ast__TypeSymbol* sym = v__ast__Table_final_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); + if ((sym->info)._typ == 415 /* v.ast.Array */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Array).elem_type); - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { - node->return_type = (*elem_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t12 = (*elem_sym->info._v__ast__FnType).func.return_type; - return _t12; + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + func = (*elem_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the element of the array, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 414 /* v.ast.Map */) { + } else if ((sym->info)._typ == 416 /* v.ast.Map */) { v__ast__TypeSymbol* value_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Map).value_type); - if ((value_sym->info)._typ == 445 /* v.ast.FnType */) { - node->return_type = (*value_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t13 = (*value_sym->info._v__ast__FnType).func.return_type; - return _t13; + if ((value_sym->info)._typ == 447 /* v.ast.FnType */) { + func = (*value_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the value of the map, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 441 /* v.ast.ArrayFixed */) { + } else if ((sym->info)._typ == 443 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__ArrayFixed).elem_type); - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { - node->return_type = (*elem_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t14 = (*elem_sym->info._v__ast__FnType).func.return_type; - return _t14; + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { + func = (*elem_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the element of the array, it is not a function"), node->pos); } } - found = true; - v__ast__Type _t15 = _const_v__ast__string_type; - return _t15; } - if (!found && (node->left)._typ == 254 /* v.ast.CallExpr */) { + if (!found && (node->left)._typ == 256 /* v.ast.CallExpr */) { v__checker__Checker_expr(c, node->left); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__CallExpr).return_type); - if ((sym->info)._typ == 445 /* v.ast.FnType */) { + if ((sym->info)._typ == 447 /* v.ast.FnType */) { node->return_type = (*sym->info._v__ast__FnType).func.return_type; found = true; func = (*sym->info._v__ast__FnType).func; } } if (!found) { - _option_v__ast__Fn _t16; - if (_t16 = v__ast__Table_find_fn(c->table, fn_name), _t16.state == 0) { - v__ast__Fn f = *(v__ast__Fn*)_t16.data; + _option_v__ast__Fn _t12; + if (_t12 = v__ast__Table_find_fn(c->table, fn_name), _t12.state == 0) { + v__ast__Fn f = *(v__ast__Fn*)_t12.data; found = true; func = f; (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,} })).usages++; @@ -58500,9 +56607,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } if (!found && c->pref->is_vsh) { string os_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("os."), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT0, 0, { .d_c = 0 }}})); - _option_v__ast__Fn _t17; - if (_t17 = v__ast__Table_find_fn(c->table, os_name), _t17.state == 0) { - v__ast__Fn f = *(v__ast__Fn*)_t17.data; + _option_v__ast__Fn _t13; + if (_t13 = v__ast__Table_find_fn(c->table, os_name), _t13.state == 0) { + v__ast__Fn f = *(v__ast__Fn*)_t13.data; if (f.generic_names.len == node->concrete_types.len) { string node_alias_name = v__ast__CallExpr_fkey(node); map_set(&c->table->fn_generic_types, &(string[]){os_name}, &(Array_Array_v__ast__Type[]) { (*(Array_Array_v__ast__Type*)map_get(ADDR(map, c->table->fn_generic_types), &(string[]){node_alias_name}, &(Array_Array_v__ast__Type[]){ __new_array(0, 0, sizeof(Array_v__ast__Type)) })) }); @@ -58514,27 +56621,27 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } if (is_native_builtin) { - v__ast__Type _t18 = _const_v__ast__void_type; - return _t18; + v__ast__Type _t14 = _const_v__ast__void_type; + return _t14; } if (!found) { int typ = 0; - _option_v__ast__ScopeObject _t19; - if (_t19 = v__ast__Scope_find(node->scope, node->name), _t19.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t19.data; - if (obj._typ == 325 /* v.ast.GlobalField */) { + _option_v__ast__ScopeObject _t15; + if (_t15 = v__ast__Scope_find(node->scope, node->name), _t15.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t15.data; + if (obj._typ == 327 /* v.ast.GlobalField */) { typ = (*obj._v__ast__GlobalField).typ; node->is_fn_var = true; node->fn_var_type = typ; } - else if (obj._typ == 326 /* v.ast.Var */) { - v__ast__Type _t20; /* if prepend */ + else if (obj._typ == 328 /* v.ast.Var */) { + v__ast__Type _t16; /* if prepend */ if ((*obj._v__ast__Var).smartcasts.len != 0) { - _t20 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); + _t16 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); } else { - _t20 = (*obj._v__ast__Var).typ; + _t16 = (*obj._v__ast__Var).typ; } - typ = _t20; + typ = _t16; node->is_fn_var = true; node->fn_var_type = typ; } @@ -58546,14 +56653,14 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (typ != 0) { v__ast__TypeSymbol* generic_vts = v__ast__Table_final_sym(c->table, typ); if (generic_vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; } else { v__ast__TypeSymbol* vts = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; @@ -58562,52 +56669,52 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } if (!found) { - _option_v__ast__ScopeObject _t21; - if (_t21 = v__ast__Scope_find(c->file->global_scope, fn_name), _t21.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t21.data; + _option_v__ast__ScopeObject _t17; + if (_t17 = v__ast__Scope_find(c->file->global_scope, fn_name), _t17.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t17.data; if ((*(obj.typ)) != 0) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(obj.typ))); if (sym->kind == v__ast__Kind__function) { found = true; - func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ).func; } } } } if (!found) { *continue_check = false; - _option_int _t22; - if (_t22 = string_index(fn_name, _SLIT(".")), _t22.state == 0) { - int dot_index = *(int*)_t22.data; + _option_int _t18; + if (_t18 = string_index(fn_name, _SLIT(".")), _t18.state == 0) { + int dot_index = *(int*)_t18.data; if (!u8_is_capital(string_at(fn_name, 0))) { string mod_name = string_substr_ni(fn_name, 0, dot_index); Array_string mod_func_names = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_v__ast__Fn _t23 = c->table->fns; - int _t25 = _t23.key_values.len; - for (int _t24 = 0; _t24 < _t25; ++_t24 ) { - int _t26 = _t23.key_values.len - _t25; - _t25 = _t23.key_values.len; - if (_t26 < 0) { - _t24 = -1; + Map_string_v__ast__Fn _t19 = c->table->fns; + int _t21 = _t19.key_values.len; + for (int _t20 = 0; _t20 < _t21; ++_t20 ) { + int _t22 = _t19.key_values.len - _t21; + _t21 = _t19.key_values.len; + if (_t22 < 0) { + _t20 = -1; continue; } - if (!DenseArray_has_index(&_t23.key_values, _t24)) {continue;} - string ctfnk = /*key*/ *(string*)DenseArray_key(&_t23.key_values, _t24); + if (!DenseArray_has_index(&_t19.key_values, _t20)) {continue;} + string ctfnk = /*key*/ *(string*)DenseArray_key(&_t19.key_values, _t20); ctfnk = string_clone(ctfnk); - v__ast__Fn ctfnv = (*(v__ast__Fn*)DenseArray_value(&_t23.key_values, _t24)); + v__ast__Fn ctfnv = (*(v__ast__Fn*)DenseArray_value(&_t19.key_values, _t20)); if (ctfnv.is_pub && string_starts_with(ctfnk, mod_name)) { array_push((array*)&mod_func_names, _MOV((string[]){ string_clone(ctfnk) })); } } v__util__Suggestion suggestion = v__util__new_suggestion(fn_name, mod_func_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown function: "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT(" "), 0, { .d_c = 0 }}}))), node->pos); - v__ast__Type _t28 = _const_v__ast__void_type; - return _t28; + v__ast__Type _t24 = _const_v__ast__void_type; + return _t24; } } v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown function: "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t29 = _const_v__ast__void_type; - return _t29; + v__ast__Type _t25 = _const_v__ast__void_type; + return _t25; } node->is_noreturn = func.is_noreturn; node->is_ctor_new = func.is_ctor_new; @@ -58633,29 +56740,29 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp string plural = (func.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s"))); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = func.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos); } - for (int _t30 = 0; _t30 < node->concrete_types.len; ++_t30) { - v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t30]; - _option_void _t31 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); - if (_t31.state != 0 && _t31.err._typ != _IError_None___index) { - IError err = _t31.err; + for (int _t26 = 0; _t26 < node->concrete_types.len; ++_t26) { + v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t26]; + _option_void _t27 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); + if (_t27.state != 0 && _t27.err._typ != _IError_None___index) { + IError err = _t27.err; } ; } if (func.generic_names.len > 0 && node->args.len == 0 && node->concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("no argument generic function must add concrete types, e.g. foo()"), node->pos); - v__ast__Type _t32 = func.return_type; - return _t32; + v__ast__Type _t28 = func.return_type; + return _t28; } if (v__ast__Type_alias_eq(func.return_type, _const_v__ast__void_type) && func.is_conditional && func.ctdefine_idx != _const_v__ast__invalid_type_idx) { node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(func.attrs, func.ctdefine_idx))); } if (node->language != v__ast__Language__js) { - _option_void _t33 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/func); - if (_t33.state != 0 && _t33.err._typ != _IError_None___index) { - IError err = _t33.err; - v__ast__Type _t34 = func.return_type; - return _t34; + _option_void _t29 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/func); + if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { + IError err = _t29.err; + v__ast__Type _t30 = func.return_type; + return _t30; } ; @@ -58674,8 +56781,8 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_fail_if_unreadable(c, arg.expr, arg.typ, _SLIT("argument to print")); c->inside_println_arg = false; node->return_type = _const_v__ast__void_type; - v__ast__Type _t35 = func.return_type; - return _t35; + v__ast__Type _t31 = func.return_type; + return _t31; } if (node->args.len == 1 && string__eq(fn_name, _SLIT("error"))) { v__ast__CallArg arg = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)); @@ -58684,12 +56791,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_warn(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`error("), /*115 &v.ast.CallArg*/0xfe10, {.d_s = v__ast__CallArg_str(arg)}}, {_SLIT(")` can be shortened to just `"), /*115 &v.ast.CallArg*/0xfe10, {.d_s = v__ast__CallArg_str(arg)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } - if (node->expected_arg_types.len == 0) { - for (int _t36 = 0; _t36 < func.params.len; ++_t36) { - v__ast__Param param = ((v__ast__Param*)func.params.data)[_t36]; - array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ param.typ })); - } - } + v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/func); if (!v__pref__Backend_is_js(c->pref->backend) && node->args.len > 0 && func.params.len == 0) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("too many arguments in call to `"), /*115 &string*/0xfe10, {.d_s = func.name}}, {_SLIT("` (non-js backend: "), /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(c->pref->backend)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), node->pos); } @@ -58699,25 +56801,25 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } v__ast__Param param = (func.is_variadic && i >= func.params.len - 1 ? ((*(v__ast__Param*)/*ee elem_sym */array_get(func.params, func.params.len - 1))) : ((*(v__ast__Param*)/*ee elem_sym */array_get(func.params, i)))); - if (func.is_variadic && (call_arg->expr)._typ == 247 /* v.ast.ArrayDecompose */) { + if (func.is_variadic && (call_arg->expr)._typ == 249 /* v.ast.ArrayDecompose */) { if (i > func.params.len - 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("too many arguments in call to `"), /*115 &string*/0xfe10, {.d_s = func.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } c->expected_type = param.typ; v__ast__TypeSymbol* e_sym = v__ast__Table_sym(c->table, c->expected_type); - if ((call_arg->expr)._typ == 277 /* v.ast.MapInit */ && e_sym->kind == v__ast__Kind__struct_) { + if ((call_arg->expr)._typ == 279 /* v.ast.MapInit */ && e_sym->kind == v__ast__Kind__struct_) { v__checker__Checker_error(c, _SLIT("cannot initialize a struct with a map"), call_arg->pos); continue; - } else if ((call_arg->expr)._typ == 293 /* v.ast.StructInit */ && e_sym->kind == v__ast__Kind__map) { + } else if ((call_arg->expr)._typ == 295 /* v.ast.StructInit */ && e_sym->kind == v__ast__Kind__map) { v__checker__Checker_error(c, _SLIT("cannot initialize a map with a struct"), call_arg->pos); continue; } v__ast__Type arg_typ = v__checker__Checker_check_expr_opt_call(c, call_arg->expr, v__checker__Checker_expr(c, call_arg->expr)); (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).typ = arg_typ; if (c->inside_comptime_for_field) { - if ((call_arg->expr)._typ == 268 /* v.ast.Ident */) { - if (((*call_arg->expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((call_arg->expr)._typ == 270 /* v.ast.Ident */) { + if (((*call_arg->expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).typ = (*(*call_arg->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -58732,9 +56834,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_error(c, _SLIT("function with `shared` arguments cannot be called inside `lock`/`rlock` block"), call_arg->pos); } if (call_arg->is_mut) { - multi_return_string_v__token__Pos mr_29230 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_29230.arg0; - v__token__Pos pos = mr_29230.arg1; + multi_return_string_v__token__Pos mr_28912 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_28912.arg0; + v__token__Pos pos = mr_28912.arg1; if (!v__ast__Expr_is_lvalue(call_arg->expr)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(call_arg->expr)); } @@ -58759,7 +56861,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } v__ast__TypeSymbol* final_param_sym = param_typ_sym; v__ast__Type final_param_typ = param.typ; - if (func.is_variadic && (param_typ_sym->info)._typ == 413 /* v.ast.Array */) { + if (func.is_variadic && (param_typ_sym->info)._typ == 415 /* v.ast.Array */) { final_param_typ = (*param_typ_sym->info._v__ast__Array).elem_type; final_param_sym = v__ast__Table_sym(c->table, final_param_typ); } @@ -58774,19 +56876,16 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } - _option_void _t38 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); - if (_t38.state != 0 && _t38.err._typ != _IError_None___index) { - IError err = _t38.err; - if (arg_typ_sym->kind == v__ast__Kind__void && param_typ_sym->kind == v__ast__Kind__string) { - continue; - } + _option_void _t32 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); + if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { + IError err = _t32.err; if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { continue; } if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) { - v__ast__Array param_info = /* as */ *(v__ast__Array*)__as_cast((param_typ_sym->info)._v__ast__Array,(param_typ_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array param_info = /* as */ *(v__ast__Array*)__as_cast((param_typ_sym->info)._v__ast__Array,(param_typ_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type param_elem_type = v__ast__Table_unaliased_type(c->table, param_info.elem_type); - v__ast__Array arg_info = /* as */ *(v__ast__Array*)__as_cast((arg_typ_sym->info)._v__ast__Array,(arg_typ_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array arg_info = /* as */ *(v__ast__Array*)__as_cast((arg_typ_sym->info)._v__ast__Array,(arg_typ_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type arg_elem_type = v__ast__Table_unaliased_type(c->table, arg_info.elem_type); if (v__ast__Type_nr_muls(param.typ) == v__ast__Type_nr_muls(arg_typ) && param_info.nr_dims == arg_info.nr_dims && v__ast__Type_alias_eq(param_elem_type, arg_elem_type)) { continue; @@ -58825,11 +56924,11 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } if (arg_typ_sym_->kind == v__ast__Kind__array && param_typ_sym_->kind == v__ast__Kind__array) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((arg_typ_sym_->info)._v__ast__Array,(arg_typ_sym_->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((param_typ_sym_->info)._v__ast__Array,(param_typ_sym_->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((arg_typ_sym_->info)._v__ast__Array,(arg_typ_sym_->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((param_typ_sym_->info)._v__ast__Array,(param_typ_sym_->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type)) { continue; } } else if (arg_typ_sym_->kind == v__ast__Kind__array_fixed && param_typ_sym_->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ).elem_type)) { continue; } } @@ -58860,9 +56959,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp c->expected_type = param.typ; v__ast__Type typ = v__checker__Checker_check_expr_opt_call(c, call_arg->expr, v__checker__Checker_expr(c, call_arg->expr)); if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && func.generic_names.len == node->concrete_types.len) { - _option_v__ast__Type _t39; - if (_t39 = v__ast__Table_resolve_generic_to_concrete(c->table, param.typ, func.generic_names, concrete_types), _t39.state == 0) { - v__ast__Type unwrap_typ = *(v__ast__Type*)_t39.data; + _option_v__ast__Type _t33; + if (_t33 = v__ast__Table_resolve_generic_to_concrete(c->table, param.typ, func.generic_names, concrete_types), _t33.state == 0) { + v__ast__Type unwrap_typ = *(v__ast__Type*)_t33.data; v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* unwrap_sym = v__ast__Table_sym(c->table, unwrap_typ); if (unwrap_sym->kind == v__ast__Kind__interface_) { @@ -58873,9 +56972,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } - _option_void _t40 = v__checker__Checker_check_expected_call_arg(c, utyp, unwrap_typ, node->language, *call_arg); - if (_t40.state != 0 && _t40.err._typ != _IError_None___index) { - IError err = _t40.err; + _option_void _t34 = v__checker__Checker_check_expected_call_arg(c, utyp, unwrap_typ, node->language, *call_arg); + if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { + IError err = _t34.err; if (c->comptime_fields_type.len > 0) { continue; } @@ -58894,38 +56993,38 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->return_type = func.return_type; } if (node->concrete_types.len > 0 && func.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { - _option_v__ast__Type _t41; - if (_t41 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t41.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t41.data; + _option_v__ast__Type _t35; + if (_t35 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t35.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t35.data; node->return_type = typ; - v__ast__Type _t42 = typ; - return _t42; + v__ast__Type _t36 = typ; + return _t36; } } if (node->concrete_types.len > 0 && func.generic_names.len == 0) { v__checker__Checker_error(c, _SLIT("a non generic function called like a generic one"), node->concrete_list_pos); } if (func.generic_names.len > 0) { - _option_v__ast__Type _t43; + _option_v__ast__Type _t37; if (has_generic) { - _option_v__ast__Type _t44; - if (_t44 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, node->concrete_types), _t44.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t44.data; + _option_v__ast__Type _t38; + if (_t38 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, node->concrete_types), _t38.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t38.data; if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { node->return_type = typ; } } - v__ast__Type _t45 = node->return_type; - return _t45; - } else if (_t43 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t43.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t43.data; + v__ast__Type _t39 = node->return_type; + return _t39; + } else if (_t37 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t37.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t37.data; node->return_type = typ; - v__ast__Type _t46 = typ; - return _t46; + v__ast__Type _t40 = typ; + return _t40; } } - v__ast__Type _t47 = func.return_type; - return _t47; + v__ast__Type _t41 = func.return_type; + return _t41; } v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__CallExpr* node) { @@ -58979,7 +57078,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); return _t8; } else { - v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); return _t9; } @@ -59004,19 +57103,19 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal return _t12; } } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Expr arg_expr = (string__eq(method_name, _SLIT("insert")) ? ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 1)).expr) : ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)); v__ast__Type arg_type = v__checker__Checker_expr(c, arg_expr); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); if (!v__checker__Checker_check_types(c, arg_type, info.elem_type) && !v__checker__Checker_check_types(c, left_type, arg_type)) { v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("cannot "), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = arg_sym->name}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg_expr)); } - } else if ((final_left_sym->info)._typ == 413 /* v.ast.Array */ && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { + } else if ((final_left_sym->info)._typ == 415 /* v.ast.Array */ && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { node->return_type = (*final_left_sym->info._v__ast__Array).elem_type; v__ast__Type _t13 = node->return_type; return _t13; } else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -59026,7 +57125,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t14 = node->return_type; return _t14; } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { - v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.Thread */ ; + v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.Thread */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -59050,11 +57149,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal IError err = _t17.err; if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) { v__ast__Type parent_type = _const_v__ast__void_type; - if ((left_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((left_sym->info)._typ == 420 /* v.ast.Struct */) { parent_type = (*left_sym->info._v__ast__Struct).parent_type; - } else if ((left_sym->info)._typ == 437 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 439 /* v.ast.SumType */) { parent_type = (*left_sym->info._v__ast__SumType).parent_type; - } else if ((left_sym->info)._typ == 436 /* v.ast.Interface */) { + } else if ((left_sym->info)._typ == 438 /* v.ast.Interface */) { parent_type = (*left_sym->info._v__ast__Interface).parent_type; } if (parent_type != 0) { @@ -59081,9 +57180,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_43470 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_43470.arg0; - embed_types = mr_43470.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_42752 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_42752.arg0; + embed_types = mr_42752.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -59097,7 +57196,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, node->left_type); bool rec_is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic); Array_v__ast__Type rec_concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); - if ((rec_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((rec_sym->info)._typ == 420 /* v.ast.Struct */) { rec_concrete_types = array_clone_to_depth(&(*rec_sym->info._v__ast__Struct).concrete_types, 0); if (rec_is_generic && node->concrete_types.len == 0 && method.generic_names.len == (*rec_sym->info._v__ast__Struct).generic_types.len) { node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types; @@ -59131,9 +57230,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); } if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { - multi_return_string_v__token__Pos mr_45780 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45780.arg0; - v__token__Pos pos = mr_45780.arg1; + multi_return_string_v__token__Pos mr_45062 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_45062.arg0; + v__token__Pos pos = mr_45062.arg1; if (!v__ast__Expr_is_lvalue(node->left)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); } @@ -59173,7 +57272,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type exp_arg_typ = ((v__ast__Type)(0)); bool param_is_mut = false; bool no_type_promotion = false; - if ((left_sym->info)._typ == 442 /* v.ast.Chan */) { + if ((left_sym->info)._typ == 444 /* v.ast.Chan */) { if (string__eq(method_name, _SLIT("try_push"))) { exp_arg_typ = v__ast__Type_ref((*left_sym->info._v__ast__Chan).elem_type); } else if (string__eq(method_name, _SLIT("try_pop"))) { @@ -59203,7 +57302,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } v__ast__TypeSymbol* final_arg_sym = exp_arg_sym; v__ast__Type final_arg_typ = exp_arg_typ; - if (method.is_variadic && (exp_arg_sym->info)._typ == 413 /* v.ast.Array */) { + if (method.is_variadic && (exp_arg_sym->info)._typ == 415 /* v.ast.Array */) { final_arg_typ = (*exp_arg_sym->info._v__ast__Array).elem_type; final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ); } @@ -59241,9 +57340,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); } if (arg->is_mut) { - multi_return_string_v__token__Pos mr_49682 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_49682.arg0; - v__token__Pos pos = mr_49682.arg1; + multi_return_string_v__token__Pos mr_48964 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_48964.arg0; + v__token__Pos pos = mr_48964.arg1; if (!param_is_mut) { string tok = v__ast__ShareType_str(arg->share); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); @@ -59263,11 +57362,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_fail_if_unreadable(c, arg->expr, got_arg_typ, _SLIT("argument")); } } - if ((left_sym->info)._typ == 413 /* v.ast.Array */ && string__eq(method_name, _SLIT("sort_with_compare"))) { + if ((left_sym->info)._typ == 415 /* v.ast.Array */ && string__eq(method_name, _SLIT("sort_with_compare"))) { v__ast__Type elem_typ = (*left_sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg->typ); if (arg_sym->kind == v__ast__Kind__function) { - v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; if (func_info.func.params.len == 2) { if (v__ast__Type_nr_muls((*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ) != v__ast__Type_nr_muls(elem_typ) + 1) { string arg_typ_str = v__ast__Table_type_to_str(c->table, (*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ); @@ -59298,16 +57397,14 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal IError err = _t31.err; v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ); v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ); - if ((param_typ_sym->info)._typ == 413 /* v.ast.Array */ && (arg_typ_sym->info)._typ == 413 /* v.ast.Array */) { + if ((param_typ_sym->info)._typ == 415 /* v.ast.Array */ && (arg_typ_sym->info)._typ == 415 /* v.ast.Array */) { v__ast__Type param_elem_type = v__ast__Table_unaliased_type(c->table, (*param_typ_sym->info._v__ast__Array).elem_type); v__ast__Type arg_elem_type = v__ast__Table_unaliased_type(c->table, (*arg_typ_sym->info._v__ast__Array).elem_type); if (v__ast__Type_nr_muls(exp_arg_typ) == v__ast__Type_nr_muls(got_arg_typ) && (*param_typ_sym->info._v__ast__Array).nr_dims == (*arg_typ_sym->info._v__ast__Array).nr_dims && v__ast__Type_alias_eq(param_elem_type, arg_elem_type)) { continue; } } - if (!v__ast__Type_alias_eq(got_arg_typ, _const_v__ast__void_type)) { - v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); - } + v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); ; } @@ -59319,11 +57416,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (!c->table->cur_fn->is_deprecated && method.is_deprecated) { v__checker__Checker_deprecate_fnmethod(c, _SLIT("method"), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})), method, *node); } - if (node->expected_arg_types.len == 0) { - for (int i = 1; i < method.params.len; ++i) { - array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, i)).typ })); - } - } + v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/method); if (is_method_from_embed) { node->receiver_type = v__ast__Type_derive((*(v__ast__Type*)array_last(node->from_embed_types)), (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).typ); } else if (is_generic) { @@ -59345,12 +57438,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal node->return_type = method.return_type; } if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { - _option_v__ast__Type _t33; - if (_t33 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t33.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t33.data; + _option_v__ast__Type _t32; + if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t32.data; node->return_type = typ; - v__ast__Type _t34 = typ; - return _t34; + v__ast__Type _t33 = typ; + return _t33; } } if (node->concrete_types.len > 0 && method.generic_names.len == 0) { @@ -59358,17 +57451,17 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } if (method.generic_names.len > 0) { if (!v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic)) { - if ((left_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((left_sym->info)._typ == 420 /* v.ast.Struct */) { if (method.generic_names.len == (*left_sym->info._v__ast__Struct).concrete_types.len) { node->concrete_types = (*left_sym->info._v__ast__Struct).concrete_types; } } } - v__ast__Type _t35 = node->return_type; - return _t35; + v__ast__Type _t34 = node->return_type; + return _t34; } - v__ast__Type _t36 = method.return_type; - return _t36; + v__ast__Type _t35 = method.return_type; + return _t35; } if (string__eq(method_name, _SLIT("str"))) { if (left_sym->kind == v__ast__Kind__interface_) { @@ -59381,25 +57474,25 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos); } v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver")); - v__ast__Type _t37 = _const_v__ast__string_type; - return _t37; + v__ast__Type _t36 = _const_v__ast__string_type; + return _t36; } else if (string__eq(method_name, _SLIT("free"))) { - v__ast__Type _t38 = _const_v__ast__void_type; - return _t38; + v__ast__Type _t37 = _const_v__ast__void_type; + return _t37; } - _option_v__ast__StructField _t39; - if (_t39 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t39.state == 0) { - v__ast__StructField field = *(v__ast__StructField*)_t39.data; + _option_v__ast__StructField _t38; + if (_t38 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t38.state == 0) { + v__ast__StructField field = *(v__ast__StructField*)_t38.data; v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ)); if (field_sym->kind == v__ast__Kind__function) { node->is_method = false; node->is_field = true; - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; - _option_void _t40 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); - if (_t40.state != 0 && _t40.err._typ != _IError_None___index) { - IError err = _t40.err; - v__ast__Type _t41 = info.func.return_type; - return _t41; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; + _option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); + if (_t39.state != 0 && _t39.err._typ != _IError_None___index) { + IError err = _t39.err; + v__ast__Type _t40 = info.func.return_type; + return _t40; } ; @@ -59412,9 +57505,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ })); if (i < info.func.params.len) { v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ; - _option_void _t43 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); - if (_t43.state != 0 && _t43.err._typ != _IError_None___index) { - IError err = _t43.err; + _option_void _t42 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); + if (_t42.state != 0 && _t42.err._typ != _IError_None___index) { + IError err = _t42.err; if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) { v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); } @@ -59426,35 +57519,35 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } node->expected_arg_types = earg_types; node->is_method = true; - _option_multi_return_v__ast__StructField_Array_v__ast__Type _t44 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); - if (_t44.state != 0) { /*or block*/ - IError err = _t44.err; - v__ast__Type _t45 = info.func.return_type; - return _t45; + _option_multi_return_v__ast__StructField_Array_v__ast__Type _t43 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); + if (_t43.state != 0) { /*or block*/ + IError err = _t43.err; + v__ast__Type _t44 = info.func.return_type; + return _t44; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_57048 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t44.data); - node->from_embed_types = mr_57048.arg1; - v__ast__Type _t46 = info.func.return_type; - return _t46; + multi_return_v__ast__StructField_Array_v__ast__Type mr_56127 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_56127.arg1; + v__ast__Type _t45 = info.func.return_type; + return _t45; } } if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) { - Array_string _t47 = {0}; - Array_v__ast__Fn _t47_orig = left_sym->methods; - int _t47_len = _t47_orig.len; - _t47 = __new_array(0, _t47_len, sizeof(string)); + Array_string _t46 = {0}; + Array_v__ast__Fn _t46_orig = left_sym->methods; + int _t46_len = _t46_orig.len; + _t46 = __new_array(0, _t46_len, sizeof(string)); - for (int _t48 = 0; _t48 < _t47_len; ++_t48) { - v__ast__Fn it = ((v__ast__Fn*) _t47_orig.data)[_t48]; + for (int _t47 = 0; _t47 < _t46_len; ++_t47) { + v__ast__Fn it = ((v__ast__Fn*) _t46_orig.data)[_t47]; string ti = it.name; - array_push((array*)&_t47, &ti); + array_push((array*)&_t46, &ti); } - v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t47); + v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t46); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos); } - v__ast__Type _t49 = _const_v__ast__void_type; - return _t49; + v__ast__Type _t48 = _const_v__ast__void_type; + return _t48; } VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) { @@ -59481,6 +57574,15 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, return 0; } +VV_LOCAL_SYMBOL void v__checker__Checker_set_node_expected_arg_types(v__checker__Checker* c, v__ast__CallExpr* node, v__ast__Fn* func) { + if (node->expected_arg_types.len == 0) { + int start_idx = (func->is_method ? (1) : (0)); + for (int i = start_idx; i < func->params.len; ++i) { + array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ (*(v__ast__Param*)/*ee elem_sym */array_get(func->params, i)).typ })); + } + } +} + VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* c, string kind, string name, v__ast__Fn the_fn, v__ast__CallExpr node) { string deprecation_message = _SLIT(""); time__Time now = time__now(); @@ -59579,7 +57681,7 @@ _option_void v__checker__Checker_check_expected_arg_count(v__checker__Checker* c if (min_required_params == nr_args + 1) { v__ast__Type last_typ = (*(v__ast__Param*)array_last(f->params)).typ; v__ast__TypeSymbol* last_sym = v__ast__Table_sym(c->table, last_typ); - if ((last_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((last_sym->info)._typ == 420 /* v.ast.Struct */) { Array_v__ast__Attr _t1 = {0}; Array_v__ast__Attr _t1_orig = (*last_sym->info._v__ast__Struct).attrs; int _t1_len = _t1_orig.len; @@ -59615,7 +57717,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke } v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, elem_typ); v__ast__Expr arg_expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (arg_expr._typ == 246 /* v.ast.AnonFn */) { + if (arg_expr._typ == 248 /* v.ast.AnonFn */) { if ((*arg_expr._v__ast__AnonFn).decl.params.len > 1) { v__checker__Checker_error(c, _SLIT("function needs exactly 1 argument"), (*arg_expr._v__ast__AnonFn).decl.pos); } else if (is_map && (v__ast__Type_alias_eq((*arg_expr._v__ast__AnonFn).decl.return_type, _const_v__ast__void_type) || !v__ast__Type_alias_eq((*(v__ast__Param*)/*ee elem_sym */array_get((*arg_expr._v__ast__AnonFn).decl.params, 0)).typ, elem_typ))) { @@ -59624,7 +57726,7 @@ 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, should use `fn(a "), /*115 &string*/0xfe10, {.d_s = elem_sym->name}}, {_SLIT(") bool {...}`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__AnonFn).decl.pos); } } - else if (arg_expr._typ == 268 /* v.ast.Ident */) { + else if (arg_expr._typ == 270 /* v.ast.Ident */) { if ((*arg_expr._v__ast__Ident).kind == v__ast__IdentKind__function) { _option_v__ast__Fn _t1 = v__ast__Table_find_fn(c->table, (*arg_expr._v__ast__Ident).name); if (_t1.state != 0) { /*or block*/ @@ -59642,9 +57744,9 @@ 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, should use `fn(a "), /*115 &string*/0xfe10, {.d_s = elem_sym->name}}, {_SLIT(") bool {...}`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__Ident).pos); } } else if ((*arg_expr._v__ast__Ident).kind == v__ast__IdentKind__variable) { - if (((*arg_expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (((*arg_expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Expr expr = (*(*arg_expr._v__ast__Ident).obj._v__ast__Var).expr; - if ((expr)._typ == 246 /* v.ast.AnonFn */) { + if ((expr)._typ == 248 /* v.ast.AnonFn */) { if ((*expr._v__ast__AnonFn).decl.params.len > 1) { v__checker__Checker_error(c, _SLIT("function needs exactly 1 argument"), (*expr._v__ast__AnonFn).decl.pos); } else if (is_map && (v__ast__Type_alias_eq((*expr._v__ast__AnonFn).decl.return_type, _const_v__ast__void_type) || !v__ast__Type_alias_eq((*(v__ast__Param*)/*ee elem_sym */array_get((*expr._v__ast__AnonFn).decl.params, 0)).typ, elem_typ))) { @@ -59660,7 +57762,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke } } } - else if (arg_expr._typ == 254 /* v.ast.CallExpr */) { + else if (arg_expr._typ == 256 /* v.ast.CallExpr */) { if (is_map && (v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, _const_v__ast__void_type) || v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, 0))) { 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("` does not return anything"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__CallExpr).pos); } else if (!is_map && !v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, _const_v__ast__bool_type)) { @@ -59670,12 +57772,12 @@ 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 == 292 /* v.ast.StringLiteral */) { + else if (arg_expr._typ == 294 /* 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 == 291 /* v.ast.StringInterLiteral */) { + else if (arg_expr._typ == 293 /* 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); } @@ -59708,7 +57810,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_map_builtin_method_call(v__chec if (node->args.len != 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("()` does not have any arguments"), 0, { .d_c = 0 }}})), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; int typ = (string__eq(method_name, _SLIT("keys")) ? (v__ast__Table_find_or_register_array(c->table, info.key_type)) : (v__ast__Table_find_or_register_array(c->table, info.value_type))); ret_type = ((typ)); } @@ -59717,7 +57819,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_map_builtin_method_call(v__chec if (node->args.len != 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected 1 argument, but got "), /*100 &int*/0xfe07, {.d_i32 = node->args.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr); _option_void _t1 = v__checker__Checker_check_expected_call_arg(c, arg_type, info.key_type, node->language, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0))); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -59742,12 +57844,12 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("slice")) && !c->is_builtin_mod) { v__checker__Checker_error(c, _SLIT(".slice() is a private method, use `x[start..end]` instead"), node->pos); } - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left_sym.info)._v__ast__Array,(left_sym.info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left_sym.info)._v__ast__Array,(left_sym.info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; elem_typ = array_info.elem_type; if (string__eq(method_name, _SLIT("filter")) || string__eq(method_name, _SLIT("map")) || string__eq(method_name, _SLIT("any")) || string__eq(method_name, _SLIT("all"))) { v__checker__scope_register_it(node->scope, node->pos, elem_typ); } else if (string__eq(method_name, _SLIT("sort"))) { - if ((node->left)._typ == 254 /* v.ast.CallExpr */) { + if ((node->left)._typ == 256 /* v.ast.CallExpr */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the `sort()` method can be called only on mutable receivers, but `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(node->left)}}, {_SLIT("` is a call expression"), 0, { .d_c = 0 }}})), node->pos); } v__checker__Checker_fail_if_immutable(c, node->left); @@ -59755,7 +57857,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (node->args.len > 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected 0 or 1 argument, but got "), /*100 &int*/0xfe07, {.d_i32 = node->args.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } else if (node->args.len == 1) { - if (((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)._typ == 272 /* v.ast.InfixExpr */) { + if (((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)._typ == 274 /* v.ast.InfixExpr */) { if (!((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).op == v__token__Kind__gt || (*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).op == v__token__Kind__lt)) { v__checker__Checker_error(c, _SLIT("`.sort()` can only use `<` or `>` comparison"), node->pos); } @@ -59766,7 +57868,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch } else if (left_name == right_name) { v__checker__Checker_error(c, _SLIT("`.sort()` cannot use same argument"), node->pos); } - if ((((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 268 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 288 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 271 /* v.ast.IndexExpr */) || (((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 268 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 288 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 271 /* v.ast.IndexExpr */)) { + if ((((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 270 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 290 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 273 /* v.ast.IndexExpr */) || (((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 270 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 290 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 273 /* v.ast.IndexExpr */)) { v__checker__Checker_error(c, _SLIT("`.sort()` can only use ident, index or selector as argument, \ne.g. `arr.sort(a < b)`, `arr.sort(a.id < b.id)`, `arr.sort(a[0] < b[0])`"), node->pos); } } else { @@ -59798,7 +57900,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("map"))) { v__checker__Checker_check_map_and_filter(c, true, elem_typ, *node); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); - v__ast__Type ret_type = ((arg_sym->info._typ == 445 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); + v__ast__Type ret_type = ((arg_sym->info._typ == 447 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); node->return_type = v__ast__Table_find_or_register_array(c->table, v__checker__Checker_unwrap_generic(c, ret_type)); if (v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__shared_f)) { node->return_type = v__ast__Type_deref(v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__shared_f)); @@ -59893,10 +57995,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__a } v__checker__Checker_expr(c, node.cond); if (node.has_inc) { - if ((node.inc)._typ == 300 /* v.ast.AssignStmt */) { + if ((node.inc)._typ == 302 /* v.ast.AssignStmt */) { for (int _t1 = 0; _t1 < (*node.inc._v__ast__AssignStmt).right.len; ++_t1) { v__ast__Expr right = ((v__ast__Expr*)(*node.inc._v__ast__AssignStmt).right.data)[_t1]; - if ((right)._typ == 254 /* v.ast.CallExpr */) { + if ((right)._typ == 256 /* v.ast.CallExpr */) { if ((*right._v__ast__CallExpr).or_block.stmts.len > 0) { v__checker__Checker_error(c, _SLIT("optionals are not allowed in `for statement increment` (yet)"), (*right._v__ast__CallExpr).pos); } @@ -59998,29 +58100,29 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_in_stmt(v__checker__Checker* c, v__ } if (node->val_is_mut) { value_type = v__ast__Type_ref(value_type); - if (node->cond._typ == 268 /* v.ast.Ident */) { - if (((*node->cond._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (node->cond._typ == 270 /* v.ast.Ident */) { + if (((*node->cond._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if (!(*(*node->cond._v__ast__Ident).obj._v__ast__Var).is_mut) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*(*node->cond._v__ast__Ident).obj._v__ast__Var).name}}, {_SLIT("` is immutable, it cannot be changed"), 0, { .d_c = 0 }}})), (*node->cond._v__ast__Ident).pos); } } } - else if (node->cond._typ == 248 /* v.ast.ArrayInit */) { + else if (node->cond._typ == 250 /* v.ast.ArrayInit */) { v__checker__Checker_error(c, _SLIT("array literal is immutable, it cannot be changed"), (*node->cond._v__ast__ArrayInit).pos); } - else if (node->cond._typ == 277 /* v.ast.MapInit */) { + else if (node->cond._typ == 279 /* v.ast.MapInit */) { v__checker__Checker_error(c, _SLIT("map literal is immutable, it cannot be changed"), (*node->cond._v__ast__MapInit).pos); } - else if (node->cond._typ == 288 /* v.ast.SelectorExpr */) { + else if (node->cond._typ == 290 /* v.ast.SelectorExpr */) { _option_v__ast__Ident _t2 = v__ast__SelectorExpr_root_ident(&(*node->cond._v__ast__SelectorExpr)); if (_t2.state != 0) { /*or block*/ IError err = _t2.err; - *(v__ast__Ident*) _t2.data = /* as */ *(v__ast__Ident*)__as_cast(((*node->cond._v__ast__SelectorExpr).expr)._v__ast__Ident,((*node->cond._v__ast__SelectorExpr).expr)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ; + *(v__ast__Ident*) _t2.data = /* as */ *(v__ast__Ident*)__as_cast(((*node->cond._v__ast__SelectorExpr).expr)._v__ast__Ident,((*node->cond._v__ast__SelectorExpr).expr)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ; } v__ast__Ident root_ident = (*(v__ast__Ident*)_t2.data); if (root_ident.kind != v__ast__IdentKind__unresolved) { - if (!(/* as */ *(v__ast__Var*)__as_cast((root_ident.obj)._v__ast__Var,(root_ident.obj)._typ, 326) /*expected idx: 326, name: v.ast.Var */ ).is_mut) { + if (!(/* as */ *(v__ast__Var*)__as_cast((root_ident.obj)._v__ast__Var,(root_ident.obj)._typ, 328) /*expected idx: 328, name: v.ast.Var */ ).is_mut) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = (*node->cond._v__ast__SelectorExpr).field_name}}, {_SLIT("` is immutable, it cannot be changed"), 0, { .d_c = 0 }}})), (*node->cond._v__ast__SelectorExpr).pos); } } @@ -60050,9 +58152,9 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_stmt(v__checker__Checker* c, v__ast if (!node->is_inf && v__ast__Type_idx(typ) != _const_v__ast__bool_type_idx && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("non-bool used as for condition"), node->pos); } - if ((node->cond)._typ == 272 /* v.ast.InfixExpr */) { + if ((node->cond)._typ == 274 /* v.ast.InfixExpr */) { if ((*node->cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { - if (((*node->cond._v__ast__InfixExpr).right)._typ == 294 /* v.ast.TypeNode */ && (((*node->cond._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */ || ((*node->cond._v__ast__InfixExpr).left)._typ == 288 /* v.ast.SelectorExpr */)) { + if (((*node->cond._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */ && (((*node->cond._v__ast__InfixExpr).left)._typ == 270 /* v.ast.Ident */ || ((*node->cond._v__ast__InfixExpr).left)._typ == 290 /* v.ast.SelectorExpr */)) { if (v__ast__Table_type_kind(c->table, (*node->cond._v__ast__InfixExpr).left_type) == v__ast__Kind__sum_type || v__ast__Table_type_kind(c->table, (*node->cond._v__ast__InfixExpr).left_type) == v__ast__Kind__interface_) { v__checker__Checker_smartcast(c, (*node->cond._v__ast__InfixExpr).left, (*node->cond._v__ast__InfixExpr).left_type, (*node->cond._v__ast__InfixExpr).right_type, node->scope); } @@ -60074,7 +58176,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool node_is_expr = false; if (node->branches.len > 0 && node->has_else) { Array_v__ast__Stmt stmts = (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, 0)).stmts; - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 308 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 310 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { node_is_expr = true; } } @@ -60095,7 +58197,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool is_comptime_type_is_expr = false; for (int i = 0; i < node->branches.len; ++i) { v__ast__IfBranch branch = (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)); - if ((branch.cond)._typ == 283 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { + if ((branch.cond)._typ == 285 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("unnecessary `()` in `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT("` condition, use `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT(" expr {` instead of `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT(" (expr) {`."), 0, { .d_c = 0 }}})), branch.pos); } if (!node->has_else || i < node->branches.len - 1) { @@ -60112,9 +58214,9 @@ bool v__checker__Checker_if_expr_defer_0 = false; } if (node->is_comptime) { string comptime_field_name = _SLIT(""); - if ((branch.cond)._typ == 272 /* v.ast.InfixExpr */) { + if ((branch.cond)._typ == 274 /* v.ast.InfixExpr */) { if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { - if (((*branch.cond._v__ast__InfixExpr).right)._typ != 294 /* v.ast.TypeNode */ && ((*branch.cond._v__ast__InfixExpr).right)._typ != 261 /* v.ast.ComptimeType */) { + if (((*branch.cond._v__ast__InfixExpr).right)._typ != 296 /* v.ast.TypeNode */ && ((*branch.cond._v__ast__InfixExpr).right)._typ != 263 /* v.ast.ComptimeType */) { v__checker__Checker_error(c, _SLIT("invalid `$if` condition: expected a type"), v__ast__Expr_pos((*branch.cond._v__ast__InfixExpr).right)); v__ast__Type _t1 = 0; // Defer begin @@ -60125,25 +58227,25 @@ bool v__checker__Checker_if_expr_defer_0 = false; return _t1; } v__ast__Expr left = (*branch.cond._v__ast__InfixExpr).left; - if (((*branch.cond._v__ast__InfixExpr).right)._typ == 261 /* v.ast.ComptimeType */ && (left)._typ == 294 /* v.ast.TypeNode */) { + if (((*branch.cond._v__ast__InfixExpr).right)._typ == 263 /* v.ast.ComptimeType */ && (left)._typ == 296 /* 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); - 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, 261) /*expected idx: 261, name: v.ast.ComptimeType */ ) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + 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, 263) /*expected idx: 263, 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, 294) /*expected idx: 294, name: v.ast.TypeNode */ ).typ); + 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, 296) /*expected idx: 296, name: v.ast.TypeNode */ ).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got_type); if (sym->kind == v__ast__Kind__placeholder || v__ast__Type_has_flag(got_type, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*branch.cond._v__ast__InfixExpr).right)); } - if ((left)._typ == 288 /* v.ast.SelectorExpr */) { + if ((left)._typ == 290 /* v.ast.SelectorExpr */) { comptime_field_name = v__ast__Expr_str((*left._v__ast__SelectorExpr).expr); map_set(&c->comptime_fields_type, &(string[]){comptime_field_name}, &(v__ast__Type[]) { got_type }); is_comptime_type_is_expr = true; - } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 294 /* v.ast.TypeNode */ && (left)._typ == 294 /* v.ast.TypeNode */ && sym->kind == v__ast__Kind__interface_) { + } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */ && (left)._typ == 296 /* 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); 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 == 294 /* v.ast.TypeNode */) { + } else if ((left)._typ == 296 /* 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); skip_state = (v__ast__Type_alias_eq(left_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); @@ -60173,7 +58275,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; } } else if (c->pref->output_cross_c) { bool is_freestanding_block = false; - if ((branch.cond)._typ == 268 /* v.ast.Ident */) { + if ((branch.cond)._typ == 270 /* v.ast.Ident */) { if (string__eq((*branch.cond._v__ast__Ident).name, _SLIT("freestanding"))) { is_freestanding_block = true; } @@ -60208,8 +58310,8 @@ bool v__checker__Checker_if_expr_defer_0 = false; c->smartcast_cond_pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); } if (expr_required) { - if (branch.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(branch.stmts)))._typ == 308 /* v.ast.ExprStmt */) { - v__ast__ExprStmt last_expr = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ; + if (branch.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(branch.stmts)))._typ == 310 /* v.ast.ExprStmt */) { + v__ast__ExprStmt last_expr = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ; c->expected_type = former_expected_type; if (v__ast__Type_has_flag(c->expected_type, v__ast__TypeFlag__optional)) { if (v__ast__Type_alias_eq(node->typ, _const_v__ast__void_type)) { @@ -60284,10 +58386,10 @@ bool v__checker__Checker_if_expr_defer_0 = false; ; } } - if ((branch.cond)._typ == 270 /* v.ast.IfGuardExpr */) { + if ((branch.cond)._typ == 272 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; if ((*branch.cond._v__ast__IfGuardExpr).vars.len != mr_info.types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("if guard expects "), /*100 &int*/0xfe07, {.d_i32 = mr_info.types.len}}, {_SLIT(" variables, but got "), /*100 &int*/0xfe07, {.d_i32 = (*branch.cond._v__ast__IfGuardExpr).vars.len}}, {_SLIT0, 0, { .d_c = 0 }}})), branch.pos); } else { @@ -60338,17 +58440,17 @@ bool v__checker__Checker_if_expr_defer_0 = false; } VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* c, v__ast__Expr node, v__ast__Scope* scope) { - if ((node)._typ == 272 /* v.ast.InfixExpr */) { + if ((node)._typ == 274 /* v.ast.InfixExpr */) { if ((*node._v__ast__InfixExpr).op == v__token__Kind__and) { v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__InfixExpr).left, scope); v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__InfixExpr).right, scope); } else if ((*node._v__ast__InfixExpr).op == v__token__Kind__key_is) { v__ast__Expr right_expr = (*node._v__ast__InfixExpr).right; v__ast__Type _t1 = 0; - if (right_expr._typ == 294 /* v.ast.TypeNode */) { + if (right_expr._typ == 296 /* v.ast.TypeNode */) { _t1 = (*right_expr._v__ast__TypeNode).typ; } - else if (right_expr._typ == 280 /* v.ast.None */) { + else if (right_expr._typ == 282 /* v.ast.None */) { _t1 = _const_v__ast__none_type_idx; } @@ -60362,7 +58464,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__Type expr_type = v__checker__Checker_expr(c, (*node._v__ast__InfixExpr).left); if (left_sym->kind == v__ast__Kind__aggregate) { - expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ).sum_type; + expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; } if (left_sym->kind == v__ast__Kind__interface_) { if (right_sym->kind != v__ast__Kind__interface_) { @@ -60375,10 +58477,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* string expr_str = v__ast__Table_type_to_str(c->table, expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` as type `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__InfixExpr).pos); } - if ((((*node._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */ || ((*node._v__ast__InfixExpr).left)._typ == 288 /* v.ast.SelectorExpr */) && ((*node._v__ast__InfixExpr).right)._typ == 294 /* v.ast.TypeNode */) { - bool is_variable = (((*node._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */ ? ((*(*node._v__ast__InfixExpr).left._v__ast__Ident).kind == v__ast__IdentKind__variable) : (true)); + if ((((*node._v__ast__InfixExpr).left)._typ == 270 /* v.ast.Ident */ || ((*node._v__ast__InfixExpr).left)._typ == 290 /* v.ast.SelectorExpr */) && ((*node._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */) { + bool is_variable = (((*node._v__ast__InfixExpr).left)._typ == 270 /* v.ast.Ident */ ? ((*(*node._v__ast__InfixExpr).left._v__ast__Ident).kind == v__ast__IdentKind__variable) : (true)); if (is_variable) { - if ((((*node._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__Ident,((*node._v__ast__InfixExpr).left)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).is_mut) || (((*node._v__ast__InfixExpr).left)._typ == 288 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__SelectorExpr,((*node._v__ast__InfixExpr).left)._typ, 288) /*expected idx: 288, name: v.ast.SelectorExpr */ ).is_mut)) { + if ((((*node._v__ast__InfixExpr).left)._typ == 270 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__Ident,((*node._v__ast__InfixExpr).left)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).is_mut) || (((*node._v__ast__InfixExpr).left)._typ == 290 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__SelectorExpr,((*node._v__ast__InfixExpr).left)._typ, 290) /*expected idx: 290, name: v.ast.SelectorExpr */ ).is_mut)) { v__checker__Checker_fail_if_immutable(c, (*node._v__ast__InfixExpr).left); } if (left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type) { @@ -60388,7 +58490,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* } } } - } else if ((node)._typ == 275 /* v.ast.Likely */) { + } else if ((node)._typ == 277 /* v.ast.Likely */) { v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__Likely).expr, scope); } } @@ -60432,12 +58534,12 @@ v__ast__Type former_expected_type; } v__ast__Type return_type = left_type; if (node->op != v__token__Kind__key_is) { - if (node->left._typ == 268 /* v.ast.Ident */) { + if (node->left._typ == 270 /* v.ast.Ident */) { if ((*node->left._v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->left._v__ast__Ident).mut_pos); } } - else if (node->left._typ == 288 /* v.ast.SelectorExpr */) { + else if (node->left._typ == 290 /* v.ast.SelectorExpr */) { if ((*node->left._v__ast__SelectorExpr).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->left._v__ast__SelectorExpr).mut_pos); } @@ -60447,12 +58549,12 @@ v__ast__Type former_expected_type; } ; } - if (node->right._typ == 268 /* v.ast.Ident */) { + if (node->right._typ == 270 /* v.ast.Ident */) { if ((*node->right._v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->right._v__ast__Ident).mut_pos); } } - else if (node->right._typ == 288 /* v.ast.SelectorExpr */) { + else if (node->right._typ == 290 /* v.ast.SelectorExpr */) { if ((*node->right._v__ast__SelectorExpr).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->right._v__ast__SelectorExpr).mut_pos); } @@ -60472,12 +58574,12 @@ v__ast__Type former_expected_type; } else if (Array_int_contains(_const_v__ast__integer_type_idxs, left_type) && Array_int_contains(_const_v__ast__integer_type_idxs, right_type)) { bool is_left_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, left_type); bool is_right_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, right_type); - if (!is_left_type_signed && (node->right)._typ == 273 /* v.ast.IntegerLiteral */) { + if (!is_left_type_signed && (node->right)._typ == 275 /* v.ast.IntegerLiteral */) { if (string_int((*node->right._v__ast__IntegerLiteral).val) < 0 && Array_int_contains(_const_v__ast__int_promoted_type_idxs, left_type)) { string lt = v__ast__Table_sym(c->table, left_type)->name; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = lt}}, {_SLIT("` cannot be compared with negative value"), 0, { .d_c = 0 }}})), (*node->right._v__ast__IntegerLiteral).pos); } - } else if (!is_right_type_signed && (node->left)._typ == 273 /* v.ast.IntegerLiteral */) { + } else if (!is_right_type_signed && (node->left)._typ == 275 /* v.ast.IntegerLiteral */) { if (string_int((*node->left._v__ast__IntegerLiteral).val) < 0 && Array_int_contains(_const_v__ast__int_promoted_type_idxs, right_type)) { string rt = v__ast__Table_sym(c->table, right_type)->name; 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); @@ -60559,15 +58661,15 @@ v__ast__Type former_expected_type; case v__token__Kind__amp: case v__token__Kind__pipe: { - if ((right_sym->info)._typ == 433 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type))) { - right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + if ((right_sym->info)._typ == 435 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type))) { + right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); } - if ((left_sym->info)._typ == 433 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type))) { - left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + if ((left_sym->info)._typ == 435 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type))) { + left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); } if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; - } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 433 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 435 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t5; if (_t5 = v__ast__TypeSymbol_find_method(left_sym, v__token__Kind_str(node->op)), _t5.state == 0) { @@ -60586,7 +58688,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 433 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 435 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(right_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t6; if (_t6 = v__ast__TypeSymbol_find_method(right_sym, v__token__Kind_str(node->op)), _t6.state == 0) { @@ -60693,7 +58795,7 @@ v__ast__Type former_expected_type; { if ((left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed) && (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed)) { v__checker__Checker_error(c, _SLIT("only `==` and `!=` are defined on arrays"), node->pos); - } else if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).generic_types.len > 0) { + } else if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { v__ast__Type _t9 = _const_v__ast__bool_type; // Defer begin if (v__checker__Checker_infix_expr_defer_0) { @@ -60734,13 +58836,13 @@ v__ast__Type former_expected_type; bool is_right_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, right_type) || right_type == _const_v__ast__int_literal_type_idx; if (is_left_type_signed != is_right_type_signed) { if (is_right_type_signed) { - if ((node->right)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((node->right)._typ == 275 /* v.ast.IntegerLiteral */) { if (string_int((*node->right._v__ast__IntegerLiteral).val) < 0) { v__checker__Checker_error(c, _SLIT("unsigned integer cannot be compared with negative value"), (*node->right._v__ast__IntegerLiteral).pos); } } } else if (is_left_type_signed) { - if ((node->left)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((node->left)._typ == 275 /* v.ast.IntegerLiteral */) { if (string_int((*node->left._v__ast__IntegerLiteral).val) < 0) { v__checker__Checker_error(c, _SLIT("unsigned integer cannot be compared with negative value"), (*node->left._v__ast__IntegerLiteral).pos); } @@ -60902,10 +59004,10 @@ v__ast__Type former_expected_type; { v__ast__Expr right_expr = node->right; v__ast__Type _t20 = 0; - if (right_expr._typ == 294 /* v.ast.TypeNode */) { + if (right_expr._typ == 296 /* v.ast.TypeNode */) { _t20 = (*right_expr._v__ast__TypeNode).typ; } - else if (right_expr._typ == 280 /* v.ast.None */) { + else if (right_expr._typ == 282 /* v.ast.None */) { _t20 = _const_v__ast__none_type_idx; } @@ -60921,12 +59023,12 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT(": type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("` does not exist"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(right_expr)); } if (left_sym->kind == v__ast__Kind__aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(c->table, parent_left_type); } if (!(left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT("` can only be used with interfaces and sum types"), 0, { .d_c = 0 }}})), node->pos); - } else if ((left_sym->info)._typ == 437 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 439 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*left_sym->info._v__ast__SumType).variants, typ)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -60979,7 +59081,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("right operand for `"), /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT("` is not a boolean"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->right)); } } - if ((node->left)._typ == 272 /* v.ast.InfixExpr */) { + if ((node->left)._typ == 274 /* v.ast.InfixExpr */) { if ((*node->left._v__ast__InfixExpr).op != node->op && ((*node->left._v__ast__InfixExpr).op == v__token__Kind__logical_or || (*node->left._v__ast__InfixExpr).op == v__token__Kind__and)) { v__checker__Checker_error(c, _SLIT("ambiguous boolean expression. use `()` to ensure correct order of operations"), node->pos); } @@ -61088,8 +59190,8 @@ v__ast__Type former_expected_type; } else if (v__ast__Type_alias_eq(left_type, _const_v__ast__string_type) && !(node->op == v__token__Kind__plus || node->op == v__token__Kind__eq || node->op == v__token__Kind__ne || node->op == v__token__Kind__lt || node->op == v__token__Kind__gt || node->op == v__token__Kind__le || node->op == v__token__Kind__ge)) { v__checker__Checker_error(c, _SLIT("string types only have the following operators defined: `==`, `!=`, `<`, `>`, `<=`, `>=`, and `+`"), node->pos); } else if (left_sym->kind == v__ast__Kind__enum_ && right_sym->kind == v__ast__Kind__enum_ && !eq_ne) { - v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ; - v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ; + v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ; + v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ; if (left_enum.is_flag && right_enum.is_flag) { if (!(node->op == v__token__Kind__pipe || node->op == v__token__Kind__amp)) { v__checker__Checker_error(c, _SLIT("only `==`, `!=`, `|` and `&` are defined on `[flag]` tagged `enum`, use an explicit cast to `int` if needed"), node->pos); @@ -61131,6 +59233,12 @@ v__ast__Type former_expected_type; return _t24; } v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("infix expr: cannot use `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("` (right expression) as `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); + } else if (v__ast__Type_is_ptr(left_type)) { + bool for_ptr_op = v__ast__Table_type_is_for_pointer_arithmetic(c->table, left_type); + if (left_sym->language == v__ast__Language__v && !c->pref->translated && !c->inside_unsafe && !for_ptr_op && v__ast__Type_is_int(right_type)) { + string sugg = _SLIT(" (you can use it inside an `unsafe` block)"); + v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("infix expr: cannot use `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("` (right expression) as `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` "), /*115 &string*/0xfe10, {.d_s = sugg}}, {_SLIT0, 0, { .d_c = 0 }}})), left_right_pos); + } } v__ast__Type _t25 = (v__token__Kind_is_relational(node->op) ? (_const_v__ast__bool_type) : (return_type)); // Defer begin @@ -61142,19 +59250,19 @@ v__ast__Type former_expected_type; } VV_LOCAL_SYMBOL void v__checker__Checker_check_div_mod_by_zero(v__checker__Checker* c, v__ast__Expr expr, v__token__Kind op_kind) { - if (expr._typ == 266 /* v.ast.FloatLiteral */) { + if (expr._typ == 268 /* v.ast.FloatLiteral */) { if (string_f64((*expr._v__ast__FloatLiteral).val) == 0.0) { string oper = (op_kind == v__token__Kind__div ? (_SLIT("division")) : (_SLIT("modulo"))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = oper}}, {_SLIT(" by zero"), 0, { .d_c = 0 }}})), (*expr._v__ast__FloatLiteral).pos); } } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { if (string_int((*expr._v__ast__IntegerLiteral).val) == 0) { string oper = (op_kind == v__token__Kind__div ? (_SLIT("division")) : (_SLIT("modulo"))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = oper}}, {_SLIT(" by zero"), 0, { .d_c = 0 }}})), (*expr._v__ast__IntegerLiteral).pos); } } - else if (expr._typ == 255 /* v.ast.CastExpr */) { + else if (expr._typ == 257 /* v.ast.CastExpr */) { v__checker__Checker_check_div_mod_by_zero(c, (*expr._v__ast__CastExpr).expr, op_kind); } @@ -61167,15 +59275,20 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_check_valid_pascal_case(c, node->name, _SLIT("interface name"), node->pos); v__ast__TypeSymbol* decl_sym = v__ast__Table_sym(c->table, node->typ); bool is_js = node->language == v__ast__Language__js; - if ((decl_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((decl_sym->info)._typ == 438 /* v.ast.Interface */) { if (node->embeds.len > 0) { Array_v__ast__InterfaceEmbedding all_embeds = v__checker__Checker_expand_iface_embeds(c, node, 0, node->embeds); node->embeds = all_embeds; - Map_string_int emnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool emnames_ds = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool emnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int efnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool efnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int emnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool emnames_ds = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool emnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int efnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool efnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < node->methods.len; ++i) { v__ast__FnDecl m = ((v__ast__FnDecl*)node->methods.data)[i]; map_set(&emnames, &(string[]){m.name}, &(int[]) { i }); @@ -61194,7 +59307,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` tries to embed `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("`, but `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("` is not an interface, but `"), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(isym->kind)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), embed.pos); continue; } - v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; for (int _t2 = 0; _t2 < isym_info.fields.len; ++_t2) { v__ast__StructField f = ((v__ast__StructField*)isym_info.fields.data)[_t2]; if (!(*(bool*)map_get(ADDR(map, efnames_ds_info), &(string[]){f.name}, &(bool[]){ 0 }))) { @@ -61359,7 +59472,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, utyp); v__ast__TypeSymbol* inter_sym = v__ast__Table_sym(c->table, interface_type); - if ((inter_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 438 /* v.ast.Interface */) { if ((*inter_sym->info._v__ast__Interface).is_generic) { Array_v__ast__Type inferred_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_string _t1 = {0}; @@ -61416,7 +59529,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type _t11 = 0; return _t11; } - if ((imret_sym->info)._typ == 444 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 444 /* v.ast.MultiReturn */) { + if ((imret_sym->info)._typ == 446 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 446 /* v.ast.MultiReturn */) { for (int i = 0; i < (*imret_sym->info._v__ast__MultiReturn).types.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)(*imret_sym->info._v__ast__MultiReturn).types.data)[i]; if (v__ast__Type_has_flag(mr_typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_get_type_name(c->table, mr_typ), gt_name)) { @@ -61479,7 +59592,7 @@ v__ast__Type v__checker__Checker_match_expr(v__checker__Checker* c, v__ast__Matc bool v__checker__Checker_match_expr_defer_0 = false; node->is_expr = !v__ast__Type_alias_eq(c->expected_type, _const_v__ast__void_type); node->expected_type = c->expected_type; - if ((node->cond)._typ == 283 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { + if ((node->cond)._typ == 285 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("unnecessary `()` in `match` condition, use `match expr {` instead of `match (expr) {`."), (*node->cond._v__ast__ParExpr).pos); } if (node->is_expr) { @@ -61488,7 +59601,7 @@ bool v__checker__Checker_match_expr_defer_0 = false; } v__ast__Type cond_type = v__checker__Checker_expr(c, node->cond); node->cond_type = v__ast__mktyp(cond_type); - if (((node->cond)._typ == 268 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->cond)._v__ast__Ident,(node->cond)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).is_mut) || ((node->cond)._typ == 288 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast((node->cond)._v__ast__SelectorExpr,(node->cond)._typ, 288) /*expected idx: 288, name: v.ast.SelectorExpr */ ).is_mut)) { + if (((node->cond)._typ == 270 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->cond)._v__ast__Ident,(node->cond)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).is_mut) || ((node->cond)._typ == 290 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast((node->cond)._v__ast__SelectorExpr,(node->cond)._typ, 290) /*expected idx: 290, name: v.ast.SelectorExpr */ ).is_mut)) { v__checker__Checker_fail_if_immutable(c, node->cond); } _option_void _t1 = v__checker__Checker_ensure_type_exists(c, node->cond_type, node->pos); @@ -61542,7 +59655,7 @@ bool v__checker__Checker_match_expr_defer_0 = false; } if (branch.stmts.len > 0) { v__ast__Stmt stmt = (*(v__ast__Stmt*)array_last(branch.stmts)); - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { if (node->is_expr) { c->expected_type = node->expected_type; } @@ -61645,22 +59758,23 @@ bool v__checker__Checker_match_expr_defer_0 = false; } VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ast__MatchExpr* node, v__ast__TypeSymbol cond_type_sym) { - Map_string_int branch_exprs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int branch_exprs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int branch_i = 0; branch_i < node->branches.len; ++branch_i) { v__ast__MatchBranch branch = (*(v__ast__MatchBranch*)/*ee elem_sym */array_get(node->branches, branch_i)); Array_v__ast__TypeNode expr_types = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); for (int k = 0; k < branch.exprs.len; ++k) { v__ast__Expr expr = ((v__ast__Expr*)branch.exprs.data)[k]; string key = _SLIT(""); - if ((expr)._typ == 286 /* v.ast.RangeExpr */) { + if ((expr)._typ == 288 /* v.ast.RangeExpr */) { i64 low = ((i64)(0)); i64 high = ((i64)(0)); c->expected_type = node->expected_type; v__ast__Expr low_expr = (*expr._v__ast__RangeExpr).low; v__ast__Expr high_expr = (*expr._v__ast__RangeExpr).high; v__ast__TypeSymbol* final_cond_sym = v__ast__Table_final_sym(c->table, node->cond_type); - if ((low_expr)._typ == 273 /* v.ast.IntegerLiteral */) { - if ((high_expr)._typ == 273 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 447 /* v.ast.Enum */)) { + if ((low_expr)._typ == 275 /* v.ast.IntegerLiteral */) { + if ((high_expr)._typ == 275 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 449 /* v.ast.Enum */)) { low = string_i64((*low_expr._v__ast__IntegerLiteral).val); high = string_i64((*high_expr._v__ast__IntegerLiteral).val); if (low > high) { @@ -61669,8 +59783,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } else { v__checker__Checker_error(c, _SLIT("mismatched range types"), (*low_expr._v__ast__IntegerLiteral).pos); } - } else if ((low_expr)._typ == 257 /* v.ast.CharLiteral */) { - if ((high_expr)._typ == 257 /* v.ast.CharLiteral */ && (final_cond_sym->kind == v__ast__Kind__u8 || final_cond_sym->kind == v__ast__Kind__char || final_cond_sym->kind == v__ast__Kind__rune)) { + } else if ((low_expr)._typ == 259 /* v.ast.CharLiteral */) { + if ((high_expr)._typ == 259 /* v.ast.CharLiteral */ && (final_cond_sym->kind == v__ast__Kind__u8 || final_cond_sym->kind == v__ast__Kind__char || final_cond_sym->kind == v__ast__Kind__rune)) { low = string_at((*low_expr._v__ast__CharLiteral).val, 0); high = string_at((*high_expr._v__ast__CharLiteral).val, 0); if (low > high) { @@ -61697,11 +59811,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } continue; } - if (expr._typ == 294 /* v.ast.TypeNode */) { + if (expr._typ == 296 /* v.ast.TypeNode */) { key = v__ast__Table_type_to_str(c->table, (*expr._v__ast__TypeNode).typ); array_push((array*)&expr_types, _MOV((v__ast__TypeNode[]){ (*expr._v__ast__TypeNode) })); } - else if (expr._typ == 265 /* v.ast.EnumVal */) { + else if (expr._typ == 267 /* v.ast.EnumVal */) { key = (*expr._v__ast__EnumVal).val; } @@ -61728,7 +59842,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - } else if ((cond_type_sym.info)._typ == 437 /* v.ast.SumType */) { + } else if ((cond_type_sym.info)._typ == 439 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*cond_type_sym.info._v__ast__SumType).variants, expr_type)) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); @@ -61739,14 +59853,15 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ for (int _t3 = 0; _t3 < _t2_len; ++_t3) { v__ast__Type it = ((v__ast__Type*) _t2_orig.data)[_t3]; - string ti = v__ast__Table_type_to_str_using_aliases(c->table, it, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string ti = v__ast__Table_type_to_str_using_aliases(c->table, it, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); array_push((array*)&_t2, &ti); } Array_string sumtype_variant_names =_t2; v__util__Suggestion suggestion = v__util__new_suggestion(expr_str, sumtype_variant_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), v__ast__Expr_pos(expr)); } - } else if ((cond_type_sym.info)._typ == 433 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 418 /* v.ast.Struct */) { + } else if ((cond_type_sym.info)._typ == 435 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 420 /* v.ast.Struct */) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot match alias type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` with `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); @@ -61812,7 +59927,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } else { - if (cond_type_sym.info._typ == 437 /* v.ast.SumType */) { + if (cond_type_sym.info._typ == 439 /* v.ast.SumType */) { for (int _t8 = 0; _t8 < (*cond_type_sym.info._v__ast__SumType).variants.len; ++_t8) { v__ast__Type v = ((v__ast__Type*)(*cond_type_sym.info._v__ast__SumType).variants.data)[_t8]; string v_str = v__ast__Table_type_to_str(c->table, v); @@ -61822,7 +59937,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - else if (cond_type_sym.info._typ == 447 /* v.ast.Enum */) { + else if (cond_type_sym.info._typ == 449 /* v.ast.Enum */) { for (int _t10 = 0; _t10 < (*cond_type_sym.info._v__ast__Enum).vals.len; ++_t10) { string v = ((string*)(*cond_type_sym.info._v__ast__Enum).vals.data)[_t10]; if (!_IN_MAP(ADDR(string, v), ADDR(map, branch_exprs))) { @@ -61900,7 +60015,7 @@ v__ast__TypeSymbol old_ts; old_ts = c->cur_orm_ts; c->cur_orm_ts = *sym; v__checker__Checker_sql_expr_defer_1 = true; - if ((sym->info)._typ != 418 /* v.ast.Struct */) { + if ((sym->info)._typ != 420 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("The table symbol `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has to be a struct"), 0, { .d_c = 0 }}})), node->table_expr.pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin @@ -61915,9 +60030,10 @@ v__ast__TypeSymbol old_ts; // Defer end return _t3; } - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; Array_v__ast__StructField fields = v__checker__Checker_fetch_and_verify_orm_fields(c, info, node->table_expr.pos, sym->name); - Map_int_v__ast__SqlExpr 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); + Map_int_v__ast__SqlExpr 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) + ; Array_v__ast__StructField _t5 = {0}; Array_v__ast__StructField _t5_orig = fields; int _t5_len = _t5_orig.len; @@ -62046,7 +60162,7 @@ v__ast__TypeSymbol old_ts; old_ts = c->cur_orm_ts; c->cur_orm_ts = *table_sym; v__checker__Checker_sql_stmt_line_defer_1 = true; - if ((table_sym->info)._typ != 418 /* v.ast.Struct */) { + if ((table_sym->info)._typ != 420 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = table_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin @@ -62061,9 +60177,10 @@ v__ast__TypeSymbol old_ts; // Defer end return _t3; } - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((table_sym->info)._v__ast__Struct,(table_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((table_sym->info)._v__ast__Struct,(table_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; Array_v__ast__StructField fields = v__checker__Checker_fetch_and_verify_orm_fields(c, info, node->table_expr.pos, table_sym->name); - Map_int_v__ast__SqlStmtLine sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlStmtLine), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop); + Map_int_v__ast__SqlStmtLine sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlStmtLine), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop) + ; Array_v__ast__StructField _t5 = {0}; Array_v__ast__StructField _t5_orig = fields; int _t5_len = _t5_orig.len; @@ -62118,7 +60235,7 @@ v__ast__TypeSymbol old_ts; v__checker__Checker_expr(c, expr); } } - if ((node->where_expr)._typ != 264 /* v.ast.EmptyExpr */) { + if ((node->where_expr)._typ != 266 /* v.ast.EmptyExpr */) { v__checker__Checker_expr(c, node->where_expr); } v__ast__Type _t11 = _const_v__ast__void_type; @@ -62179,7 +60296,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod bool exp_is_optional = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional); bool exp_is_result = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__result); Array_v__ast__Type expected_types = new_array_from_c_array(1, 1, sizeof(v__ast__Type), _MOV((v__ast__Type[1]){expected_type})); - if ((expected_type_sym->info)._typ == 444 /* v.ast.MultiReturn */) { + if ((expected_type_sym->info)._typ == 446 /* v.ast.MultiReturn */) { expected_types = (*expected_type_sym->info._v__ast__MultiReturn).types; if (c->table->cur_concrete_types.len > 0) { Array_v__ast__Type _t1 = {0}; @@ -62211,8 +60328,8 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod array_push((array*)&expr_idxs, _MOV((int[]){ i })); } } else { - if ((expr)._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__checker__Checker_unwrap_generic(c, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); } @@ -62240,7 +60357,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod Array_string pnames =_t8; for (int _t10 = 0; _t10 < node->exprs.len; ++_t10) { v__ast__Expr expr = ((v__ast__Expr*)node->exprs.data)[_t10]; - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { if (Array_string_contains(pnames, (*expr._v__ast__Ident).name)) { v__checker__Checker_note(c, _SLIT("returning a parameter in a fn marked with `[manualfree]` can cause double freeing in the caller"), node->pos); } @@ -62300,8 +60417,8 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (v__ast__Type_is_ptr(exp_type) && v__ast__Type_is_ptr(got_typ)) { v__ast__Expr* r_expr = &(*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, (*(int*)/*ee elem_sym */array_get(expr_idxs, i)))); - if ((r_expr)->_typ == 268 /* v.ast.Ident */) { - if (((*r_expr->_v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((r_expr)->_typ == 270 /* v.ast.Ident */) { + if (((*r_expr->_v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Var* obj = &(*(*r_expr->_v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t11 = v__ast__Scope_find_var(c->fn_scope, (*(*r_expr->_v__ast__Ident).obj._v__ast__Var).name); @@ -62325,7 +60442,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (exp_is_optional && node->exprs.len > 0) { v__ast__Expr expr0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, 0)); - if ((expr0)._typ == 254 /* v.ast.CallExpr */) { + if ((expr0)._typ == 256 /* v.ast.CallExpr */) { if ((*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option && node->exprs.len == 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`?` is not needed, use `return "), /*115 &string*/0xfe10, {.d_s = (*expr0._v__ast__CallExpr).name}}, {_SLIT("()`"), 0, { .d_c = 0 }}})), (*expr0._v__ast__CallExpr).pos); } @@ -62337,8 +60454,8 @@ void v__checker__Checker_find_unreachable_statements_after_noreturn_calls(v__che bool prev_stmt_was_noreturn_call = false; for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t1]; - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 254 /* v.ast.CallExpr */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 256 /* v.ast.CallExpr */) { if (prev_stmt_was_noreturn_call) { v__checker__Checker_error(c, _SLIT("unreachable code after a [noreturn] call"), (*stmt._v__ast__ExprStmt).pos); return; @@ -62354,18 +60471,18 @@ void v__checker__Checker_find_unreachable_statements_after_noreturn_calls(v__che VV_LOCAL_SYMBOL bool v__checker__has_top_return(Array_v__ast__Stmt stmts) { for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t1]; - if (stmt._typ == 319 /* v.ast.Return */) { + if (stmt._typ == 321 /* v.ast.Return */) { bool _t2 = true; return _t2; } - else if (stmt._typ == 301 /* v.ast.Block */) { + else if (stmt._typ == 303 /* v.ast.Block */) { if (v__checker__has_top_return((*stmt._v__ast__Block).stmts)) { bool _t3 = true; return _t3; } } - else if (stmt._typ == 308 /* v.ast.ExprStmt */) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 254 /* v.ast.CallExpr */) { + else if (stmt._typ == 310 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 256 /* v.ast.CallExpr */) { if ((*(*stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).is_noreturn) { bool _t4 = true; return _t4; @@ -62397,8 +60514,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Chec if (node->stmts.len != 0) { bool is_valid_end_of_noreturn_fn = false; v__ast__Stmt last_stmt = (*(v__ast__Stmt*)array_last(node->stmts)); - if (last_stmt._typ == 308 /* v.ast.ExprStmt */) { - if (((*last_stmt._v__ast__ExprStmt).expr)._typ == 254 /* v.ast.CallExpr */) { + if (last_stmt._typ == 310 /* v.ast.ExprStmt */) { + if (((*last_stmt._v__ast__ExprStmt).expr)._typ == 256 /* v.ast.CallExpr */) { if ((*(*last_stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).should_be_skipped) { v__checker__Checker_error(c, _SLIT("[noreturn] functions cannot end with a skippable `[if ..]` call"), (*last_stmt._v__ast__ExprStmt).pos); return; @@ -62408,7 +60525,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Chec } } } - else if (last_stmt._typ == 311 /* v.ast.ForStmt */) { + else if (last_stmt._typ == 313 /* v.ast.ForStmt */) { if ((*last_stmt._v__ast__ForStmt).is_inf && (*last_stmt._v__ast__ForStmt).stmts.len == 0) { is_valid_end_of_noreturn_fn = true; } @@ -62431,24 +60548,24 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } for (int _t2 = 0; _t2 < stmts.len; ++_t2) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t2]; - if (stmt._typ == 319 /* v.ast.Return */) { + if (stmt._typ == 321 /* v.ast.Return */) { bool _t3 = true; return _t3; } - else if (stmt._typ == 301 /* v.ast.Block */) { + else if (stmt._typ == 303 /* v.ast.Block */) { if (v__checker__uses_return_stmt((*stmt._v__ast__Block).stmts)) { bool _t4 = true; return _t4; } } - else if (stmt._typ == 308 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).expr._typ == 254 /* v.ast.CallExpr */) { + else if (stmt._typ == 310 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 256 /* v.ast.CallExpr */) { if (v__checker__uses_return_stmt((*(*stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).or_block.stmts)) { bool _t5 = true; return _t5; } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 278 /* v.ast.MatchExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 280 /* v.ast.MatchExpr */) { for (int _t6 = 0; _t6 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t6) { v__ast__MatchBranch b = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t6]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -62457,7 +60574,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 287 /* v.ast.SelectExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 289 /* v.ast.SelectExpr */) { for (int _t8 = 0; _t8 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__SelectExpr).branches.len; ++_t8) { v__ast__SelectBranch b = ((v__ast__SelectBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__SelectExpr).branches.data)[_t8]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -62466,7 +60583,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 269 /* v.ast.IfExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 271 /* v.ast.IfExpr */) { for (int _t10 = 0; _t10 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t10) { v__ast__IfBranch b = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t10]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -62480,19 +60597,19 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } ; } - else if (stmt._typ == 311 /* v.ast.ForStmt */) { + else if (stmt._typ == 313 /* v.ast.ForStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForStmt).stmts)) { bool _t12 = true; return _t12; } } - else if (stmt._typ == 309 /* v.ast.ForCStmt */) { + else if (stmt._typ == 311 /* v.ast.ForCStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForCStmt).stmts)) { bool _t13 = true; return _t13; } } - else if (stmt._typ == 310 /* v.ast.ForInStmt */) { + else if (stmt._typ == 312 /* v.ast.ForInStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForInStmt).stmts)) { bool _t14 = true; return _t14; @@ -62508,7 +60625,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr) { - if ((expr)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 256 /* v.ast.CallExpr */) { bool _t1 = (*expr._v__ast__CallExpr).is_noreturn; return _t1; } @@ -62535,7 +60652,7 @@ u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, ftyp)); if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; sym = v__ast__Table_sym(c->table, info.parent_type); if (v__ast__Type_alias_eq(info.parent_type, _const_v__ast__string_type)) { u8 _t6 = 's'; @@ -62711,7 +60828,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* v__ast__TypeSymbol* struct_sym = mr_405.arg0; int struct_typ_idx = mr_405.arg1; bool has_generic_types = false; - if ((struct_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((struct_sym->info)._typ == 420 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < node->embeds.len; ++_t1) { v__ast__Embed embed = ((v__ast__Embed*)node->embeds.data)[_t1]; if (v__ast__Type_has_flag(embed.typ, v__ast__TypeFlag__generic)) { @@ -62721,7 +60838,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* if (embed_sym->kind != v__ast__Kind__struct_) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = embed_sym->name}}, {_SLIT("` is not a struct"), 0, { .d_c = 0 }}})), embed.pos); } else { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (info.is_heap && !v__ast__Type_is_ptr(embed.typ)) { (*struct_sym->info._v__ast__Struct).is_heap = true; } @@ -62769,7 +60886,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); if (field_sym->kind == v__ast__Kind__function) { - v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; _option_void _t4 = v__checker__Checker_ensure_type_exists(c, fn_info.func.return_type, fn_info.func.return_type_pos); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { IError err = _t4.err; @@ -62790,7 +60907,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (info.is_heap && !v__ast__Type_is_ptr(field.typ)) { (*struct_sym->info._v__ast__Struct).is_heap = true; } @@ -62822,15 +60939,15 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* if (v__ast__Type_is_ptr(field.typ)) { continue; } - if ((field.default_expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((field.default_expr)._typ == 275 /* v.ast.IntegerLiteral */) { if (string__eq((*field.default_expr._v__ast__IntegerLiteral).val, _SLIT("0"))) { v__checker__Checker_warn(c, _SLIT("unnecessary default value of `0`: struct fields are zeroed by default"), (*field.default_expr._v__ast__IntegerLiteral).pos); } - } else if ((field.default_expr)._typ == 292 /* v.ast.StringLiteral */) { + } else if ((field.default_expr)._typ == 294 /* v.ast.StringLiteral */) { if (((*field.default_expr._v__ast__StringLiteral).val).len == 0) { v__checker__Checker_warn(c, _SLIT("unnecessary default value of '': struct fields are zeroed by default"), (*field.default_expr._v__ast__StringLiteral).pos); } - } else if ((field.default_expr)._typ == 252 /* v.ast.BoolLiteral */) { + } else if ((field.default_expr)._typ == 254 /* v.ast.BoolLiteral */) { if ((*field.default_expr._v__ast__BoolLiteral).val == false) { v__checker__Checker_warn(c, _SLIT("unnecessary default value `false`: struct fields are zeroed by default"), (*field.default_expr._v__ast__BoolLiteral).pos); } @@ -62862,18 +60979,18 @@ VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__S v__ast__Table* t = global_table; v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); - if ((a_sym->info)._typ == 447 /* v.ast.Enum */) { + if ((a_sym->info)._typ == 449 /* 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, 447) /*expected idx: 447, name: v.ast.Enum */ ).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 449) /*expected idx: 449, 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 == 447 /* v.ast.Enum */) { + } else if ((b_sym->info)._typ == 449 /* 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; @@ -62904,7 +61021,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } } v__ast__TypeSymbol* struct_sym = v__ast__Table_sym(c->table, node->typ); - if ((struct_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((struct_sym->info)._typ == 420 /* v.ast.Struct */) { for (int _t2 = 0; _t2 < (*struct_sym->info._v__ast__Struct).concrete_types.len; ++_t2) { v__ast__Type ct = ((v__ast__Type*)(*struct_sym->info._v__ast__Struct).concrete_types.data)[_t2]; v__ast__TypeSymbol* ct_sym = v__ast__Table_sym(c->table, ct); @@ -62934,7 +61051,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->generic_types.len > 0 && (*struct_sym->info._v__ast__Struct).generic_types.len == node->generic_types.len && !Array_v__ast__Type_arr_eq((*struct_sym->info._v__ast__Struct).generic_types, node->generic_types)) { v__ast__Table_replace_generic_type(c->table, node->typ, node->generic_types); } - } else if ((struct_sym->info)._typ == 433 /* v.ast.Alias */) { + } else if ((struct_sym->info)._typ == 435 /* v.ast.Alias */) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*struct_sym->info._v__ast__Alias).parent_type); if (parent_sym->kind == v__ast__Kind__map) { string alias_str = v__ast__Table_type_to_str(c->table, node->typ); @@ -62977,7 +61094,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (type_sym->kind == v__ast__Kind__interface_ && type_sym->language != v__ast__Language__js) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate interface `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - if ((type_sym->info)._typ == 433 /* v.ast.Alias */) { + if ((type_sym->info)._typ == 435 /* v.ast.Alias */) { if (v__ast__Type_is_number((*type_sym->info._v__ast__Alias).parent_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate number type alias `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t7 = _const_v__ast__void_type; @@ -62988,7 +61105,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); } if (type_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (info.attrs.len > 0 && string__eq((*(v__ast__Attr*)/*ee elem_sym */array_get(info.attrs, 0)).name, _SLIT("noinit")) && !string__eq(type_sym->mod, c->mod)) { v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is declared with a `[noinit]` attribute, so "), 0, { .d_c = 0 }}})), str_intp(2, _MOV((StrIntpData[]){{_SLIT("it cannot be initialized with `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("{}`"), 0, { .d_c = 0 }}}))), node->pos); } @@ -63007,7 +61124,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { - v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); if (sym->kind == v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct: "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); @@ -63015,12 +61132,12 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t10; } if (sym->kind == v__ast__Kind__struct_) { - info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; } else { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("alias type name: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not struct type"), 0, { .d_c = 0 }}})), node->pos); } } else { - info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; } if (node->is_short) { int exp_len = info.fields.len; @@ -63105,7 +61222,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } if (field_type_sym->kind == v__ast__Kind__function && field_type_sym->language == v__ast__Language__v) { v__token__Pos pos = v__ast__Expr_pos(field->expr); - if ((field->expr)._typ == 246 /* v.ast.AnonFn */) { + if ((field->expr)._typ == 248 /* v.ast.AnonFn */) { if ((*field->expr._v__ast__AnonFn).decl.no_body) { v__checker__Checker_error(c, _SLIT("cannot initialize the fn field with anonymous fn that does not have a body"), pos); } @@ -63117,8 +61234,8 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = field_info.name}}, {_SLIT("` is optional, but initialization of optional fields currently unsupported"), 0, { .d_c = 0 }}})), field->pos); } if (v__ast__Type_is_ptr(expr_type) && v__ast__Type_is_ptr(expected_type)) { - if ((field->expr)._typ == 268 /* v.ast.Ident */) { - if (((*field->expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((field->expr)._typ == 270 /* v.ast.Ident */) { + if (((*field->expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { v__ast__Var* obj = &(*(*field->expr._v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t14 = v__ast__Scope_find_var(c->fn_scope, obj->name); @@ -63147,7 +61264,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } if (field.has_default_expr) { if (field.default_expr_typ == 0) { - if ((field.default_expr)._typ == 293 /* v.ast.StructInit */) { + if ((field.default_expr)._typ == 295 /* v.ast.StructInit */) { int idx = v__ast__Table_find_type_idx(c->table, (*field.default_expr._v__ast__StructInit).typ_str); if (idx != 0) { (*(v__ast__StructField*)/*ee elem_sym */array_get(info.fields, i)).default_expr_typ = v__ast__new_type(idx); @@ -63203,8 +61320,8 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } else if (!v__ast__Type_alias_eq(update_type, node->typ)) { v__ast__TypeSymbol* from_sym = v__ast__Table_sym(c->table, update_type); v__ast__TypeSymbol* to_sym = v__ast__Table_sym(c->table, node->typ); - v__ast__Struct from_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; - v__ast__Struct to_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct from_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; + v__ast__Struct to_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (!v__checker__Checker_check_struct_signature(c, from_info, to_info)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = from_sym->name}}, {_SLIT("` is not compatible with struct `"), /*115 &string*/0xfe10, {.d_s = to_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->update_expr)); } @@ -63376,9 +61493,9 @@ void v__transformer__Transformer_find_new_array_len(v__transformer__Transformer* return; } v__ast__Expr right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if ((right)._typ == 248 /* v.ast.ArrayInit */) { + if ((right)._typ == 250 /* v.ast.ArrayInit */) { v__ast__Expr left = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left)._typ == 268 /* v.ast.Ident */) { + if ((left)._typ == 270 /* v.ast.Ident */) { if ((*left._v__ast__Ident).is_mut) { v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, -2); return; @@ -63389,7 +61506,7 @@ void v__transformer__Transformer_find_new_array_len(v__transformer__Transformer* } int len = ((int)(0)); v__ast__Expr value = (*right._v__ast__ArrayInit).len_expr; - if ((value)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((value)._typ == 275 /* v.ast.IntegerLiteral */) { len = string_int((*value._v__ast__IntegerLiteral).val) + 1; } v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, len); @@ -63402,19 +61519,19 @@ void v__transformer__Transformer_find_new_range(v__transformer__Transformer* t, return; } v__ast__Expr right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if ((right)._typ == 271 /* v.ast.IndexExpr */) { + if ((right)._typ == 273 /* v.ast.IndexExpr */) { v__ast__Expr left = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left)._typ == 268 /* v.ast.Ident */) { + if ((left)._typ == 270 /* v.ast.Ident */) { if ((*left._v__ast__Ident).is_mut) { v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, -2); return; } v__ast__Expr index = (*right._v__ast__IndexExpr).index; - if ((index)._typ == 286 /* v.ast.RangeExpr */) { + if ((index)._typ == 288 /* v.ast.RangeExpr */) { v__ast__Expr range_low = (*index._v__ast__RangeExpr).low; - if ((range_low)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((range_low)._typ == 275 /* v.ast.IntegerLiteral */) { v__ast__Expr sub_left = (*right._v__ast__IndexExpr).left; - if ((sub_left)._typ == 268 /* v.ast.Ident */) { + if ((sub_left)._typ == 270 /* v.ast.Ident */) { int safe = v__transformer__IndexState_safe_offset(t->index, (*sub_left._v__ast__Ident).name); int low = string_int((*range_low._v__ast__IntegerLiteral).val); if (safe >= low) { @@ -63442,40 +61559,40 @@ void v__transformer__Transformer_check_safe_array(v__transformer__Transformer* t } v__ast__Expr index = node->index; v__ast__Expr name = node->left; - if (index._typ == 273 /* v.ast.IntegerLiteral */) { + if (index._typ == 275 /* v.ast.IntegerLiteral */) { bool is_direct = v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*index._v__ast__IntegerLiteral).val)); node->is_direct = is_direct; } - else if (index._typ == 286 /* v.ast.RangeExpr */) { + else if (index._typ == 288 /* v.ast.RangeExpr */) { if ((*index._v__ast__RangeExpr).has_high) { v__ast__Expr high = (*index._v__ast__RangeExpr).high; - if ((high)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((high)._typ == 275 /* v.ast.IntegerLiteral */) { v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*high._v__ast__IntegerLiteral).val)); return; } } if ((*index._v__ast__RangeExpr).has_low) { v__ast__Expr low = (*index._v__ast__RangeExpr).low; - if ((low)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((low)._typ == 275 /* v.ast.IntegerLiteral */) { v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*low._v__ast__IntegerLiteral).val)); return; } } } - else if (index._typ == 255 /* v.ast.CastExpr */) { + else if (index._typ == 257 /* v.ast.CastExpr */) { if (!string__eq((*index._v__ast__CastExpr).typname, _SLIT("int"))) { return; } v__ast__Expr index_expr = (*index._v__ast__CastExpr).expr; - if ((index_expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((index_expr)._typ == 275 /* v.ast.IntegerLiteral */) { string val = (*index_expr._v__ast__IntegerLiteral).val; node->is_direct = v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int(val)); } } - else if (index._typ == 265 /* v.ast.EnumVal */) { + else if (index._typ == 267 /* v.ast.EnumVal */) { ; } - else if (index._typ == 268 /* v.ast.Ident */) { + else if (index._typ == 270 /* v.ast.Ident */) { } else { @@ -63484,17 +61601,17 @@ void v__transformer__Transformer_check_safe_array(v__transformer__Transformer* t } v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v__ast__Stmt* node) { - if (node->_typ == 306 /* v.ast.EmptyStmt */) { + if (node->_typ == 308 /* v.ast.EmptyStmt */) { } - else if (node->_typ == 279 /* v.ast.NodeError */) { + else if (node->_typ == 281 /* v.ast.NodeError */) { } - else if (node->_typ == 298 /* v.ast.AsmStmt */) { + else if (node->_typ == 300 /* v.ast.AsmStmt */) { } - else if (node->_typ == 299 /* v.ast.AssertStmt */) { + else if (node->_typ == 301 /* v.ast.AssertStmt */) { v__ast__Stmt _t1 = v__transformer__Transformer_assert_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__AssertStmt)); return _t1; } - else if (node->_typ == 300 /* v.ast.AssignStmt */) { + else if (node->_typ == 302 /* v.ast.AssignStmt */) { v__transformer__Transformer_find_new_array_len(t, (*node->_v__ast__AssignStmt)); v__transformer__Transformer_find_new_range(t, (*node->_v__ast__AssignStmt)); v__transformer__Transformer_find_mut_self_assign(t, (*node->_v__ast__AssignStmt)); @@ -63507,7 +61624,7 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ *left = v__transformer__Transformer_expr(t, left); } } - else if (node->_typ == 301 /* v.ast.Block */) { + else if (node->_typ == 303 /* v.ast.Block */) { v__transformer__IndexState_indent(t->index, false); for (int _t4 = 0; _t4 < (*node->_v__ast__Block).stmts.len; ++_t4) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__Block).stmts.data) + _t4; @@ -63515,35 +61632,35 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 302 /* v.ast.BranchStmt */) { + else if (node->_typ == 304 /* v.ast.BranchStmt */) { t->index->disabled = true; } - else if (node->_typ == 303 /* v.ast.ComptimeFor */) { + else if (node->_typ == 305 /* v.ast.ComptimeFor */) { for (int _t5 = 0; _t5 < (*node->_v__ast__ComptimeFor).stmts.len; ++_t5) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__ComptimeFor).stmts.data) + _t5; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 304 /* v.ast.ConstDecl */) { + else if (node->_typ == 306 /* v.ast.ConstDecl */) { for (int _t6 = 0; _t6 < (*node->_v__ast__ConstDecl).fields.len; ++_t6) { v__ast__ConstField* field = ((v__ast__ConstField*)(*node->_v__ast__ConstDecl).fields.data) + _t6; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } } - else if (node->_typ == 305 /* v.ast.DeferStmt */) { + else if (node->_typ == 307 /* v.ast.DeferStmt */) { for (int _t7 = 0; _t7 < (*node->_v__ast__DeferStmt).stmts.len; ++_t7) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__DeferStmt).stmts.data) + _t7; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 307 /* v.ast.EnumDecl */) { + else if (node->_typ == 309 /* v.ast.EnumDecl */) { } - else if (node->_typ == 308 /* v.ast.ExprStmt */) { + else if (node->_typ == 310 /* v.ast.ExprStmt */) { v__ast__Expr _t8 = {0}; - if ((*node->_v__ast__ExprStmt).expr._typ == 269 /* v.ast.IfExpr */) { + if ((*node->_v__ast__ExprStmt).expr._typ == 271 /* v.ast.IfExpr */) { _t8 = v__transformer__Transformer_expr_stmt_if_expr(t, (voidptr)&/*qq*/(*(*node->_v__ast__ExprStmt).expr._v__ast__IfExpr)); } - else if ((*node->_v__ast__ExprStmt).expr._typ == 278 /* v.ast.MatchExpr */) { + else if ((*node->_v__ast__ExprStmt).expr._typ == 280 /* v.ast.MatchExpr */) { _t8 = v__transformer__Transformer_expr_stmt_match_expr(t, (voidptr)&/*qq*/(*(*node->_v__ast__ExprStmt).expr._v__ast__MatchExpr)); } @@ -63560,11 +61677,11 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 309 /* v.ast.ForCStmt */) { + else if (node->_typ == 311 /* v.ast.ForCStmt */) { v__ast__Stmt _t10 = v__transformer__Transformer_for_c_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__ForCStmt)); return _t10; } - else if (node->_typ == 310 /* v.ast.ForInStmt */) { + else if (node->_typ == 312 /* v.ast.ForInStmt */) { v__transformer__IndexState_indent(t->index, false); for (int _t11 = 0; _t11 < (*node->_v__ast__ForInStmt).stmts.len; ++_t11) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__ForInStmt).stmts.data) + _t11; @@ -63572,50 +61689,50 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 311 /* v.ast.ForStmt */) { + else if (node->_typ == 313 /* v.ast.ForStmt */) { v__ast__Stmt _t12 = v__transformer__Transformer_for_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__ForStmt)); return _t12; } - else if (node->_typ == 312 /* v.ast.GlobalDecl */) { + else if (node->_typ == 314 /* v.ast.GlobalDecl */) { for (int _t13 = 0; _t13 < (*node->_v__ast__GlobalDecl).fields.len; ++_t13) { v__ast__GlobalField* field = ((v__ast__GlobalField*)(*node->_v__ast__GlobalDecl).fields.data) + _t13; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } } - else if (node->_typ == 313 /* v.ast.GotoLabel */) { + else if (node->_typ == 315 /* v.ast.GotoLabel */) { } - else if (node->_typ == 314 /* v.ast.GotoStmt */) { + else if (node->_typ == 316 /* v.ast.GotoStmt */) { t->index->disabled = true; } - else if (node->_typ == 315 /* v.ast.HashStmt */) { + else if (node->_typ == 317 /* v.ast.HashStmt */) { for (int _t14 = 0; _t14 < (*node->_v__ast__HashStmt).ct_conds.len; ++_t14) { v__ast__Expr* cond = ((v__ast__Expr*)(*node->_v__ast__HashStmt).ct_conds.data) + _t14; *cond = v__transformer__Transformer_expr(t, cond); } } - else if (node->_typ == 316 /* v.ast.Import */) { + else if (node->_typ == 318 /* v.ast.Import */) { } - else if (node->_typ == 317 /* v.ast.InterfaceDecl */) { + else if (node->_typ == 319 /* v.ast.InterfaceDecl */) { v__ast__Stmt _t15 = v__transformer__Transformer_interface_decl(t, (voidptr)&/*qq*/(*node->_v__ast__InterfaceDecl)); return _t15; } - else if (node->_typ == 318 /* v.ast.Module */) { + else if (node->_typ == 320 /* v.ast.Module */) { } - else if (node->_typ == 319 /* v.ast.Return */) { + else if (node->_typ == 321 /* v.ast.Return */) { for (int _t16 = 0; _t16 < (*node->_v__ast__Return).exprs.len; ++_t16) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__Return).exprs.data) + _t16; *expr = v__transformer__Transformer_expr(t, expr); } } - else if (node->_typ == 320 /* v.ast.SqlStmt */) { + else if (node->_typ == 322 /* v.ast.SqlStmt */) { } - else if (node->_typ == 321 /* v.ast.StructDecl */) { + else if (node->_typ == 323 /* v.ast.StructDecl */) { for (int _t17 = 0; _t17 < (*node->_v__ast__StructDecl).fields.len; ++_t17) { v__ast__StructField* field = ((v__ast__StructField*)(*node->_v__ast__StructDecl).fields.data) + _t17; field->default_expr = v__transformer__Transformer_expr(t, &/*sum*/field->default_expr); } } - else if (node->_typ == 245 /* v.ast.TypeDecl */) { + else if (node->_typ == 247 /* v.ast.TypeDecl */) { } ; v__ast__Stmt _t18 = *node; @@ -63629,11 +61746,11 @@ v__ast__Stmt v__transformer__Transformer_assert_stmt(v__transformer__Transformer v__ast__Stmt _t1 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(node); return _t1; } - if ((node->expr)._typ == 272 /* v.ast.InfixExpr */) { + if ((node->expr)._typ == 274 /* v.ast.InfixExpr */) { v__ast__Expr right = (*node->expr._v__ast__InfixExpr).right; - if (right._typ == 273 /* v.ast.IntegerLiteral */) { + if (right._typ == 275 /* v.ast.IntegerLiteral */) { v__ast__Expr left = (*node->expr._v__ast__InfixExpr).left; - if ((left)._typ == 288 /* v.ast.SelectorExpr */) { + if ((left)._typ == 290 /* v.ast.SelectorExpr */) { int len = string_int((*right._v__ast__IntegerLiteral).val); if (string__eq((*left._v__ast__SelectorExpr).field_name, _SLIT("len"))) { @@ -63651,9 +61768,9 @@ v__ast__Stmt v__transformer__Transformer_assert_stmt(v__transformer__Transformer } } } - else if (right._typ == 288 /* v.ast.SelectorExpr */) { + else if (right._typ == 290 /* v.ast.SelectorExpr */) { v__ast__Expr left = (*node->expr._v__ast__InfixExpr).left; - if ((left)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((left)._typ == 275 /* v.ast.IntegerLiteral */) { int len = string_int((*left._v__ast__IntegerLiteral).val); if (string__eq((*right._v__ast__SelectorExpr).field_name, _SLIT("len"))) { @@ -63692,7 +61809,7 @@ v__ast__Expr v__transformer__Transformer_expr_stmt_if_expr(v__transformer__Trans v__ast__IfBranch* branch = ((v__ast__IfBranch*)node->branches.data) + i; v__ast__Expr cond = v__transformer__Transformer_expr(t, &/*sum*/branch->cond); *branch = ((v__ast__IfBranch){(*branch).pos,(*branch).body_pos,(*branch).comments,.cond = cond,(*branch).pkg_exist,(*branch).stmts,(*branch).scope,}); - if ((cond)._typ == 252 /* v.ast.BoolLiteral */) { + if ((cond)._typ == 254 /* v.ast.BoolLiteral */) { if ((*cond._v__ast__BoolLiteral).val) { stop_index = i; break; @@ -63751,36 +61868,36 @@ v__ast__Expr v__transformer__Transformer_expr_stmt_match_expr(v__transformer__Tr for (int _t3 = 0; _t3 < branch->exprs.len; ++_t3) { v__ast__Expr* expr = ((v__ast__Expr*)branch->exprs.data) + _t3; *expr = v__transformer__Transformer_expr(t, expr); - if (cond._typ == 252 /* v.ast.BoolLiteral */) { - if ((expr)->_typ == 252 /* v.ast.BoolLiteral */) { - if ((*cond._v__ast__BoolLiteral).val == (/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)->_v__ast__BoolLiteral,(expr)->_typ, 252) /*expected idx: 252, name: v.ast.BoolLiteral */ ).val) { + if (cond._typ == 254 /* v.ast.BoolLiteral */) { + if ((expr)->_typ == 254 /* v.ast.BoolLiteral */) { + if ((*cond._v__ast__BoolLiteral).val == (/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)->_v__ast__BoolLiteral,(expr)->_typ, 254) /*expected idx: 254, name: v.ast.BoolLiteral */ ).val) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 273 /* v.ast.IntegerLiteral */) { - if ((expr)->_typ == 273 /* v.ast.IntegerLiteral */) { - if (string_int((*cond._v__ast__IntegerLiteral).val) == string_int((/* as */ *(v__ast__IntegerLiteral*)__as_cast((expr)->_v__ast__IntegerLiteral,(expr)->_typ, 273) /*expected idx: 273, name: v.ast.IntegerLiteral */ ).val)) { + else if (cond._typ == 275 /* v.ast.IntegerLiteral */) { + if ((expr)->_typ == 275 /* v.ast.IntegerLiteral */) { + if (string_int((*cond._v__ast__IntegerLiteral).val) == string_int((/* as */ *(v__ast__IntegerLiteral*)__as_cast((expr)->_v__ast__IntegerLiteral,(expr)->_typ, 275) /*expected idx: 275, name: v.ast.IntegerLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 266 /* v.ast.FloatLiteral */) { - if ((expr)->_typ == 266 /* v.ast.FloatLiteral */) { - if (string_f32((*cond._v__ast__FloatLiteral).val) == string_f32((/* as */ *(v__ast__FloatLiteral*)__as_cast((expr)->_v__ast__FloatLiteral,(expr)->_typ, 266) /*expected idx: 266, name: v.ast.FloatLiteral */ ).val)) { + else if (cond._typ == 268 /* v.ast.FloatLiteral */) { + if ((expr)->_typ == 268 /* v.ast.FloatLiteral */) { + if (string_f32((*cond._v__ast__FloatLiteral).val) == string_f32((/* as */ *(v__ast__FloatLiteral*)__as_cast((expr)->_v__ast__FloatLiteral,(expr)->_typ, 268) /*expected idx: 268, name: v.ast.FloatLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 292 /* v.ast.StringLiteral */) { - if ((expr)->_typ == 292 /* v.ast.StringLiteral */) { - if (string__eq((*cond._v__ast__StringLiteral).val, (/* as */ *(v__ast__StringLiteral*)__as_cast((expr)->_v__ast__StringLiteral,(expr)->_typ, 292) /*expected idx: 292, name: v.ast.StringLiteral */ ).val)) { + else if (cond._typ == 294 /* v.ast.StringLiteral */) { + if ((expr)->_typ == 294 /* v.ast.StringLiteral */) { + if (string__eq((*cond._v__ast__StringLiteral).val, (/* as */ *(v__ast__StringLiteral*)__as_cast((expr)->_v__ast__StringLiteral,(expr)->_typ, 294) /*expected idx: 294, name: v.ast.StringLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; @@ -63828,8 +61945,8 @@ v__ast__Stmt v__transformer__Transformer_for_c_stmt(v__transformer__Transformer* v__ast__Stmt v__transformer__Transformer_for_stmt(v__transformer__Transformer* t, v__ast__ForStmt* node) { node->cond = v__transformer__Transformer_expr(t, &/*sum*/node->cond); - if (node->cond._typ == 252 /* v.ast.BoolLiteral */) { - if (!(/* as */ *(v__ast__BoolLiteral*)__as_cast((node->cond)._v__ast__BoolLiteral,(node->cond)._typ, 252) /*expected idx: 252, name: v.ast.BoolLiteral */ ).val) { + if (node->cond._typ == 254 /* v.ast.BoolLiteral */) { + if (!(/* as */ *(v__ast__BoolLiteral*)__as_cast((node->cond)._v__ast__BoolLiteral,(node->cond)._typ, 254) /*expected idx: 254, name: v.ast.BoolLiteral */ ).val) { v__ast__Stmt _t1 = v__ast__EmptyStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__EmptyStmt, (((v__ast__EmptyStmt){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); return _t1; } @@ -63864,13 +61981,13 @@ v__ast__Stmt v__transformer__Transformer_interface_decl(v__transformer__Transfor } v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v__ast__Expr* node) { - if (node->_typ == 246 /* v.ast.AnonFn */) { + if (node->_typ == 248 /* v.ast.AnonFn */) { (*node->_v__ast__AnonFn).decl = /* as */ *(v__ast__FnDecl*)__as_cast((v__transformer__Transformer_stmt(t, HEAP(v__ast__Stmt, v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*node->_v__ast__AnonFn).decl))))._v__ast__FnDecl,(v__transformer__Transformer_stmt(t, HEAP(v__ast__Stmt, v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*node->_v__ast__AnonFn).decl))))._typ, 185) /*expected idx: 185, name: v.ast.FnDecl */ ; } - else if (node->_typ == 247 /* v.ast.ArrayDecompose */) { + else if (node->_typ == 249 /* v.ast.ArrayDecompose */) { (*node->_v__ast__ArrayDecompose).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayDecompose).expr); } - else if (node->_typ == 248 /* v.ast.ArrayInit */) { + else if (node->_typ == 250 /* v.ast.ArrayInit */) { for (int _t1 = 0; _t1 < (*node->_v__ast__ArrayInit).exprs.len; ++_t1) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__ArrayInit).exprs.data) + _t1; *expr = v__transformer__Transformer_expr(t, expr); @@ -63879,73 +61996,73 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ (*node->_v__ast__ArrayInit).cap_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayInit).cap_expr); (*node->_v__ast__ArrayInit).default_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayInit).default_expr); } - else if (node->_typ == 249 /* v.ast.AsCast */) { + else if (node->_typ == 251 /* v.ast.AsCast */) { (*node->_v__ast__AsCast).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__AsCast).expr); } - else if (node->_typ == 253 /* v.ast.CTempVar */) { + else if (node->_typ == 255 /* v.ast.CTempVar */) { (*node->_v__ast__CTempVar).orig = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CTempVar).orig); } - else if (node->_typ == 254 /* v.ast.CallExpr */) { + else if (node->_typ == 256 /* v.ast.CallExpr */) { (*node->_v__ast__CallExpr).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CallExpr).left); for (int _t2 = 0; _t2 < (*node->_v__ast__CallExpr).args.len; ++_t2) { v__ast__CallArg* arg = ((v__ast__CallArg*)(*node->_v__ast__CallExpr).args.data) + _t2; arg->expr = v__transformer__Transformer_expr(t, &/*sum*/arg->expr); } - (*node->_v__ast__CallExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._typ, 282) /*expected idx: 282, name: v.ast.OrExpr */ ; + (*node->_v__ast__CallExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._typ, 284) /*expected idx: 284, name: v.ast.OrExpr */ ; } - else if (node->_typ == 255 /* v.ast.CastExpr */) { + else if (node->_typ == 257 /* v.ast.CastExpr */) { (*node->_v__ast__CastExpr).arg = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CastExpr).arg); (*node->_v__ast__CastExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CastExpr).expr); } - else if (node->_typ == 256 /* v.ast.ChanInit */) { + else if (node->_typ == 258 /* v.ast.ChanInit */) { (*node->_v__ast__ChanInit).cap_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ChanInit).cap_expr); } - else if (node->_typ == 259 /* v.ast.ComptimeCall */) { + else if (node->_typ == 261 /* v.ast.ComptimeCall */) { for (int _t3 = 0; _t3 < (*node->_v__ast__ComptimeCall).args.len; ++_t3) { v__ast__CallArg* arg = ((v__ast__CallArg*)(*node->_v__ast__ComptimeCall).args.data) + _t3; arg->expr = v__transformer__Transformer_expr(t, &/*sum*/arg->expr); } } - else if (node->_typ == 260 /* v.ast.ComptimeSelector */) { + else if (node->_typ == 262 /* v.ast.ComptimeSelector */) { (*node->_v__ast__ComptimeSelector).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ComptimeSelector).left); (*node->_v__ast__ComptimeSelector).field_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ComptimeSelector).field_expr); } - else if (node->_typ == 262 /* v.ast.ConcatExpr */) { + else if (node->_typ == 264 /* v.ast.ConcatExpr */) { for (int _t4 = 0; _t4 < (*node->_v__ast__ConcatExpr).vals.len; ++_t4) { v__ast__Expr* val = ((v__ast__Expr*)(*node->_v__ast__ConcatExpr).vals.data) + _t4; *val = v__transformer__Transformer_expr(t, val); } } - else if (node->_typ == 263 /* v.ast.DumpExpr */) { + else if (node->_typ == 265 /* v.ast.DumpExpr */) { (*node->_v__ast__DumpExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__DumpExpr).expr); } - else if (node->_typ == 267 /* v.ast.GoExpr */) { - (*node->_v__ast__GoExpr).call_expr = /* as */ *(v__ast__CallExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._v__ast__CallExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._typ, 254) /*expected idx: 254, name: v.ast.CallExpr */ ; + else if (node->_typ == 269 /* v.ast.GoExpr */) { + (*node->_v__ast__GoExpr).call_expr = /* as */ *(v__ast__CallExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._v__ast__CallExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._typ, 256) /*expected idx: 256, name: v.ast.CallExpr */ ; } - else if (node->_typ == 269 /* v.ast.IfExpr */) { + else if (node->_typ == 271 /* v.ast.IfExpr */) { v__ast__Expr _t5 = v__transformer__Transformer_if_expr(t, (voidptr)&/*qq*/(*node->_v__ast__IfExpr)); return _t5; } - else if (node->_typ == 270 /* v.ast.IfGuardExpr */) { + else if (node->_typ == 272 /* v.ast.IfGuardExpr */) { (*node->_v__ast__IfGuardExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IfGuardExpr).expr); } - else if (node->_typ == 271 /* v.ast.IndexExpr */) { + else if (node->_typ == 273 /* v.ast.IndexExpr */) { v__transformer__Transformer_check_safe_array(t, (voidptr)&/*qq*/(*node->_v__ast__IndexExpr)); (*node->_v__ast__IndexExpr).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IndexExpr).left); (*node->_v__ast__IndexExpr).index = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IndexExpr).index); - (*node->_v__ast__IndexExpr).or_expr = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._typ, 282) /*expected idx: 282, name: v.ast.OrExpr */ ; + (*node->_v__ast__IndexExpr).or_expr = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._typ, 284) /*expected idx: 284, name: v.ast.OrExpr */ ; } - else if (node->_typ == 272 /* v.ast.InfixExpr */) { + else if (node->_typ == 274 /* v.ast.InfixExpr */) { v__ast__Expr _t6 = v__transformer__Transformer_infix_expr(t, (voidptr)&/*qq*/(*node->_v__ast__InfixExpr)); return _t6; } - else if (node->_typ == 274 /* v.ast.IsRefType */) { + else if (node->_typ == 276 /* v.ast.IsRefType */) { (*node->_v__ast__IsRefType).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IsRefType).expr); } - else if (node->_typ == 275 /* v.ast.Likely */) { + else if (node->_typ == 277 /* v.ast.Likely */) { (*node->_v__ast__Likely).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__Likely).expr); } - else if (node->_typ == 276 /* v.ast.LockExpr */) { + else if (node->_typ == 278 /* v.ast.LockExpr */) { for (int _t7 = 0; _t7 < (*node->_v__ast__LockExpr).stmts.len; ++_t7) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__LockExpr).stmts.data) + _t7; *stmt = v__transformer__Transformer_stmt(t, stmt); @@ -63955,7 +62072,7 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ *locked = v__transformer__Transformer_expr(t, locked); } } - else if (node->_typ == 277 /* v.ast.MapInit */) { + else if (node->_typ == 279 /* v.ast.MapInit */) { for (int _t9 = 0; _t9 < (*node->_v__ast__MapInit).keys.len; ++_t9) { v__ast__Expr* key = ((v__ast__Expr*)(*node->_v__ast__MapInit).keys.data) + _t9; *key = v__transformer__Transformer_expr(t, key); @@ -63965,31 +62082,31 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ *val = v__transformer__Transformer_expr(t, val); } } - else if (node->_typ == 278 /* v.ast.MatchExpr */) { + else if (node->_typ == 280 /* v.ast.MatchExpr */) { v__ast__Expr _t11 = v__transformer__Transformer_match_expr(t, (voidptr)&/*qq*/(*node->_v__ast__MatchExpr)); return _t11; } - else if (node->_typ == 282 /* v.ast.OrExpr */) { + else if (node->_typ == 284 /* v.ast.OrExpr */) { for (int _t12 = 0; _t12 < (*node->_v__ast__OrExpr).stmts.len; ++_t12) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__OrExpr).stmts.data) + _t12; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 283 /* v.ast.ParExpr */) { + else if (node->_typ == 285 /* v.ast.ParExpr */) { (*node->_v__ast__ParExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ParExpr).expr); } - else if (node->_typ == 284 /* v.ast.PostfixExpr */) { + else if (node->_typ == 286 /* v.ast.PostfixExpr */) { (*node->_v__ast__PostfixExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__PostfixExpr).expr); } - else if (node->_typ == 285 /* v.ast.PrefixExpr */) { + else if (node->_typ == 287 /* v.ast.PrefixExpr */) { (*node->_v__ast__PrefixExpr).right = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__PrefixExpr).right); - (*node->_v__ast__PrefixExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._typ, 282) /*expected idx: 282, name: v.ast.OrExpr */ ; + (*node->_v__ast__PrefixExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._typ, 284) /*expected idx: 284, name: v.ast.OrExpr */ ; } - else if (node->_typ == 286 /* v.ast.RangeExpr */) { + else if (node->_typ == 288 /* v.ast.RangeExpr */) { (*node->_v__ast__RangeExpr).low = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__RangeExpr).low); (*node->_v__ast__RangeExpr).high = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__RangeExpr).high); } - else if (node->_typ == 287 /* v.ast.SelectExpr */) { + else if (node->_typ == 289 /* v.ast.SelectExpr */) { for (int _t13 = 0; _t13 < (*node->_v__ast__SelectExpr).branches.len; ++_t13) { v__ast__SelectBranch* branch = ((v__ast__SelectBranch*)(*node->_v__ast__SelectExpr).branches.data) + _t13; branch->stmt = v__transformer__Transformer_stmt(t, &/*sum*/branch->stmt); @@ -63999,27 +62116,27 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ } } } - else if (node->_typ == 288 /* v.ast.SelectorExpr */) { + else if (node->_typ == 290 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); - if (((*node->_v__ast__SelectorExpr).expr)._typ == 292 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { + if (((*node->_v__ast__SelectorExpr).expr)._typ == 294 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); return _t15; } } - else if (node->_typ == 289 /* v.ast.SizeOf */) { + else if (node->_typ == 291 /* v.ast.SizeOf */) { (*node->_v__ast__SizeOf).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SizeOf).expr); } - else if (node->_typ == 290 /* v.ast.SqlExpr */) { + else if (node->_typ == 292 /* v.ast.SqlExpr */) { v__ast__Expr _t16 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); return _t16; } - else if (node->_typ == 291 /* v.ast.StringInterLiteral */) { + else if (node->_typ == 293 /* v.ast.StringInterLiteral */) { for (int _t17 = 0; _t17 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t17) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t17; *expr = v__transformer__Transformer_expr(t, expr); } } - else if (node->_typ == 293 /* v.ast.StructInit */) { + else if (node->_typ == 295 /* v.ast.StructInit */) { (*node->_v__ast__StructInit).update_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__StructInit).update_expr); for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).fields.len; ++_t18) { v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t18; @@ -64030,7 +62147,7 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ embed->expr = v__transformer__Transformer_expr(t, &/*sum*/embed->expr); } } - else if (node->_typ == 296 /* v.ast.UnsafeExpr */) { + else if (node->_typ == 298 /* v.ast.UnsafeExpr */) { (*node->_v__ast__UnsafeExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__UnsafeExpr).expr); } @@ -64060,8 +62177,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* v__ast__Expr _t1 = v__ast__InfixExpr_to_sumtype_v__ast__Expr(node); return _t1; } else { - if (node->left._typ == 252 /* v.ast.BoolLiteral */) { - if (node->right._typ == 252 /* v.ast.BoolLiteral */) { + if (node->left._typ == 254 /* v.ast.BoolLiteral */) { + if (node->right._typ == 254 /* v.ast.BoolLiteral */) { if (node->op == (v__token__Kind__eq)) { v__ast__Expr _t2 = v__ast__BoolLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__BoolLiteral, (((v__ast__BoolLiteral){.val = (*node->left._v__ast__BoolLiteral).val == (*node->right._v__ast__BoolLiteral).val,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); @@ -64087,8 +62204,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 292 /* v.ast.StringLiteral */) { - if (node->right._typ == 292 /* v.ast.StringLiteral */) { + else if (node->left._typ == 294 /* v.ast.StringLiteral */) { + if (node->right._typ == 294 /* v.ast.StringLiteral */) { if (node->op == (v__token__Kind__eq)) { v__ast__Expr _t6 = v__ast__BoolLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__BoolLiteral, (((v__ast__BoolLiteral){.val = string__eq((*node->left._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).val),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); @@ -64110,8 +62227,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 273 /* v.ast.IntegerLiteral */) { - if (node->right._typ == 273 /* v.ast.IntegerLiteral */) { + else if (node->left._typ == 275 /* v.ast.IntegerLiteral */) { + if (node->right._typ == 275 /* v.ast.IntegerLiteral */) { i64 left_val = string_i64((*node->left._v__ast__IntegerLiteral).val); i64 right_val = string_i64((*node->right._v__ast__IntegerLiteral).val); switch (node->op) { @@ -64331,8 +62448,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 266 /* v.ast.FloatLiteral */) { - if (node->right._typ == 266 /* v.ast.FloatLiteral */) { + else if (node->left._typ == 268 /* v.ast.FloatLiteral */) { + if (node->right._typ == 268 /* v.ast.FloatLiteral */) { f32 left_val = string_f32((*node->left._v__ast__FloatLiteral).val); f32 right_val = string_f32((*node->right._v__ast__FloatLiteral).val); switch (node->op) { @@ -64532,16 +62649,16 @@ v__ast__Expr v__transformer__Transformer_if_expr(v__transformer__Transformer* t, v__ast__Stmt* stmt = ((v__ast__Stmt*)branch->stmts.data) + i; *stmt = v__transformer__Transformer_stmt(t, stmt); if (i == branch->stmts.len - 1) { - if ((stmt)->_typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 310 /* v.ast.ExprStmt */) { v__ast__Expr expr = (*stmt->_v__ast__ExprStmt).expr; - if (expr._typ == 269 /* v.ast.IfExpr */) { + if (expr._typ == 271 /* v.ast.IfExpr */) { if ((*expr._v__ast__IfExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__IfBranch*)/*ee elem_sym */array_get((*expr._v__ast__IfExpr).branches, 0)).stmts), _t2, Array_v__ast__Stmt); break; } } - else if (expr._typ == 278 /* v.ast.MatchExpr */) { + else if (expr._typ == 280 /* v.ast.MatchExpr */) { if ((*expr._v__ast__MatchExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__MatchBranch*)/*ee elem_sym */array_get((*expr._v__ast__MatchExpr).branches, 0)).stmts), _t3, Array_v__ast__Stmt); @@ -64575,16 +62692,16 @@ v__ast__Expr v__transformer__Transformer_match_expr(v__transformer__Transformer* v__ast__Stmt* stmt = ((v__ast__Stmt*)branch->stmts.data) + i; *stmt = v__transformer__Transformer_stmt(t, stmt); if (i == branch->stmts.len - 1) { - if ((stmt)->_typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 310 /* v.ast.ExprStmt */) { v__ast__Expr expr = (*stmt->_v__ast__ExprStmt).expr; - if (expr._typ == 269 /* v.ast.IfExpr */) { + if (expr._typ == 271 /* v.ast.IfExpr */) { if ((*expr._v__ast__IfExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__IfBranch*)/*ee elem_sym */array_get((*expr._v__ast__IfExpr).branches, 0)).stmts), _t3, Array_v__ast__Stmt); break; } } - else if (expr._typ == 278 /* v.ast.MatchExpr */) { + else if (expr._typ == 280 /* v.ast.MatchExpr */) { if ((*expr._v__ast__MatchExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__MatchBranch*)/*ee elem_sym */array_get((*expr._v__ast__MatchExpr).branches, 0)).stmts), _t4, Array_v__ast__Stmt); @@ -64633,7 +62750,7 @@ v__ast__Expr v__transformer__Transformer_sql_expr(v__transformer__Transformer* t } if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} v__ast__SqlExpr* sub_struct = &(*(v__ast__SqlExpr*)DenseArray_value(&_t2.key_values, _t3)); - *sub_struct = /* as */ *(v__ast__SqlExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._v__ast__SqlExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._typ, 290) /*expected idx: 290, name: v.ast.SqlExpr */ ; + *sub_struct = /* as */ *(v__ast__SqlExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._v__ast__SqlExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._typ, 292) /*expected idx: 292, name: v.ast.SqlExpr */ ; } v__ast__Expr _t6 = v__ast__SqlExpr_to_sumtype_v__ast__Expr(node); return _t6; @@ -64647,20 +62764,20 @@ bool v__markused__mark_used_defer_0 = false; Map_string_v__ast__GlobalField all_globals = mr_434.arg2; v__util__timing_start(_SLIT("mark_used")); v__markused__mark_used_defer_0 = true; - Array_string all_fn_root_names = new_array_from_c_array(100, 100, sizeof(string), _MOV((string[100]){ + Array_string all_fn_root_names = new_array_from_c_array(101, 101, sizeof(string), _MOV((string[101]){ _SLIT("main.main"), _SLIT("__new_array"), _SLIT("str_intp"), _SLIT("format_sb"), _SLIT("__new_array_with_default"), _SLIT("__new_array_with_array_default"), _SLIT("v_realloc"), _SLIT("malloc"), _SLIT("malloc_noscan"), _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("vstrlen"), _SLIT("__as_cast"), _SLIT("tos"), - _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok"), _SLIT("opt_ok2"), _SLIT("error"), _SLIT("utf8_str_visible_length"), _SLIT("compare_ints"), - _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), _SLIT("3.vstring_with_len"), - _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), _SLIT("20.repeat"), - _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), _SLIT("20.at_with_check"), - _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), _SLIT("fast_string_eq"), - _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), _SLIT("22.first"), - _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), _SLIT("61.get"), - _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), _SLIT("65558.set"), - _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), _SLIT("json.encode_bool"), - _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), _SLIT("os.getwd"), - _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); + _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), _SLIT("utf8_str_visible_length"), + _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), + _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), + _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), + _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), + _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), + _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), + _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), + _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), + _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), + _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); if (pref->is_bare) { _PUSH_MANY(&all_fn_root_names, (new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("strlen"), _SLIT("memcmp"), _SLIT("memcpy"), _SLIT("realloc"), _SLIT("vsnprintf"), _SLIT("vsprintf")}))), _t1, Array_string); } @@ -64775,10 +62892,10 @@ bool v__markused__mark_used_defer_0 = false; if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 436 /* v.ast.Interface */) { + if ((isym->info)._typ != 438 /* v.ast.Interface */) { continue; } - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (interface_info.methods.len == 0) { continue; } @@ -64996,9 +63113,12 @@ VV_LOCAL_SYMBOL multi_return_Map_string_v__ast__FnDecl_Map_string_v__ast__ConstF bool v__markused__all_fn_const_and_global_defer_0 = false; v__util__timing_start(_SLIT("all_fn_const_and_global")); v__markused__all_fn_const_and_global_defer_0 = true; - Map_string_v__ast__FnDecl all_fns = new_map(sizeof(string), sizeof(v__ast__FnDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_v__ast__ConstField all_consts = new_map(sizeof(string), sizeof(v__ast__ConstField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_v__ast__GlobalField all_globals = new_map(sizeof(string), sizeof(v__ast__GlobalField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__FnDecl all_fns = new_map(sizeof(string), sizeof(v__ast__FnDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_v__ast__ConstField all_consts = new_map(sizeof(string), sizeof(v__ast__ConstField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_v__ast__GlobalField all_globals = new_map(sizeof(string), sizeof(v__ast__GlobalField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < ast_files.len; ++i) { v__ast__File* file = (*(v__ast__File**)/*ee elem_sym */array_get(ast_files, i)); for (int _t1 = 0; _t1 < file->stmts.len; ++_t1) { @@ -65007,14 +63127,14 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); (*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } - else if (node._typ == 304 /* v.ast.ConstDecl */) { + else if (node._typ == 306 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { v__ast__ConstField cfield = ((v__ast__ConstField*)(*node._v__ast__ConstDecl).fields.data)[_t2]; string ckey = cfield.name; (*(v__ast__ConstField*)map_get_and_set((map*)&all_consts, &(string[]){ckey}, &(v__ast__ConstField[]){ (v__ast__ConstField){.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_markused = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.comptime_expr_value = v__ast__empty_comptime_const_expr(),} })) = cfield; } } - else if (node._typ == 312 /* v.ast.GlobalDecl */) { + else if (node._typ == 314 /* v.ast.GlobalDecl */) { 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; @@ -65191,43 +63311,43 @@ void v__markused__Walker_mark_markused_globals(v__markused__Walker* w) { void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { v__ast__Stmt node = node_; - if (node._typ == 306 /* v.ast.EmptyStmt */) { + if (node._typ == 308 /* v.ast.EmptyStmt */) { } - else if (node._typ == 298 /* v.ast.AsmStmt */) { + else if (node._typ == 300 /* v.ast.AsmStmt */) { v__markused__Walker_asm_io(w, (*node._v__ast__AsmStmt).output); v__markused__Walker_asm_io(w, (*node._v__ast__AsmStmt).input); } - else if (node._typ == 299 /* v.ast.AssertStmt */) { + else if (node._typ == 301 /* v.ast.AssertStmt */) { if ((*node._v__ast__AssertStmt).is_used) { v__markused__Walker_expr(w, (*node._v__ast__AssertStmt).expr); w->n_asserts++; } } - else if (node._typ == 300 /* v.ast.AssignStmt */) { + else if (node._typ == 302 /* v.ast.AssignStmt */) { v__markused__Walker_exprs(w, (*node._v__ast__AssignStmt).left); v__markused__Walker_exprs(w, (*node._v__ast__AssignStmt).right); } - else if (node._typ == 301 /* v.ast.Block */) { + else if (node._typ == 303 /* v.ast.Block */) { v__markused__Walker_stmts(w, (*node._v__ast__Block).stmts); } - else if (node._typ == 303 /* v.ast.ComptimeFor */) { + else if (node._typ == 305 /* v.ast.ComptimeFor */) { v__markused__Walker_stmts(w, (*node._v__ast__ComptimeFor).stmts); } - else if (node._typ == 304 /* v.ast.ConstDecl */) { + else if (node._typ == 306 /* v.ast.ConstDecl */) { v__markused__Walker_const_fields(w, (*node._v__ast__ConstDecl).fields); } - else if (node._typ == 308 /* v.ast.ExprStmt */) { + else if (node._typ == 310 /* v.ast.ExprStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ExprStmt).expr); } else if (node._typ == 185 /* v.ast.FnDecl */) { v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*node._v__ast__FnDecl)); } - else if (node._typ == 309 /* v.ast.ForCStmt */) { + else if (node._typ == 311 /* v.ast.ForCStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForCStmt).cond); v__markused__Walker_stmt(w, (*node._v__ast__ForCStmt).inc); v__markused__Walker_stmts(w, (*node._v__ast__ForCStmt).stmts); } - else if (node._typ == 310 /* v.ast.ForInStmt */) { + else if (node._typ == 312 /* v.ast.ForInStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForInStmt).cond); v__markused__Walker_expr(w, (*node._v__ast__ForInStmt).high); v__markused__Walker_stmts(w, (*node._v__ast__ForInStmt).stmts); @@ -65246,14 +63366,14 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { } } } - else if (node._typ == 311 /* v.ast.ForStmt */) { + else if (node._typ == 313 /* v.ast.ForStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForStmt).cond); v__markused__Walker_stmts(w, (*node._v__ast__ForStmt).stmts); } - else if (node._typ == 319 /* v.ast.Return */) { + else if (node._typ == 321 /* v.ast.Return */) { v__markused__Walker_exprs(w, (*node._v__ast__Return).exprs); } - else if (node._typ == 320 /* v.ast.SqlStmt */) { + else if (node._typ == 322 /* v.ast.SqlStmt */) { v__markused__Walker_expr(w, (*node._v__ast__SqlStmt).db_expr); for (int _t2 = 0; _t2 < (*node._v__ast__SqlStmt).lines.len; ++_t2) { v__ast__SqlStmtLine line = ((v__ast__SqlStmtLine*)(*node._v__ast__SqlStmt).lines.data)[_t2]; @@ -65261,13 +63381,13 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { v__markused__Walker_exprs(w, line.update_exprs); } } - else if (node._typ == 321 /* v.ast.StructDecl */) { + else if (node._typ == 323 /* v.ast.StructDecl */) { v__markused__Walker_struct_fields(w, (*node._v__ast__StructDecl).fields); } - else if (node._typ == 305 /* v.ast.DeferStmt */) { + else if (node._typ == 307 /* v.ast.DeferStmt */) { v__markused__Walker_stmts(w, (*node._v__ast__DeferStmt).stmts); } - else if (node._typ == 312 /* v.ast.GlobalDecl */) { + else if (node._typ == 314 /* v.ast.GlobalDecl */) { for (int _t3 = 0; _t3 < (*node._v__ast__GlobalDecl).fields.len; ++_t3) { v__ast__GlobalField gf = ((v__ast__GlobalField*)(*node._v__ast__GlobalDecl).fields.data)[_t3]; if (gf.has_expr) { @@ -65275,25 +63395,25 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { } } } - else if (node._typ == 302 /* v.ast.BranchStmt */) { + else if (node._typ == 304 /* v.ast.BranchStmt */) { } - else if (node._typ == 307 /* v.ast.EnumDecl */) { + else if (node._typ == 309 /* v.ast.EnumDecl */) { } - else if (node._typ == 313 /* v.ast.GotoLabel */) { + else if (node._typ == 315 /* v.ast.GotoLabel */) { } - else if (node._typ == 314 /* v.ast.GotoStmt */) { + else if (node._typ == 316 /* v.ast.GotoStmt */) { } - else if (node._typ == 315 /* v.ast.HashStmt */) { + else if (node._typ == 317 /* v.ast.HashStmt */) { } - else if (node._typ == 316 /* v.ast.Import */) { + else if (node._typ == 318 /* v.ast.Import */) { } - else if (node._typ == 317 /* v.ast.InterfaceDecl */) { + else if (node._typ == 319 /* v.ast.InterfaceDecl */) { } - else if (node._typ == 318 /* v.ast.Module */) { + else if (node._typ == 320 /* v.ast.Module */) { } - else if (node._typ == 245 /* v.ast.TypeDecl */) { + else if (node._typ == 247 /* v.ast.TypeDecl */) { } - else if (node._typ == 279 /* v.ast.NodeError */) { + else if (node._typ == 281 /* v.ast.NodeError */) { } ; } @@ -65328,54 +63448,54 @@ VV_LOCAL_SYMBOL void v__markused__Walker_exprs(v__markused__Walker* w, Array_v__ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Expr node_) { v__ast__Expr node = node_; - if (node._typ == 264 /* v.ast.EmptyExpr */) { + if (node._typ == 266 /* v.ast.EmptyExpr */) { } - else if (node._typ == 261 /* v.ast.ComptimeType */) { + else if (node._typ == 263 /* v.ast.ComptimeType */) { } - else if (node._typ == 246 /* v.ast.AnonFn */) { + else if (node._typ == 248 /* v.ast.AnonFn */) { v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*node._v__ast__AnonFn).decl); } - else if (node._typ == 248 /* v.ast.ArrayInit */) { + else if (node._typ == 250 /* v.ast.ArrayInit */) { v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).len_expr); v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).cap_expr); v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).default_expr); v__markused__Walker_exprs(w, (*node._v__ast__ArrayInit).exprs); } - else if (node._typ == 250 /* v.ast.Assoc */) { + else if (node._typ == 252 /* v.ast.Assoc */) { v__markused__Walker_exprs(w, (*node._v__ast__Assoc).exprs); } - else if (node._typ == 247 /* v.ast.ArrayDecompose */) { + else if (node._typ == 249 /* v.ast.ArrayDecompose */) { v__markused__Walker_expr(w, (*node._v__ast__ArrayDecompose).expr); } - else if (node._typ == 254 /* v.ast.CallExpr */) { + else if (node._typ == 256 /* v.ast.CallExpr */) { v__markused__Walker_call_expr(w, (voidptr)&/*qq*/(*node._v__ast__CallExpr)); } - else if (node._typ == 255 /* v.ast.CastExpr */) { + else if (node._typ == 257 /* v.ast.CastExpr */) { v__markused__Walker_expr(w, (*node._v__ast__CastExpr).expr); v__markused__Walker_expr(w, (*node._v__ast__CastExpr).arg); } - else if (node._typ == 256 /* v.ast.ChanInit */) { + else if (node._typ == 258 /* v.ast.ChanInit */) { v__markused__Walker_expr(w, (*node._v__ast__ChanInit).cap_expr); } - else if (node._typ == 262 /* v.ast.ConcatExpr */) { + else if (node._typ == 264 /* v.ast.ConcatExpr */) { v__markused__Walker_exprs(w, (*node._v__ast__ConcatExpr).vals); } - else if (node._typ == 260 /* v.ast.ComptimeSelector */) { + else if (node._typ == 262 /* v.ast.ComptimeSelector */) { v__markused__Walker_expr(w, (*node._v__ast__ComptimeSelector).left); v__markused__Walker_expr(w, (*node._v__ast__ComptimeSelector).field_expr); } - else if (node._typ == 259 /* v.ast.ComptimeCall */) { + else if (node._typ == 261 /* v.ast.ComptimeCall */) { v__markused__Walker_expr(w, (*node._v__ast__ComptimeCall).left); if ((*node._v__ast__ComptimeCall).is_vweb) { v__markused__Walker_stmts(w, (*node._v__ast__ComptimeCall).vweb_tmpl.stmts); } } - else if (node._typ == 263 /* v.ast.DumpExpr */) { + else if (node._typ == 265 /* v.ast.DumpExpr */) { v__markused__Walker_expr(w, (*node._v__ast__DumpExpr).expr); v__markused__Walker_fn_by_name(w, _SLIT("eprint")); v__markused__Walker_fn_by_name(w, _SLIT("eprintln")); } - else if (node._typ == 267 /* v.ast.GoExpr */) { + else if (node._typ == 269 /* v.ast.GoExpr */) { v__markused__Walker_expr(w, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node._v__ast__GoExpr).call_expr)); if (w->pref->os == v__pref__OS__windows) { v__markused__Walker_fn_by_name(w, _SLIT("panic_lasterr")); @@ -65385,7 +63505,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_fn_by_name(w, _SLIT("panic_error_number")); } } - else if (node._typ == 271 /* v.ast.IndexExpr */) { + else if (node._typ == 273 /* v.ast.IndexExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IndexExpr).left); v__markused__Walker_expr(w, (*node._v__ast__IndexExpr).index); v__markused__Walker_or_block(w, (*node._v__ast__IndexExpr).or_expr); @@ -65397,7 +63517,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex w->table->used_maps++; } } - else if (node._typ == 272 /* v.ast.InfixExpr */) { + else if (node._typ == 274 /* v.ast.InfixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__InfixExpr).left); v__markused__Walker_expr(w, (*node._v__ast__InfixExpr).right); v__markused__Walker_or_block(w, (*node._v__ast__InfixExpr).or_block); @@ -65420,10 +63540,10 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex w->table->used_maps++; } } - else if (node._typ == 270 /* v.ast.IfGuardExpr */) { + else if (node._typ == 272 /* v.ast.IfGuardExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IfGuardExpr).expr); } - else if (node._typ == 269 /* v.ast.IfExpr */) { + else if (node._typ == 271 /* v.ast.IfExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IfExpr).left); for (int _t2 = 0; _t2 < (*node._v__ast__IfExpr).branches.len; ++_t2) { v__ast__IfBranch b = ((v__ast__IfBranch*)(*node._v__ast__IfExpr).branches.data)[_t2]; @@ -65431,7 +63551,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_stmts(w, b.stmts); } } - else if (node._typ == 268 /* v.ast.Ident */) { + else if (node._typ == 270 /* v.ast.Ident */) { if ((*node._v__ast__Ident).kind == (v__ast__IdentKind__constant)) { v__markused__Walker_mark_const_as_used(w, (*node._v__ast__Ident).name); @@ -65445,15 +63565,15 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex else { }; } - else if (node._typ == 275 /* v.ast.Likely */) { + else if (node._typ == 277 /* v.ast.Likely */) { v__markused__Walker_expr(w, (*node._v__ast__Likely).expr); } - else if (node._typ == 277 /* v.ast.MapInit */) { + else if (node._typ == 279 /* v.ast.MapInit */) { v__markused__Walker_exprs(w, (*node._v__ast__MapInit).keys); v__markused__Walker_exprs(w, (*node._v__ast__MapInit).vals); w->table->used_maps++; } - else if (node._typ == 278 /* v.ast.MatchExpr */) { + else if (node._typ == 280 /* v.ast.MatchExpr */) { v__markused__Walker_expr(w, (*node._v__ast__MatchExpr).cond); for (int _t3 = 0; _t3 < (*node._v__ast__MatchExpr).branches.len; ++_t3) { v__ast__MatchBranch b = ((v__ast__MatchBranch*)(*node._v__ast__MatchExpr).branches.data)[_t3]; @@ -65461,18 +63581,18 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_stmts(w, b.stmts); } } - else if (node._typ == 280 /* v.ast.None */) { + else if (node._typ == 282 /* v.ast.None */) { } - else if (node._typ == 283 /* v.ast.ParExpr */) { + else if (node._typ == 285 /* v.ast.ParExpr */) { v__markused__Walker_expr(w, (*node._v__ast__ParExpr).expr); } - else if (node._typ == 285 /* v.ast.PrefixExpr */) { + else if (node._typ == 287 /* v.ast.PrefixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__PrefixExpr).right); } - else if (node._typ == 284 /* v.ast.PostfixExpr */) { + else if (node._typ == 286 /* v.ast.PostfixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__PostfixExpr).expr); } - else if (node._typ == 286 /* v.ast.RangeExpr */) { + else if (node._typ == 288 /* v.ast.RangeExpr */) { if ((*node._v__ast__RangeExpr).has_low) { v__markused__Walker_expr(w, (*node._v__ast__RangeExpr).low); } @@ -65480,16 +63600,16 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_expr(w, (*node._v__ast__RangeExpr).high); } } - else if (node._typ == 289 /* v.ast.SizeOf */) { + else if (node._typ == 291 /* v.ast.SizeOf */) { v__markused__Walker_expr(w, (*node._v__ast__SizeOf).expr); } - else if (node._typ == 274 /* v.ast.IsRefType */) { + else if (node._typ == 276 /* v.ast.IsRefType */) { v__markused__Walker_expr(w, (*node._v__ast__IsRefType).expr); } - else if (node._typ == 291 /* v.ast.StringInterLiteral */) { + else if (node._typ == 293 /* v.ast.StringInterLiteral */) { v__markused__Walker_exprs(w, (*node._v__ast__StringInterLiteral).exprs); } - else if (node._typ == 288 /* v.ast.SelectorExpr */) { + else if (node._typ == 290 /* v.ast.SelectorExpr */) { v__markused__Walker_expr(w, (*node._v__ast__SelectorExpr).expr); if ((*node._v__ast__SelectorExpr).expr_type != 0) { _option_v__ast__Fn _t4; @@ -65499,20 +63619,20 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex } } } - else if (node._typ == 290 /* v.ast.SqlExpr */) { + else if (node._typ == 292 /* v.ast.SqlExpr */) { v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).db_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).offset_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).order_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).limit_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).where_expr); } - else if (node._typ == 293 /* v.ast.StructInit */) { + else if (node._typ == 295 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).typ == 0) { return; } v__ast__TypeSymbol* sym = v__ast__Table_sym(w->table, (*node._v__ast__StructInit).typ); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; for (int _t5 = 0; _t5 < info.fields.len; ++_t5) { v__ast__StructField ifield = ((v__ast__StructField*)info.fields.data)[_t5]; if (ifield.has_default_expr) { @@ -65538,52 +63658,52 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_expr(w, sie.expr); } } - else if (node._typ == 295 /* v.ast.TypeOf */) { + else if (node._typ == 297 /* v.ast.TypeOf */) { v__markused__Walker_expr(w, (*node._v__ast__TypeOf).expr); } - else if (node._typ == 249 /* v.ast.AsCast */) { + else if (node._typ == 251 /* v.ast.AsCast */) { v__markused__Walker_expr(w, (*node._v__ast__AsCast).expr); } - else if (node._typ == 251 /* v.ast.AtExpr */) { + else if (node._typ == 253 /* v.ast.AtExpr */) { } - else if (node._typ == 252 /* v.ast.BoolLiteral */) { + else if (node._typ == 254 /* v.ast.BoolLiteral */) { } - else if (node._typ == 266 /* v.ast.FloatLiteral */) { + else if (node._typ == 268 /* v.ast.FloatLiteral */) { } - else if (node._typ == 257 /* v.ast.CharLiteral */) { + else if (node._typ == 259 /* v.ast.CharLiteral */) { } - else if (node._typ == 273 /* v.ast.IntegerLiteral */) { + else if (node._typ == 275 /* v.ast.IntegerLiteral */) { } - else if (node._typ == 292 /* v.ast.StringLiteral */) { + else if (node._typ == 294 /* v.ast.StringLiteral */) { } - else if (node._typ == 253 /* v.ast.CTempVar */) { + else if (node._typ == 255 /* v.ast.CTempVar */) { v__markused__Walker_expr(w, (*node._v__ast__CTempVar).orig); } - else if (node._typ == 258 /* v.ast.Comment */) { + else if (node._typ == 260 /* v.ast.Comment */) { } - else if (node._typ == 265 /* v.ast.EnumVal */) { + else if (node._typ == 267 /* v.ast.EnumVal */) { } - else if (node._typ == 276 /* v.ast.LockExpr */) { + else if (node._typ == 278 /* v.ast.LockExpr */) { v__markused__Walker_stmts(w, (*node._v__ast__LockExpr).stmts); } - else if (node._typ == 281 /* v.ast.OffsetOf */) { + else if (node._typ == 283 /* v.ast.OffsetOf */) { } - else if (node._typ == 282 /* v.ast.OrExpr */) { + else if (node._typ == 284 /* v.ast.OrExpr */) { v__markused__Walker_or_block(w, (*node._v__ast__OrExpr)); } - else if (node._typ == 287 /* v.ast.SelectExpr */) { + else if (node._typ == 289 /* v.ast.SelectExpr */) { for (int _t8 = 0; _t8 < (*node._v__ast__SelectExpr).branches.len; ++_t8) { v__ast__SelectBranch branch = ((v__ast__SelectBranch*)(*node._v__ast__SelectExpr).branches.data)[_t8]; v__markused__Walker_stmt(w, branch.stmt); v__markused__Walker_stmts(w, branch.stmts); } } - else if (node._typ == 294 /* v.ast.TypeNode */) { + else if (node._typ == 296 /* v.ast.TypeNode */) { } - else if (node._typ == 296 /* v.ast.UnsafeExpr */) { + else if (node._typ == 298 /* v.ast.UnsafeExpr */) { v__markused__Walker_expr(w, (*node._v__ast__UnsafeExpr).expr); } - else if (node._typ == 279 /* v.ast.NodeError */) { + else if (node._typ == 281 /* v.ast.NodeError */) { } ; } @@ -65722,7 +63842,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } for (int i = 0; i < node.exprs.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.exprs.data)[i]; - if (v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i)), _const_v__ast__string_type) && (expr)._typ != 292 /* v.ast.StringLiteral */ && (expr)._typ != 291 /* v.ast.StringInterLiteral */) { + if (v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i)), _const_v__ast__string_type) && (expr)._typ != 294 /* v.ast.StringLiteral */ && (expr)._typ != 293 /* v.ast.StringInterLiteral */) { v__gen__c__Gen_write(g, _SLIT("string_clone(")); v__gen__c__Gen_expr(g, expr); v__gen__c__Gen_write(g, _SLIT(")")); @@ -65779,7 +63899,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_write(g, _SLIT("0")); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; for (int _t1 = 1; _t1 < info.size; ++_t1) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_write(g, _SLIT("0")); @@ -65837,7 +63957,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_expr(g, node.default_expr); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; for (int _t2 = 1; _t2 < info.size; ++_t2) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_expr(g, node.default_expr); @@ -66002,9 +64122,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal string ret_typ = v__gen__c__Gen_typ(g, node.return_type); v__ast__TypeSymbol* ret_sym = v__ast__Table_sym(g->table, node.return_type); v__ast__TypeSymbol* inp_sym = v__ast__Table_sym(g->table, node.receiver_type); - v__ast__Array ret_info = /* as */ *(v__ast__Array*)__as_cast((ret_sym->info)._v__ast__Array,(ret_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array ret_info = /* as */ *(v__ast__Array*)__as_cast((ret_sym->info)._v__ast__Array,(ret_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string ret_elem_type = v__gen__c__Gen_typ(g, ret_info.elem_type); - v__ast__Array inp_info = /* as */ *(v__ast__Array*)__as_cast((inp_sym->info)._v__ast__Array,(inp_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array inp_info = /* as */ *(v__ast__Array*)__as_cast((inp_sym->info)._v__ast__Array,(inp_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string inp_elem_type = v__gen__c__Gen_typ(g, inp_info.elem_type); if (inp_sym->kind != v__ast__Kind__array) { v__gen__c__verror(_SLIT("map() requires an array")); @@ -66035,12 +64155,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 246 /* v.ast.AnonFn */) { + if (expr._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_elem_type}}, {_SLIT(" ti = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_elem_type}}, {_SLIT(" ti = "), 0, { .d_c = 0 }}}))); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -66056,7 +64176,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -66102,7 +64222,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca v__gen__c__Gen_writeln(g, _SLIT("bare_panic(_SLIT(\"sort does not work with -freestanding\"))")); return; } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((rec_sym->info)._v__ast__Array,(rec_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((rec_sym->info)._v__ast__Array,(rec_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_stype = v__gen__c__Gen_typ(g, info.elem_type); string compare_fn = str_intp(3, _MOV((StrIntpData[]){{_SLIT("compare_"), /*117 &u64*/0xfe08, {.d_u64 = g->unique_file_path_hash}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = string_replace(elem_stype, _SLIT("*"), _SLIT("_ptr"))}}, {_SLIT0, 0, { .d_c = 0 }}})); v__gen__c__Type comparison_type = v__gen__c__Gen_unwrap(g, _const_v__ast__void_type); @@ -66121,7 +64241,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca left_expr = _SLIT("*a"); right_expr = _SLIT("*b"); } else { - v__ast__InfixExpr infix_expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__InfixExpr,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ; + v__ast__InfixExpr infix_expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__InfixExpr,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ; comparison_type = v__gen__c__Gen_unwrap(g, v__ast__Type_set_nr_muls(infix_expr.left_type, 0)); string left_name = v__ast__Expr_str(infix_expr.left); if (left_name.len > 1) { @@ -66142,19 +64262,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca if (string_starts_with(left_name, _SLIT("a")) != is_reverse) { left_expr = v__gen__c__Gen_expr_string(g, infix_expr.left); right_expr = v__gen__c__Gen_expr_string(g, infix_expr.right); - if ((infix_expr.left)._typ == 268 /* v.ast.Ident */) { + if ((infix_expr.left)._typ == 270 /* v.ast.Ident */) { left_expr = string__plus(_SLIT("*"), left_expr); } - if ((infix_expr.right)._typ == 268 /* v.ast.Ident */) { + if ((infix_expr.right)._typ == 270 /* v.ast.Ident */) { right_expr = string__plus(_SLIT("*"), right_expr); } } else { left_expr = v__gen__c__Gen_expr_string(g, infix_expr.right); right_expr = v__gen__c__Gen_expr_string(g, infix_expr.left); - if ((infix_expr.left)._typ == 268 /* v.ast.Ident */) { + if ((infix_expr.left)._typ == 270 /* v.ast.Ident */) { right_expr = string__plus(_SLIT("*"), right_expr); } - if ((infix_expr.right)._typ == 268 /* v.ast.Ident */) { + if ((infix_expr.right)._typ == 270 /* v.ast.Ident */) { left_expr = string__plus(_SLIT("*"), left_expr); } } @@ -66195,7 +64315,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__verror(_SLIT("filter() requires an array")); VUNREACHABLE(); } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string styp = v__gen__c__Gen_typ(g, node.return_type); string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; @@ -66223,12 +64343,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 246 /* v.ast.AnonFn */) { + if (expr._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -66244,7 +64364,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -66280,7 +64400,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_insert(v__gen__c__Gen* g, v__ast__CallExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); v__ast__TypeSymbol* arg2_sym = v__ast__Table_sym(g->table, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 1)).typ); bool is_arg2_array = arg2_sym->kind == v__ast__Kind__array && v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 1)).typ, node.left_type); @@ -66314,7 +64434,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_insert(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_prepend(v__gen__c__Gen* g, v__ast__CallExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(g->table, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).typ); bool is_arg_array = arg_sym->kind == v__ast__Kind__array && v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).typ, node.left_type); @@ -66358,7 +64478,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g 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 }}})); 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, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 415) /*expected idx: 415, 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; @@ -66395,7 +64515,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); } } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 443) /*expected idx: 443, 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); @@ -66480,7 +64600,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index_methods(v__gen__c__Gen* g) { v__ast__TypeSymbol* final_left_sym = v__ast__Table_final_sym(g->table, t); 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("_index"), 0, { .d_c = 0 }}})); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((final_left_sym->info)._v__ast__Array,(final_left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((final_left_sym->info)._v__ast__Array,(final_left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (elem_sym->kind == v__ast__Kind__function) { @@ -66559,7 +64679,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("bool "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = false;"), 0, { .d_c = 0 }}}))); @@ -66580,12 +64700,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 246 /* v.ast.AnonFn */) { + if (expr._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -66601,7 +64721,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -66642,7 +64762,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("bool "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); @@ -66664,12 +64784,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 246 /* v.ast.AnonFn */) { + if (expr._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (!(")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (!(")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -66685,7 +64805,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 256 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -66726,7 +64846,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__A } v__ast__AssertStmt node = original_assert_statement; v__gen__c__Gen_writeln(g, _SLIT("// assert")); - if ((node.expr)._typ == 272 /* v.ast.InfixExpr */) { + if ((node.expr)._typ == 274 /* v.ast.InfixExpr */) { _option_v__ast__Expr _t1; if (_t1 = v__gen__c__Gen_assert_subexpression_to_ctemp(g, (*node.expr._v__ast__InfixExpr).left, (*node.expr._v__ast__InfixExpr).left_type), _t1.state == 0) { v__ast__Expr subst_expr = *(v__ast__Expr*)_t1.data; @@ -66770,23 +64890,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__A } VV_LOCAL_SYMBOL _option_v__ast__Expr v__gen__c__Gen_assert_subexpression_to_ctemp(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type expr_type) { - if (expr._typ == 254 /* v.ast.CallExpr */) { + if (expr._typ == 256 /* v.ast.CallExpr */) { _option_v__ast__Expr _t1; opt_ok2(&(v__ast__Expr[]) { v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*expr._v__ast__CallExpr)), expr_type)))) }, (_option*)(&_t1), sizeof(v__ast__Expr)); return _t1; } - else if (expr._typ == 283 /* v.ast.ParExpr */) { - if (((*expr._v__ast__ParExpr).expr)._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 285 /* v.ast.ParExpr */) { + if (((*expr._v__ast__ParExpr).expr)._typ == 256 /* v.ast.CallExpr */) { _option_v__ast__Expr _t2; opt_ok2(&(v__ast__Expr[]) { v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*(*expr._v__ast__ParExpr).expr._v__ast__CallExpr)), expr_type)))) }, (_option*)(&_t2), sizeof(v__ast__Expr)); return _t2; } } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { - if (((*expr._v__ast__SelectorExpr).expr)._typ == 254 /* v.ast.CallExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { + if (((*expr._v__ast__SelectorExpr).expr)._typ == 256 /* v.ast.CallExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*(*expr._v__ast__SelectorExpr).expr._v__ast__CallExpr).return_type)); if (sym->kind == v__ast__Kind__struct_) { - if ((/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).is_union) { + if ((/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_union) { return (_option_v__ast__Expr){ .state=2, .err=_const_v__gen__c__unsupported_ctemp_assert_transform, .data={EMPTY_STRUCT_INITIALIZATION} }; } } @@ -66827,7 +64947,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".fn_name = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(fn_name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); string metasrc = v__gen__c__cnewlines(v__gen__c__ctoslit(src)); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".src = "), /*115 &string*/0xfe10, {.d_s = metasrc}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - if (node.expr._typ == 272 /* v.ast.InfixExpr */) { + if (node.expr._typ == 274 /* v.ast.InfixExpr */) { string expr_op_str = v__gen__c__ctoslit(v__token__Kind_str((*node.expr._v__ast__InfixExpr).op)); string expr_left_str = v__gen__c__cnewlines(v__gen__c__ctoslit(v__ast__Expr_str((*node.expr._v__ast__InfixExpr).left))); string expr_right_str = v__gen__c__cnewlines(v__gen__c__ctoslit(v__ast__Expr_str((*node.expr._v__ast__InfixExpr).right))); @@ -66841,7 +64961,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ v__gen__c__Gen_gen_assert_single_expr(g, (*node.expr._v__ast__InfixExpr).right, (*node.expr._v__ast__InfixExpr).right_type); v__gen__c__Gen_writeln(g, _SLIT(";")); } - else if (node.expr._typ == 254 /* v.ast.CallExpr */) { + else if (node.expr._typ == 256 /* v.ast.CallExpr */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".op = _SLIT(\"call\");"), 0, { .d_c = 0 }}}))); } @@ -66854,37 +64974,37 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type typ) { string unknown_value = _SLIT("*unknown value*"); - if (expr._typ == 255 /* v.ast.CastExpr */) { + if (expr._typ == 257 /* v.ast.CastExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 269 /* v.ast.IfExpr */) { + else if (expr._typ == 271 /* v.ast.IfExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 271 /* v.ast.IndexExpr */) { + else if (expr._typ == 273 /* v.ast.IndexExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 278 /* v.ast.MatchExpr */) { + else if (expr._typ == 280 /* v.ast.MatchExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 285 /* v.ast.PrefixExpr */) { - if (((*expr._v__ast__PrefixExpr).right)._typ == 255 /* v.ast.CastExpr */) { + else if (expr._typ == 287 /* v.ast.PrefixExpr */) { + if (((*expr._v__ast__PrefixExpr).right)._typ == 257 /* v.ast.CastExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } else { v__gen__c__Gen_gen_expr_to_string(g, expr, typ); } } - else if (expr._typ == 294 /* v.ast.TypeNode */) { + else if (expr._typ == 296 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); v__gen__c__Gen_write(g, v__gen__c__ctoslit( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})))); } else { bool should_clone = true; - if (v__ast__Type_alias_eq(typ, _const_v__ast__string_type) && (expr)._typ == 292 /* v.ast.StringLiteral */) { + if (v__ast__Type_alias_eq(typ, _const_v__ast__string_type) && (expr)._typ == 294 /* v.ast.StringLiteral */) { should_clone = false; } - if ((expr)._typ == 253 /* v.ast.CTempVar */) { - if (((*expr._v__ast__CTempVar).orig)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 255 /* v.ast.CTempVar */) { + if (((*expr._v__ast__CTempVar).orig)._typ == 256 /* v.ast.CallExpr */) { should_clone = false; if ((*(*expr._v__ast__CTempVar).orig._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option) { should_clone = true; @@ -66925,23 +65045,23 @@ string sref_name; v__gen__c__Gen_gen_assign_stmt_defer_0 = true; v__token__Kind op = (is_decl ? (v__token__Kind__assign) : (node.op)); v__ast__Expr right_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if (right_expr._typ == 254 /* v.ast.CallExpr */) { + if (right_expr._typ == 256 /* v.ast.CallExpr */) { return_type = (*right_expr._v__ast__CallExpr).return_type; } - else if (right_expr._typ == 276 /* v.ast.LockExpr */) { + else if (right_expr._typ == 278 /* v.ast.LockExpr */) { return_type = (*right_expr._v__ast__LockExpr).typ; } - else if (right_expr._typ == 278 /* v.ast.MatchExpr */) { + else if (right_expr._typ == 280 /* v.ast.MatchExpr */) { return_type = (*right_expr._v__ast__MatchExpr).return_type; } - else if (right_expr._typ == 269 /* v.ast.IfExpr */) { + else if (right_expr._typ == 271 /* v.ast.IfExpr */) { return_type = (*right_expr._v__ast__IfExpr).typ; } else { } ; - af = g->is_autofree && !g->is_builtin_mod && node.op == v__token__Kind__assign && node.left_types.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 268 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 288 /* v.ast.SelectorExpr */); + af = g->is_autofree && !g->is_builtin_mod && node.op == v__token__Kind__assign && node.left_types.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 270 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 290 /* v.ast.SelectorExpr */); sref_name = _SLIT(""); type_to_free = _SLIT(""); if (af) { @@ -66951,7 +65071,7 @@ string sref_name; type_to_free = (v__ast__Type_alias_eq(first_left_type, _const_v__ast__string_type) ? (_SLIT("string")) : (_SLIT("array"))); bool ok = true; v__ast__Expr left0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left0)._typ == 268 /* v.ast.Ident */) { + if ((left0)._typ == 270 /* v.ast.Ident */) { if (string__eq((*left0._v__ast__Ident).name, _SLIT("_"))) { ok = false; } @@ -67011,11 +65131,11 @@ string sref_name; bool blank_assign = false; 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 == 268 /* v.ast.Ident */) { + if ((left)->_typ == 270 /* v.ast.Ident */) { ident = (*left->_v__ast__Ident); blank_assign = (*left->_v__ast__Ident).kind == v__ast__IdentKind__blank_ident; v__ast__IdentInfo left_info = (*left->_v__ast__Ident).info; - if ((left_info)._typ == 378 /* v.ast.IdentVar */) { + if ((left_info)._typ == 380 /* v.ast.IdentVar */) { v__ast__ShareType share = (*left_info._v__ast__IdentVar).share; if (share == v__ast__ShareType__shared_t) { var_type = v__ast__Type_set_flag(var_type, v__ast__TypeFlag__shared_f); @@ -67024,10 +65144,10 @@ string sref_name; var_type = v__ast__Type_set_flag(var_type, v__ast__TypeFlag__atomic_f); } } - if (((*left->_v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { - if ((val)._typ == 260 /* v.ast.ComptimeSelector */) { - if (((*val._v__ast__ComptimeSelector).field_expr)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 268 /* v.ast.Ident */) { + if (((*left->_v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { + if ((val)._typ == 262 /* v.ast.ComptimeSelector */) { + if (((*val._v__ast__ComptimeSelector).field_expr)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 270 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t2 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t1 = {0}; @@ -67046,7 +65166,7 @@ string sref_name; (*(*left->_v__ast__Ident).obj._v__ast__Var).typ = var_type; } } - } else if ((val)._typ == 259 /* v.ast.ComptimeCall */) { + } else if ((val)._typ == 261 /* v.ast.ComptimeCall */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*val._v__ast__ComptimeCall).method_name}}, {_SLIT(".return_type"), 0, { .d_c = 0 }}})); v__ast__Type* _t4 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t3 = {0}; @@ -67070,19 +65190,19 @@ string sref_name; string styp = v__gen__c__Gen_typ(g, var_type); bool is_fixed_array_init = false; bool has_val = false; - if (val._typ == 248 /* v.ast.ArrayInit */) { + if (val._typ == 250 /* v.ast.ArrayInit */) { is_fixed_array_init = (*val._v__ast__ArrayInit).is_fixed; has_val = (*val._v__ast__ArrayInit).has_val; } - else if (val._typ == 254 /* v.ast.CallExpr */) { + else if (val._typ == 256 /* v.ast.CallExpr */) { is_call = true; return_type = (*val._v__ast__CallExpr).return_type; } - else if (val._typ == 246 /* v.ast.AnonFn */) { + else if (val._typ == 248 /* v.ast.AnonFn */) { if (blank_assign) { v__gen__c__Gen_write(g, _SLIT("{")); } - if ((is_decl || blank_assign) && (left)->_typ == 268 /* v.ast.Ident */) { + if ((is_decl || blank_assign) && (left)->_typ == 270 /* v.ast.Ident */) { string ret_styp = v__gen__c__Gen_typ(g, (*val._v__ast__AnonFn).decl.return_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = ident.name}}, {_SLIT(") ("), 0, { .d_c = 0 }}}))); int def_pos = g->definitions.len; @@ -67095,7 +65215,7 @@ string sref_name; v__gen__c__Gen_expr(g, *left); g->is_assign_lhs = false; g->is_arraymap_set = false; - if ((left)->_typ == 271 /* v.ast.IndexExpr */) { + if ((left)->_typ == 273 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*left->_v__ast__IndexExpr).left_type); if (sym->kind == v__ast__Kind__map || sym->kind == v__ast__Kind__array) { v__gen__c__Gen_expr(g, val); @@ -67119,14 +65239,14 @@ string sref_name; v__ast__Type unwrapped_val_type = v__gen__c__Gen_unwrap_generic(g, val_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, unwrapped_val_type); v__ast__TypeSymbol* unaliased_right_sym = v__ast__Table_final_sym(g->table, unwrapped_val_type); - bool is_fixed_array_var = unaliased_right_sym->kind == v__ast__Kind__array_fixed && (val)._typ != 248 /* v.ast.ArrayInit */ && (((val)._typ == 268 /* v.ast.Ident */ || (val)._typ == 271 /* v.ast.IndexExpr */ || (val)._typ == 254 /* v.ast.CallExpr */ || (val)._typ == 288 /* v.ast.SelectorExpr */) || ((val)._typ == 255 /* v.ast.CastExpr */ && ((/* as */ *(v__ast__CastExpr*)__as_cast((val)._v__ast__CastExpr,(val)._typ, 255) /*expected idx: 255, name: v.ast.CastExpr */ ).expr)._typ != 248 /* v.ast.ArrayInit */)) && !g->pref->translated; + bool is_fixed_array_var = unaliased_right_sym->kind == v__ast__Kind__array_fixed && (val)._typ != 250 /* v.ast.ArrayInit */ && (((val)._typ == 270 /* v.ast.Ident */ || (val)._typ == 273 /* v.ast.IndexExpr */ || (val)._typ == 256 /* v.ast.CallExpr */ || (val)._typ == 290 /* v.ast.SelectorExpr */) || ((val)._typ == 257 /* v.ast.CastExpr */ && ((/* as */ *(v__ast__CastExpr*)__as_cast((val)._v__ast__CastExpr,(val)._typ, 257) /*expected idx: 257, name: v.ast.CastExpr */ ).expr)._typ != 250 /* v.ast.ArrayInit */)) && !g->pref->translated; g->is_assign_lhs = true; g->assign_op = node.op; if (v__ast__Type_has_flag(val_type, v__ast__TypeFlag__optional)) { g->right_is_opt = true; } if (blank_assign) { - if ((val)._typ == 271 /* v.ast.IndexExpr */) { + if ((val)._typ == 273 /* v.ast.IndexExpr */) { g->assign_op = v__token__Kind__decl_assign; } g->is_assign_lhs = false; @@ -67146,17 +65266,17 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_writeln(g, _SLIT(";}")); } - } else if (node.op == v__token__Kind__assign && !g->pref->translated && (is_fixed_array_init || (right_sym->kind == v__ast__Kind__array_fixed && (val)._typ == 268 /* v.ast.Ident */))) { + } else if (node.op == v__token__Kind__assign && !g->pref->translated && (is_fixed_array_init || (right_sym->kind == v__ast__Kind__array_fixed && (val)._typ == 270 /* v.ast.Ident */))) { string v_var = _SLIT(""); string arr_typ = string_trim(styp, _SLIT("*")); if (is_fixed_array_init) { - v__ast__ArrayInit right = /* as */ *(v__ast__ArrayInit*)__as_cast((val)._v__ast__ArrayInit,(val)._typ, 248) /*expected idx: 248, name: v.ast.ArrayInit */ ; + v__ast__ArrayInit right = /* as */ *(v__ast__ArrayInit*)__as_cast((val)._v__ast__ArrayInit,(val)._typ, 250) /*expected idx: 250, name: v.ast.ArrayInit */ ; v_var = v__gen__c__Gen_new_tmp_var(g); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = arr_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v_var}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, v__ast__ArrayInit_to_sumtype_v__ast__Expr(&right)); v__gen__c__Gen_writeln(g, _SLIT(";")); } else { - v__ast__Ident right = /* as */ *(v__ast__Ident*)__as_cast((val)._v__ast__Ident,(val)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ; + v__ast__Ident right = /* as */ *(v__ast__Ident*)__as_cast((val)._v__ast__Ident,(val)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ; v_var = right.name; } int pos = g->out.len; @@ -67193,7 +65313,7 @@ string sref_name; v__ast__Type op_expected_left = ((v__ast__Type)(0)); v__ast__Type op_expected_right = ((v__ast__Type)(0)); if (var_type == _const_v__ast__string_type_idx && node.op == v__token__Kind__plus_assign) { - if ((left)->_typ == 271 /* v.ast.IndexExpr */) { + if ((left)->_typ == 273 /* v.ast.IndexExpr */) { v__gen__c__Gen_expr(g, *left); v__gen__c__Gen_write(g, _SLIT("string__plus(")); } else { @@ -67225,8 +65345,8 @@ string sref_name; _t6 = _SLIT("unknown op"); }string extracted_op = _t6; v__gen__c__Gen_expr(g, *left); - if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).generic_types.len > 0) { - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).concrete_types; + if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(string__plus(left_sym->cname, _SLIT("_")), v__util__replace_op(extracted_op)); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -67267,7 +65387,7 @@ string sref_name; if (is_inside_ternary && is_decl) { strings__Builder_write_string(&g->out, v__util__tabs(g->indent - g->inside_ternary)); } - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); string call_conv = _SLIT(""); string msvc_call_conv = _SLIT(""); @@ -67298,14 +65418,14 @@ string sref_name; bool is_used_var_styp = false; if (!Array_string_contains(g->defer_vars, ident.name)) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_type); - if ((val_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((val_sym->info)._typ == 420 /* v.ast.Struct */) { if ((*val_sym->info._v__ast__Struct).generic_types.len > 0) { - if ((val)._typ == 293 /* v.ast.StructInit */) { + if ((val)._typ == 295 /* v.ast.StructInit */) { string var_styp = v__gen__c__Gen_typ(g, (*val._v__ast__StructInit).typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = var_styp}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); is_used_var_styp = true; - } else if ((val)._typ == 285 /* v.ast.PrefixExpr */) { - if ((*val._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*val._v__ast__PrefixExpr).right)._typ == 293 /* v.ast.StructInit */) { + } else if ((val)._typ == 287 /* v.ast.PrefixExpr */) { + if ((*val._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*val._v__ast__PrefixExpr).right)._typ == 295 /* v.ast.StructInit */) { string var_styp = v__gen__c__Gen_typ(g, v__ast__Type_ref((*(*val._v__ast__PrefixExpr).right._v__ast__StructInit).typ)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = var_styp}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); is_used_var_styp = true; @@ -67321,7 +65441,7 @@ string sref_name; } } } - if ((left)->_typ == 268 /* v.ast.Ident */ || (left)->_typ == 288 /* v.ast.SelectorExpr */) { + if ((left)->_typ == 270 /* v.ast.Ident */ || (left)->_typ == 290 /* v.ast.SelectorExpr */) { g->prevent_sum_type_unwrapping_once = true; } if (!is_fixed_array_var || is_decl) { @@ -67332,6 +65452,9 @@ string sref_name; v__gen__c__Gen_write(g, _SLIT("*")); } v__gen__c__Gen_expr(g, *left); + if (!is_decl && v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f)) { + v__gen__c__Gen_write(g, _SLIT("->val")); + } } } } @@ -67359,7 +65482,6 @@ string sref_name; bool unwrap_optional = !v__ast__Type_has_flag(var_type, v__ast__TypeFlag__optional) && v__ast__Type_has_flag(val_type, v__ast__TypeFlag__optional); if (unwrap_optional) { } - g->is_shared = v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f); if (!cloned) { if (is_fixed_array_var) { string typ_str = string_trim(v__gen__c__Gen_typ(g, val_type), _SLIT("*")); @@ -67370,8 +65492,9 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = typ_str}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } else if (is_decl) { + g->is_shared = v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f); if (is_fixed_array_init && !has_val) { - if ((val)._typ == 248 /* v.ast.ArrayInit */) { + if ((val)._typ == 250 /* 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}")); @@ -67383,7 +65506,7 @@ string sref_name; if (v__ast__Expr_is_auto_deref_var(val)) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((val)._typ == 248 /* v.ast.ArrayInit */) { + if ((val)._typ == 250 /* v.ast.ArrayInit */) { v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); } else if (v__ast__Type_has_flag(val_type, v__ast__TypeFlag__shared_f)) { v__gen__c__Gen_expr_with_cast(g, val, val_type, var_type); @@ -67401,7 +65524,7 @@ string sref_name; if (op_overloaded) { v__gen__c__Gen_op_arg(g, val, op_expected_right, val_type); } else { - v__ast__Type exp_type = (v__ast__Expr_is_auto_deref_var(/*rec*/*left) ? (v__ast__Type_deref(var_type)) : (var_type)); + v__ast__Type exp_type = v__ast__Type_clear_flag((v__ast__Expr_is_auto_deref_var(/*rec*/*left) || v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(var_type)) : (var_type)), v__ast__TypeFlag__shared_f); v__gen__c__Gen_expr_with_cast(g, val, val_type, exp_type); } } @@ -67446,12 +65569,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v v__ast__Expr lx = ((v__ast__Expr*)node->left.data)[i]; bool is_auto_heap = false; 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 == 268 /* v.ast.Ident */) { + if ((lx)._typ == 270 /* v.ast.Ident */) { ident = (*lx._v__ast__Ident); if ((*lx._v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { continue; } - if (((*lx._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if (((*lx._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { is_auto_heap = (*(*lx._v__ast__Ident).obj._v__ast__Var).is_auto_heap; } } @@ -67510,26 +65633,26 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_vars_autofree(v__gen__c__Gen* g, VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node) { for (int i = 0; i < node->left.len; ++i) { v__ast__Expr left = ((v__ast__Expr*)node->left.data)[i]; - if (left._typ == 268 /* v.ast.Ident */) { + if (left._typ == 270 /* v.ast.Ident */) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); if (left_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { string styp = v__gen__c__Gen_typ(g, left_typ); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (left._typ == 271 /* v.ast.IndexExpr */) { + else if (left._typ == 273 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*left._v__ast__IndexExpr).left_type); if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__TypeSymbol* elem_typ = v__ast__Table_sym(g->table, info.elem_type); if (elem_typ->kind == v__ast__Kind__function) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)array_get(")); } else { string styp = v__gen__c__Gen_typ(g, info.elem_type); @@ -67550,7 +65673,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a v__gen__c__Gen_expr(g, (*left._v__ast__IndexExpr).index); v__gen__c__Gen_writeln(g, _SLIT(");")); } else if (sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; string skeytyp = v__gen__c__Gen_typ(g, info.key_type); string styp = v__gen__c__Gen_typ(g, info.value_type); string zero = v__gen__c__Gen_type_default(g, info.value_type); @@ -67558,7 +65681,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (val_typ->kind == v__ast__Kind__function) { v__ast__Type left_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_type); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)map_get(")); } else { v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)map_get("), 0, { .d_c = 0 }}}))); @@ -67580,7 +65703,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a } } } - else if (left._typ == 288 /* v.ast.SelectorExpr */) { + else if (left._typ == 290 /* v.ast.SelectorExpr */) { string styp = v__gen__c__Gen_typ(g, (*left._v__ast__SelectorExpr).typ); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__SelectorExpr).pos.pos}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*left._v__ast__SelectorExpr).expr); @@ -67603,11 +65726,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Array_v__ast__Expr left, v__ast__Expr val) { v__ast__Expr val_ = val; - if (val._typ == 268 /* v.ast.Ident */) { + if (val._typ == 270 /* v.ast.Ident */) { bool has_var = false; for (int _t1 = 0; _t1 < left.len; ++_t1) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t1]; - if ((lx)._typ == 268 /* v.ast.Ident */) { + if ((lx)._typ == 270 /* v.ast.Ident */) { if (string__eq((*val._v__ast__Ident).name, (*lx._v__ast__Ident).name)) { v__gen__c__Gen_write(g, _SLIT("_var_")); v__gen__c__Gen_write(g, int_str((*lx._v__ast__Ident).pos.pos)); @@ -67620,7 +65743,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_expr(g, val_); } } - else if (val._typ == 271 /* v.ast.IndexExpr */) { + else if (val._typ == 273 /* v.ast.IndexExpr */) { bool has_var = false; for (int _t2 = 0; _t2 < left.len; ++_t2) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t2]; @@ -67635,7 +65758,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_expr(g, val_); } } - else if (val._typ == 272 /* v.ast.InfixExpr */) { + else if (val._typ == 274 /* v.ast.InfixExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*val._v__ast__InfixExpr).left_type); _option_v__ast__Fn _t3; if (_t3 = v__ast__Table_find_method(g->table, sym, v__token__Kind_str((*val._v__ast__InfixExpr).op)), _t3.state == 0) { @@ -67655,15 +65778,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__InfixExpr).right); } } - else if (val._typ == 285 /* v.ast.PrefixExpr */) { + else if (val._typ == 287 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PrefixExpr).op)); v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PrefixExpr).right); } - else if (val._typ == 284 /* v.ast.PostfixExpr */) { + else if (val._typ == 286 /* v.ast.PostfixExpr */) { v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PostfixExpr).expr); v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PostfixExpr).op)); } - else if (val._typ == 288 /* v.ast.SelectorExpr */) { + else if (val._typ == 290 /* v.ast.SelectorExpr */) { bool has_var = false; for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t4]; @@ -67870,7 +65993,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_alias_equality_fn(v__gen__c__Gen* g, v return _t1; } array_push((array*)&g->generated_eq_fns, _MOV((v__ast__Type[]){ left_type })); - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b); // auto"), 0, { .d_c = 0 }}}))); strings__Builder fn_builder = strings__new_builder(512); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); @@ -68036,7 +66159,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_map_equality_fn(v__gen__c__Gen* g, v__ strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (!map_exists(&b, k)) return false;")); v__ast__Kind kind = v__ast__Table_type_kind(g->table, value.typ); if (kind == v__ast__Kind__function) { - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); strings__Builder_write_string(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*v) ("), 0, { .d_c = 0 }}}))); int arg_len = func.func.params.len; @@ -68171,7 +66294,7 @@ strings__Builder fn_builder; strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("_interface_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, _SLIT("\tif (a._typ == b._typ) {")); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tint idx = v_typeof_interface_idx_"), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("(a._typ);"), 0, { .d_c = 0 }}}))); - if ((info)._typ == 436 /* v.ast.Interface */) { + if ((info)._typ == 438 /* v.ast.Interface */) { for (int _t3 = 0; _t3 < (*info._v__ast__Interface).types.len; ++_t3) { v__ast__Type typ = ((v__ast__Type*)(*info._v__ast__Interface).types.data)[_t3]; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif (idx == "), /*100 &int*/0xfe07, {.d_i32 = v__ast__Type_idx(typ)}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); @@ -68227,7 +66350,7 @@ strings__Builder fn_builder; VV_LOCAL_SYMBOL string v__gen__c__Gen_get_free_method(v__gen__c__Gen* g, v__ast__Type typ) { map_set(&g->autofree_methods, &(int[]){typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 433 /* v.ast.Alias */) { + if ((sym->info)._typ == 435 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -68268,7 +66391,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ } map_set(&g->generated_free_methods, &(int[]){deref_typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 433 /* v.ast.Alias */) { + if ((sym->info)._typ == 435 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -68277,13 +66400,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ string _t2 = fn_name; return _t2; } - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { v__gen__c__Gen_gen_free_for_struct(g, (*sym->info._v__ast__Struct), styp, fn_name); } - else if (sym->info._typ == 413 /* v.ast.Array */) { + else if (sym->info._typ == 415 /* v.ast.Array */) { v__gen__c__Gen_gen_free_for_array(g, (*sym->info._v__ast__Array), styp, fn_name); } - else if (sym->info._typ == 414 /* v.ast.Map */) { + else if (sym->info._typ == 416 /* v.ast.Map */) { v__gen__c__Gen_gen_free_for_map(g, (*sym->info._v__ast__Map), styp, fn_name); } @@ -68376,253 +66499,6 @@ inline VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp) { return _t1; } -string v__gen__c__type_to_str(StrIntpType x) { - switch (x) { - case StrIntpType__si_no_str: - { - string _t1 = _SLIT("no_str"); - return _t1; - break; - } - case StrIntpType__si_c: - { - string _t2 = _SLIT("c"); - return _t2; - break; - } - case StrIntpType__si_u8: - { - string _t3 = _SLIT("u8"); - return _t3; - break; - } - case StrIntpType__si_i8: - { - string _t4 = _SLIT("i8"); - return _t4; - break; - } - case StrIntpType__si_u16: - { - string _t5 = _SLIT("u16"); - return _t5; - break; - } - case StrIntpType__si_i16: - { - string _t6 = _SLIT("i16"); - return _t6; - break; - } - case StrIntpType__si_u32: - { - string _t7 = _SLIT("u32"); - return _t7; - break; - } - case StrIntpType__si_i32: - { - string _t8 = _SLIT("i32"); - return _t8; - break; - } - case StrIntpType__si_u64: - { - string _t9 = _SLIT("u64"); - return _t9; - break; - } - case StrIntpType__si_i64: - { - string _t10 = _SLIT("i64"); - return _t10; - break; - } - case StrIntpType__si_f32: - { - string _t11 = _SLIT("f32"); - return _t11; - break; - } - case StrIntpType__si_f64: - { - string _t12 = _SLIT("f64"); - return _t12; - break; - } - case StrIntpType__si_g32: - { - string _t13 = _SLIT("f32"); - return _t13; - break; - } - case StrIntpType__si_g64: - { - string _t14 = _SLIT("f64"); - return _t14; - break; - } - case StrIntpType__si_e32: - { - string _t15 = _SLIT("f32"); - return _t15; - break; - } - case StrIntpType__si_e64: - { - string _t16 = _SLIT("f64"); - return _t16; - break; - } - case StrIntpType__si_s: - { - string _t17 = _SLIT("s"); - return _t17; - break; - } - case StrIntpType__si_p: - { - string _t18 = _SLIT("p"); - return _t18; - break; - } - case StrIntpType__si_vp: - { - string _t19 = _SLIT("vp"); - return _t19; - break; - } - } - ; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string v__gen__c__data_str(StrIntpType x) { - switch (x) { - case StrIntpType__si_no_str: - { - string _t1 = _SLIT("no_str"); - return _t1; - break; - } - case StrIntpType__si_c: - { - string _t2 = _SLIT("d_c"); - return _t2; - break; - } - case StrIntpType__si_u8: - { - string _t3 = _SLIT("d_u8"); - return _t3; - break; - } - case StrIntpType__si_i8: - { - string _t4 = _SLIT("d_i8"); - return _t4; - break; - } - case StrIntpType__si_u16: - { - string _t5 = _SLIT("d_u16"); - return _t5; - break; - } - case StrIntpType__si_i16: - { - string _t6 = _SLIT("d_i16"); - return _t6; - break; - } - case StrIntpType__si_u32: - { - string _t7 = _SLIT("d_u32"); - return _t7; - break; - } - case StrIntpType__si_i32: - { - string _t8 = _SLIT("d_i32"); - return _t8; - break; - } - case StrIntpType__si_u64: - { - string _t9 = _SLIT("d_u64"); - return _t9; - break; - } - case StrIntpType__si_i64: - { - string _t10 = _SLIT("d_i64"); - return _t10; - break; - } - case StrIntpType__si_f32: - { - string _t11 = _SLIT("d_f32"); - return _t11; - break; - } - case StrIntpType__si_f64: - { - string _t12 = _SLIT("d_f64"); - return _t12; - break; - } - case StrIntpType__si_g32: - { - string _t13 = _SLIT("d_f32"); - return _t13; - break; - } - case StrIntpType__si_g64: - { - string _t14 = _SLIT("d_f64"); - return _t14; - break; - } - case StrIntpType__si_e32: - { - string _t15 = _SLIT("d_f32"); - return _t15; - break; - } - case StrIntpType__si_e64: - { - string _t16 = _SLIT("d_f64"); - return _t16; - break; - } - case StrIntpType__si_s: - { - string _t17 = _SLIT("d_s"); - return _t17; - break; - } - case StrIntpType__si_p: - { - string _t18 = _SLIT("d_p"); - return _t18; - break; - } - case StrIntpType__si_vp: - { - string _t19 = _SLIT("d_vp"); - return _t19; - break; - } - } - ; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind) { - bool _t1 = (kind == v__ast__Kind__struct_ || kind == v__ast__Kind__alias || kind == v__ast__Kind__array || kind == v__ast__Kind__array_fixed || kind == v__ast__Kind__map || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__interface_); - return _t1; -} - VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name) { #if defined(CUSTOM_DEFINE_trace_autostr) { @@ -68680,13 +66556,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, unwrapped); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped); string str_fn_name = v__gen__c__styp_to_str_fn_name(styp); - if ((sym->info)._typ == 433 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 435 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); str_fn_name = v__gen__c__styp_to_str_fn_name(sym->name); } } - if (v__ast__TypeSymbol_has_method_with_generic_parent(sym, _SLIT("str")) && (sym->info)._typ == 418 /* v.ast.Struct */) { + if (v__ast__TypeSymbol_has_method_with_generic_parent(sym, _SLIT("str")) && (sym->info)._typ == 420 /* v.ast.Struct */) { str_fn_name = v__gen__c__Gen_generic_fn_name(g, (*sym->info._v__ast__Struct).concrete_types, str_fn_name, false); } array_push((array*)&g->str_types, _MOV((v__gen__c__StrType[]){ ((v__gen__c__StrType){.styp = styp,.typ = unwrapped,}) })); @@ -68718,44 +66594,44 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ v__gen__c__Gen_gen_str_for_result(g, typ.typ, styp, str_fn_name); return; } - if (sym->info._typ == 433 /* v.ast.Alias */) { + if (sym->info._typ == 435 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { v__gen__c__Gen_gen_str_default(g, *sym, styp, str_fn_name); } else { v__gen__c__Gen_gen_str_for_alias(g, (*sym->info._v__ast__Alias), styp, str_fn_name); } } - else if (sym->info._typ == 413 /* v.ast.Array */) { + else if (sym->info._typ == 415 /* v.ast.Array */) { v__gen__c__Gen_gen_str_for_array(g, (*sym->info._v__ast__Array), styp, str_fn_name); } - else if (sym->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { v__gen__c__Gen_gen_str_for_array_fixed(g, (*sym->info._v__ast__ArrayFixed), styp, str_fn_name); } - else if (sym->info._typ == 447 /* v.ast.Enum */) { + else if (sym->info._typ == 449 /* v.ast.Enum */) { v__gen__c__Gen_gen_str_for_enum(g, (*sym->info._v__ast__Enum), styp, str_fn_name); } - else if (sym->info._typ == 445 /* v.ast.FnType */) { + else if (sym->info._typ == 447 /* v.ast.FnType */) { v__gen__c__Gen_gen_str_for_fn_type(g, (*sym->info._v__ast__FnType), styp, str_fn_name); } - else if (sym->info._typ == 418 /* v.ast.Struct */) { + else if (sym->info._typ == 420 /* v.ast.Struct */) { v__gen__c__Gen_gen_str_for_struct(g, (*sym->info._v__ast__Struct), styp, str_fn_name); } - else if (sym->info._typ == 414 /* v.ast.Map */) { + else if (sym->info._typ == 416 /* v.ast.Map */) { v__gen__c__Gen_gen_str_for_map(g, (*sym->info._v__ast__Map), styp, str_fn_name); } - else if (sym->info._typ == 444 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 446 /* v.ast.MultiReturn */) { v__gen__c__Gen_gen_str_for_multi_return(g, (*sym->info._v__ast__MultiReturn), styp, str_fn_name); } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { v__gen__c__Gen_gen_str_for_union_sum_type(g, (*sym->info._v__ast__SumType), styp, str_fn_name); } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { v__gen__c__Gen_gen_str_for_interface(g, (*sym->info._v__ast__Interface), styp, str_fn_name); } - else if (sym->info._typ == 442 /* v.ast.Chan */) { + else if (sym->info._typ == 444 /* v.ast.Chan */) { v__gen__c__Gen_gen_str_for_chan(g, (*sym->info._v__ast__Chan), styp, str_fn_name); } - else if (sym->info._typ == 443 /* v.ast.Thread */) { + else if (sym->info._typ == 445 /* v.ast.Thread */) { v__gen__c__Gen_gen_str_for_thread(g, (*sym->info._v__ast__Thread), styp, str_fn_name); } @@ -68774,8 +66650,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_option(v__gen__c__Gen* g, v__ast #endif v__ast__Type parent_type = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, parent_type); - multi_return_bool_bool_int mr_6348 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_6348.arg0; + multi_return_bool_bool_int mr_4622 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_4622.arg0; string parent_str_fn_name = v__gen__c__Gen_get_str_fn(g, parent_type); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(it, 0); }"), 0, { .d_c = 0 }}}))); @@ -68807,8 +66683,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_result(v__gen__c__Gen* g, v__ast #endif v__ast__Type parent_type = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__result); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, parent_type); - multi_return_bool_bool_int mr_7867 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_7867.arg0; + multi_return_bool_bool_int mr_6141 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_6141.arg0; string parent_str_fn_name = v__gen__c__Gen_get_str_fn(g, parent_type); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(it, 0); }"), 0, { .d_c = 0 }}}))); @@ -68868,9 +66744,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_multi_return(v__gen__c__Gen* g, v__ast__Type typ = ((v__ast__Type*)info.types.data)[i]; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); bool is_arg_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_11059 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_11059.arg0; - bool str_method_expects_ptr = mr_11059.arg1; + multi_return_bool_bool_int mr_9333 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_9333.arg0; + bool str_method_expects_ptr = mr_9333.arg1; string arg_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("(a.arg"), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); @@ -68888,9 +66764,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_multi_return(v__gen__c__Gen* g, } else if (sym->kind == v__ast__Kind__function) { strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("());"), 0, { .d_c = 0 }}}))); } else { - multi_return_string_string mr_11884 = v__gen__c__deref_kind(str_method_expects_ptr, is_arg_ptr, typ); - string deref = mr_11884.arg0; - string deref_label = mr_11884.arg1; + multi_return_string_string mr_10158 = v__gen__c__deref_kind(str_method_expects_ptr, is_arg_ptr, typ); + string deref = mr_10158.arg0; + string deref_label = mr_10158.arg1; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" a.arg"), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } @@ -68966,9 +66842,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_interface(v__gen__c__Gen* g, v__ v__ast__Type typ = ((v__ast__Type*)info.types.data)[_t1]; v__ast__TypeSymbol* sub_sym = v__ast__Table_sym(g->table, v__ast__mktyp(typ)); string func_name = v__gen__c__Gen_get_str_fn(g, typ); - multi_return_bool_bool_int mr_15318 = v__ast__TypeSymbol_str_method_info(sub_sym); - bool sym_has_str_method = mr_15318.arg0; - bool str_method_expects_ptr = mr_15318.arg1; + multi_return_bool_bool_int mr_13592 = v__ast__TypeSymbol_str_method_info(sub_sym); + bool sym_has_str_method = mr_13592.arg0; + bool str_method_expects_ptr = mr_13592.arg1; if (v__gen__c__should_use_indent_func(sub_sym->kind) && !sym_has_str_method) { func_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = func_name}}, {_SLIT0, 0, { .d_c = 0 }}})); } @@ -69039,9 +66915,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_union_sum_type(v__gen__c__Gen* g string typ_str = v__gen__c__Gen_typ(g, typ); string func_name = v__gen__c__Gen_get_str_fn(g, typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - multi_return_bool_bool_int mr_18235 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_18235.arg0; - bool str_method_expects_ptr = mr_18235.arg1; + multi_return_bool_bool_int mr_16509 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_16509.arg0; + bool str_method_expects_ptr = mr_16509.arg1; string deref = (sym_has_str_method && str_method_expects_ptr ? (_SLIT(" ")) : (_SLIT("*"))); if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { func_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = func_name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -69156,15 +67032,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ #endif v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 433 /* v.ast.Alias */) { + if ((sym->info)._typ == 435 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } string field_styp = v__gen__c__Gen_typ(g, typ); bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_22381 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_22381.arg0; - bool str_method_expects_ptr = mr_22381.arg1; + multi_return_bool_bool_int mr_20655 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_20655.arg0; + bool str_method_expects_ptr = mr_20655.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); if (sym->kind == v__ast__Kind__u8) { elem_str_fn_name = string__plus(elem_str_fn_name, _SLIT("_escaped")); @@ -69206,9 +67082,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = str_intp(2, _MOV((StrIntpData[]){{_SLIT(\"\'\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s = it }}, {_SLIT(\"\'\"), 0, {.d_c = 0 }}}));\n"), 0, { .d_c = 0 }}}))); } } else { - multi_return_string_string mr_24905 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_24905.arg0; - string deref_label = mr_24905.arg1; + multi_return_string_string mr_23179 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_23179.arg0; + string deref_label = mr_23179.arg1; strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" it);"), 0, { .d_c = 0 }}}))); } @@ -69236,14 +67112,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v #endif v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 433 /* v.ast.Alias */) { + if ((sym->info)._typ == 435 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_26287 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_26287.arg0; - bool str_method_expects_ptr = mr_26287.arg1; + multi_return_bool_bool_int mr_24561 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_24561.arg0; + bool str_method_expects_ptr = mr_24561.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(a, 0);}"), 0, { .d_c = 0 }}}))); @@ -69256,9 +67132,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); } else { - multi_return_string_string mr_27164 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_27164.arg0; - string deref_label = mr_27164.arg1; + multi_return_string_string mr_25438 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_25438.arg0; + string deref_label = mr_25438.arg1; if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { if (is_elem_ptr) { strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); @@ -69304,7 +67180,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M #endif v__ast__Type key_typ = info.key_type; v__ast__TypeSymbol* key_sym = v__ast__Table_sym(g->table, key_typ); - if ((key_sym->info)._typ == 433 /* v.ast.Alias */) { + if ((key_sym->info)._typ == 435 /* v.ast.Alias */) { key_typ = (*key_sym->info._v__ast__Alias).parent_type; key_sym = v__ast__Table_sym(g->table, key_typ); } @@ -69315,7 +67191,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M } v__ast__Type val_typ = info.value_type; v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_typ); - if ((val_sym->info)._typ == 433 /* v.ast.Alias */) { + if ((val_sym->info)._typ == 435 /* v.ast.Alias */) { val_typ = (*val_sym->info._v__ast__Alias).parent_type; val_sym = v__ast__Table_sym(g->table, val_typ); } @@ -69469,7 +67345,8 @@ strings__Builder fn_body; strings__Builder_writeln(&fn_body, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = clean_struct_v_type_name}}, {_SLIT("{\\n\"), 0, {.d_c=0}},"), 0, { .d_c = 0 }}}))); for (int i = 0; i < info.fields.len; ++i) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[i]; - string ptr_amp = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("&")) : (_SLIT(""))); + v__ast__Type ftyp_noshared = (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__shared_f) ? (v__ast__Type_clear_flag(v__ast__Type_deref(field.typ), v__ast__TypeFlag__shared_f)) : (field.typ)); + string ptr_amp = (v__ast__Type_is_ptr(ftyp_noshared) ? (_SLIT("&")) : (_SLIT(""))); StrIntpType base_fmt = v__gen__c__Gen_type_to_fmt(g, v__gen__c__Gen_unwrap_generic(g, field.typ)); string quote_str = _SLIT(""); string prefix = _SLIT(""); @@ -69485,20 +67362,20 @@ strings__Builder fn_body; } else { strings__Builder_write_string(&fn_body, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\"\\n\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s=indents}}, {_SLIT(\" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = ptr_amp}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("\"), 0, {.d_c=0}}, "), 0, { .d_c = 0 }}}))); } - multi_return_bool_bool_int mr_36986 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_36986.arg0; - bool str_method_expects_ptr = mr_36986.arg1; - string sftyp = v__gen__c__Gen_typ(g, field.typ); + multi_return_bool_bool_int mr_35399 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_35399.arg0; + bool str_method_expects_ptr = mr_35399.arg1; + string sftyp = v__gen__c__Gen_typ(g, ftyp_noshared); string field_styp = string_replace(sftyp, _SLIT("*"), _SLIT("")); string _t2; /* if prepend */ if (sym_has_str_method) { string field_fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("_str"), 0, { .d_c = 0 }}})); - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { field_fn_name = v__gen__c__Gen_generic_fn_name(g, (*sym->info._v__ast__Struct).concrete_types, field_fn_name, false); } _t2 = field_fn_name; } else { - _t2 = v__gen__c__Gen_get_str_fn(g, field.typ); + _t2 = v__gen__c__Gen_get_str_fn(g, ftyp_noshared); } string field_styp_fn_name = _t2; if (!(sym->kind == v__ast__Kind__f32 || sym->kind == v__ast__Kind__f64)) { @@ -69508,13 +67385,13 @@ strings__Builder fn_body; strings__Builder_write_string(&fn_body, str_intp(4, _MOV((StrIntpData[]){{_SLIT("{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = quote_str}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = g_fmt}}, {_SLIT(", {."), /*115 &string*/0xfe10, {.d_s = v__gen__c__data_str(base_fmt)}}, {_SLIT("="), 0, { .d_c = 0 }}}))); } string funcprefix = _SLIT(""); - multi_return_string_bool mr_37770 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); - string func = mr_37770.arg0; - bool caller_should_free = mr_37770.arg1; + multi_return_string_bool mr_36191 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); + string func = mr_36191.arg0; + bool caller_should_free = mr_36191.arg1; if (Array_v__ast__Type_contains(_const_v__ast__cptr_types, field.typ)) { func = str_intp(2, _MOV((StrIntpData[]){{_SLIT("(voidptr) it."), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}})); caller_should_free = false; - } else if (v__ast__Type_is_ptr(field.typ)) { + } else if (v__ast__Type_is_ptr(ftyp_noshared)) { funcprefix = /*f*/string__plus(funcprefix, str_intp(2, _MOV((StrIntpData[]){{_SLIT("isnil(it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); funcprefix = /*f*/string__plus(funcprefix, _SLIT(" ? _SLIT(\"nil\") : ")); if (!(sym->kind == v__ast__Kind__struct_ || sym->kind == v__ast__Kind__alias) && !v__ast__Type_is_int_valptr(field.typ) && !v__ast__Type_is_float_valptr(field.typ)) { @@ -69561,56 +67438,166 @@ if (v__gen__c__Gen_gen_str_for_struct_defer_0) { // Defer end } -VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr) { +VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr) { #if defined(CUSTOM_DEFINE_trace_autostr) { eprintln( str_intp(6, _MOV((StrIntpData[]){{_SLIT("> struct_auto_str_func: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" | field_type.debug() | "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT(" | "), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = has_custom_str ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" | "), /*115 &bool*/0xfe10, {.d_s = expects_ptr ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - multi_return_string_string mr_39681 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); - string deref = mr_39681.arg0; + v__ast__Type field_type = (v__ast__Type_has_flag(_field_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(_field_type)) : (_field_type)); + string sufix = (v__ast__Type_has_flag(field_type, v__ast__TypeFlag__shared_f) ? (_SLIT("->val")) : (_SLIT(""))); + multi_return_string_string mr_38270 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); + string deref = mr_38270.arg0; if (sym->kind == v__ast__Kind__enum_) { return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (v__gen__c__should_use_indent_func(sym->kind)) { - string obj = str_intp(2, _MOV((StrIntpData[]){{_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string obj = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT0, 0, { .d_c = 0 }}})); if (has_custom_str) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__array || sym->kind == v__ast__Kind__array_fixed || sym->kind == v__ast__Kind__map || sym->kind == v__ast__Kind__sum_type) { + string obj = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT0, 0, { .d_c = 0 }}})); if (has_custom_str) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__function) { return (multi_return_string_bool){.arg0= str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("()"), 0, { .d_c = 0 }}})), .arg1=true}; + } else if (sym->kind == v__ast__Kind__chan) { + return (multi_return_string_bool){.arg0= str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else { - if (sym->kind == v__ast__Kind__chan) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; - } string method_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, 0, { .d_c = 0 }}})); - bool caller_should_free = false; if (sym->kind == v__ast__Kind__bool) { - method_str = /*f*/string__plus(method_str, _SLIT(" ? _SLIT(\"true\") : _SLIT(\"false\")")); + return (multi_return_string_bool){.arg0= str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" ? _SLIT(\"true\") : _SLIT(\"false\")"), 0, { .d_c = 0 }}})), .arg1=false}; } else if ((v__ast__Type_is_int_valptr(field_type) || v__ast__Type_is_float_valptr(field_type)) && v__ast__Type_is_ptr(field_type) && !expects_ptr) { if (sym->kind == v__ast__Kind__f32) { return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){\n {_SLIT0, "), /*115 &string*/0xfe10, {.d_s = _const_si_g32_code}}, {_SLIT(", {.d_f32 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}\n }))"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__f64) { return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){\n {_SLIT0, "), /*115 &string*/0xfe10, {.d_s = _const_si_g64_code}}, {_SLIT(", {.d_f64 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}\n }))"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__u64) { - v__gen__c__StrIntpType fmt_type = v__gen__c__StrIntpType__si_u64; + StrIntpType fmt_type = StrIntpType__si_u64; return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), /*117 &u32*/0xfe06, {.d_u32 = (((u32)(fmt_type)) | 0xfe00U)}}, {_SLIT(", {.d_u64 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}}))"), 0, { .d_c = 0 }}})), .arg1=true}; } - v__gen__c__StrIntpType fmt_type = v__gen__c__StrIntpType__si_i32; + StrIntpType fmt_type = StrIntpType__si_i32; return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), /*117 &u32*/0xfe06, {.d_u32 = (((u32)(fmt_type)) | 0xfe00U)}}, {_SLIT(", {.d_i32 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}}))"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0=method_str, .arg1=caller_should_free}; + return (multi_return_string_bool){.arg0=method_str, .arg1=false}; } return (multi_return_string_bool){0}; } +VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x) { + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (x) { + case StrIntpType__si_no_str: + { + _t2 = _SLIT("no_str"); + break; + } + case StrIntpType__si_c: + { + _t2 = _SLIT("d_c"); + break; + } + case StrIntpType__si_u8: + { + _t2 = _SLIT("d_u8"); + break; + } + case StrIntpType__si_i8: + { + _t2 = _SLIT("d_i8"); + break; + } + case StrIntpType__si_u16: + { + _t2 = _SLIT("d_u16"); + break; + } + case StrIntpType__si_i16: + { + _t2 = _SLIT("d_i16"); + break; + } + case StrIntpType__si_u32: + { + _t2 = _SLIT("d_u32"); + break; + } + case StrIntpType__si_i32: + { + _t2 = _SLIT("d_i32"); + break; + } + case StrIntpType__si_u64: + { + _t2 = _SLIT("d_u64"); + break; + } + case StrIntpType__si_i64: + { + _t2 = _SLIT("d_i64"); + break; + } + case StrIntpType__si_f32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_f64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_g32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_g64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_e32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_e64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_s: + { + _t2 = _SLIT("d_s"); + break; + } + case StrIntpType__si_p: + { + _t2 = _SLIT("d_p"); + break; + } + case StrIntpType__si_vp: + { + _t2 = _SLIT("d_vp"); + break; + } + } + string _t1 = _t2; + return _t1; +} + +VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind) { + bool _t1 = (kind == v__ast__Kind__struct_ || kind == v__ast__Kind__alias || kind == v__ast__Kind__array || kind == v__ast__Kind__array_fixed || kind == v__ast__Kind__map || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__interface_); + return _t1; +} + VV_LOCAL_SYMBOL Map_string_bool v__gen__c__string_array_to_map(Array_string a) { - Map_string_bool res = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_bool res = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < a.len; ++_t1) { string x = ((string*)a.data)[_t1]; map_set(&res, &(string[]){x}, &(bool[]) { true }); @@ -70761,7 +68748,7 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { for (int ityp = 0; ityp < g->table->type_symbols.len; ++ityp) { v__ast__TypeSymbol* sym = ((v__ast__TypeSymbol**)g->table->type_symbols.data)[ityp]; if (sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; if (sum_info.is_generic) { continue; } @@ -70810,10 +68797,10 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("}")); } else if (sym->kind == v__ast__Kind__interface_) { - if ((sym->info)._typ != 436 /* v.ast.Interface */) { + if ((sym->info)._typ != 438 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -71181,7 +69168,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_chan_push_optional_fns(v__gen__c__Gen* VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type typ, bool is_prefix_struct) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); string styp = sym->cname; - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { string sgtyps = _SLIT("_T"); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).generic_types.len; ++_t1) { @@ -71192,7 +69179,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string sgtyps = _SLIT("_T"); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Interface).generic_types.len; ++_t2) { @@ -71203,7 +69190,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string sgtyps = _SLIT("_T"); for (int _t3 = 0; _t3 < (*sym->info._v__ast__SumType).generic_types.len; ++_t3) { @@ -71221,7 +69208,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty if (is_prefix_struct && sym->language == v__ast__Language__c) { styp = string_substr(styp, 3, (styp).len); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (!info.is_typedef) { styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct "), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT0, 0, { .d_c = 0 }}})); } @@ -71250,20 +69237,20 @@ void v__gen__c__Gen_write_typedef_types(v__gen__c__Gen* g) { } if (sym->kind == (v__ast__Kind__array)) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (elem_sym->kind != v__ast__Kind__placeholder && !v__ast__Type_has_flag(info.elem_type, v__ast__TypeFlag__generic)) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef array "), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else if (sym->kind == (v__ast__Kind__array_fixed)) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (v__ast__TypeSymbol_is_builtin(elem_sym)) { string styp = sym->cname; string len = string_after(styp, _SLIT("_")); string fixed = v__gen__c__Gen_typ(g, info.elem_type); - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed = strings__Builder_cut_to(&g->out, pos); @@ -71325,7 +69312,7 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast bool is_c_parent = parent->name.len > 2 && string_at(parent->name, 0) == 'C' && string_at(parent->name, 1) == '.'; bool is_typedef = false; bool is_fixed_array_of_non_builtin = false; - if ((parent->info)._typ == 418 /* v.ast.Struct */) { + if ((parent->info)._typ == 420 /* v.ast.Struct */) { is_typedef = (*parent->info._v__ast__Struct).is_typedef; } string parent_styp = parent->cname; @@ -71336,10 +69323,10 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast parent_styp = string_substr(parent->cname, 3, (parent->cname).len); } } else { - if ((sym.info)._typ == 433 /* v.ast.Alias */) { + if ((sym.info)._typ == 435 /* v.ast.Alias */) { parent_styp = v__gen__c__Gen_typ(g, (*sym.info._v__ast__Alias).parent_type); v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym.info._v__ast__Alias).parent_type); - if ((parent_sym->info)._typ == 441 /* v.ast.ArrayFixed */) { + if ((parent_sym->info)._typ == 443 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*parent_sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym)) { is_fixed_array_of_non_builtin = true; @@ -71363,10 +69350,10 @@ void v__gen__c__Gen_write_interface_typedef(v__gen__c__Gen* g, v__ast__TypeSymbo } void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - if ((sym.info)._typ != 436 /* v.ast.Interface */) { + if ((sym.info)._typ != 438 /* v.ast.Interface */) { return; } - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (info.is_generic) { return; } @@ -71395,7 +69382,7 @@ void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v_ } void v__gen__c__Gen_write_fn_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; v__ast__Fn func = info.func; bool is_fn_sig = (func.name).len == 0; bool not_anon = !info.is_anon; @@ -71542,7 +69529,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts(v__gen__c__Gen* g, Array_v__ast__Stmt } VV_LOCAL_SYMBOL bool v__gen__c__is_noreturn_callexpr(v__ast__Expr expr) { - if ((expr)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 256 /* v.ast.CallExpr */) { bool _t1 = (*expr._v__ast__CallExpr).is_noreturn; return _t1; } @@ -71561,8 +69548,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ if (g->inside_if_optional || g->inside_match_optional) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); g->skip_stmt_pos = true; - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).typ == _const_v__ast__error_type_idx || ((*stmt._v__ast__ExprStmt).expr)._typ == 280 /* v.ast.None */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).typ == _const_v__ast__error_type_idx || ((*stmt._v__ast__ExprStmt).expr)._typ == 282 /* v.ast.None */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_var}}, {_SLIT(".state = 2;"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_var}}, {_SLIT(".err = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*stmt._v__ast__ExprStmt).expr); @@ -71587,7 +69574,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); g->skip_stmt_pos = true; bool is_noreturn = false; - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { is_noreturn = v__gen__c__is_noreturn_callexpr((*stmt._v__ast__ExprStmt).expr); } if (!is_noreturn) { @@ -71600,7 +69587,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ } } else { v__gen__c__Gen_stmt(g, stmt); - if ((g->inside_if_optional || g->inside_match_optional) && (stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((g->inside_if_optional || g->inside_match_optional) && (stmt)._typ == 310 /* v.ast.ExprStmt */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } @@ -71619,10 +69606,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ if ((stmt)._typ != 185 /* v.ast.FnDecl */ && g->inside_ternary == 0) { v__token__Pos stmt_pos = (*(stmt.pos)); if (stmt_pos.pos == 0) { - if ((stmt)._typ == 318 /* v.ast.Module */) { + if ((stmt)._typ == 320 /* v.ast.Module */) { return; } - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { stmt_pos = v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr); } if (stmt_pos.pos == 0) { @@ -71657,21 +69644,21 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - if (node._typ == 306 /* v.ast.EmptyStmt */) { + if (node._typ == 308 /* v.ast.EmptyStmt */) { } - else if (node._typ == 298 /* v.ast.AsmStmt */) { + else if (node._typ == 300 /* v.ast.AsmStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AsmStmt).pos); v__gen__c__Gen_gen_asm_stmt(g, (*node._v__ast__AsmStmt)); } - else if (node._typ == 299 /* v.ast.AssertStmt */) { + else if (node._typ == 301 /* v.ast.AssertStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssertStmt).pos); v__gen__c__Gen_gen_assert_stmt(g, (*node._v__ast__AssertStmt)); } - else if (node._typ == 300 /* v.ast.AssignStmt */) { + else if (node._typ == 302 /* v.ast.AssignStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssignStmt).pos); v__gen__c__Gen_gen_assign_stmt(g, (*node._v__ast__AssignStmt)); } - else if (node._typ == 301 /* v.ast.Block */) { + else if (node._typ == 303 /* v.ast.Block */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__Block).pos); if ((*node._v__ast__Block).is_unsafe) { v__gen__c__Gen_writeln(g, _SLIT("{ // Unsafe block")); @@ -71681,7 +69668,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_stmts(g, (*node._v__ast__Block).stmts); v__gen__c__Gen_writeln(g, _SLIT("}")); } - else if (node._typ == 302 /* v.ast.BranchStmt */) { + else if (node._typ == 304 /* v.ast.BranchStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__BranchStmt).pos); if (((*node._v__ast__BranchStmt).label).len != 0) { v__ast__Stmt** _t2 = (v__ast__Stmt**)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->labeled_loops), &(string[]){(*node._v__ast__BranchStmt).label})); @@ -71700,17 +69687,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } v__ast__Stmt* x = *(v__ast__Stmt**)_t1.data; - if (x->_typ == 309 /* v.ast.ForCStmt */) { + if (x->_typ == 311 /* v.ast.ForCStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForCStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (x->_typ == 310 /* v.ast.ForInStmt */) { + else if (x->_typ == 312 /* v.ast.ForInStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForInStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (x->_typ == 311 /* v.ast.ForStmt */) { + else if (x->_typ == 313 /* v.ast.ForStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } @@ -71726,17 +69713,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } else { v__ast__Stmt* inner_loop = g->inner_loop; - if (inner_loop->_typ == 309 /* v.ast.ForCStmt */) { + if (inner_loop->_typ == 311 /* v.ast.ForCStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForCStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (inner_loop->_typ == 310 /* v.ast.ForInStmt */) { + else if (inner_loop->_typ == 312 /* v.ast.ForInStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForInStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (inner_loop->_typ == 311 /* v.ast.ForStmt */) { + else if (inner_loop->_typ == 313 /* v.ast.ForStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } @@ -71752,40 +69739,40 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*node._v__ast__BranchStmt).kind)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 304 /* v.ast.ConstDecl */) { + else if (node._typ == 306 /* v.ast.ConstDecl */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__ConstDecl).pos); v__gen__c__Gen_const_decl(g, (*node._v__ast__ConstDecl)); } - else if (node._typ == 303 /* v.ast.ComptimeFor */) { + else if (node._typ == 305 /* v.ast.ComptimeFor */) { v__gen__c__Gen_comptime_for(g, (*node._v__ast__ComptimeFor)); } - else if (node._typ == 305 /* v.ast.DeferStmt */) { + else if (node._typ == 307 /* v.ast.DeferStmt */) { v__ast__DeferStmt defer_stmt = (*node._v__ast__DeferStmt); defer_stmt.ifdef = g->defer_ifdef; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_defer_flag_var(g, (voidptr)&/*qq*/defer_stmt)}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); array_push((array*)&g->defer_stmts, _MOV((v__ast__DeferStmt[]){ defer_stmt })); } - else if (node._typ == 307 /* v.ast.EnumDecl */) { + else if (node._typ == 309 /* v.ast.EnumDecl */) { v__gen__c__Gen_enum_decl(g, (*node._v__ast__EnumDecl)); } - else if (node._typ == 308 /* v.ast.ExprStmt */) { + else if (node._typ == 310 /* v.ast.ExprStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__ExprStmt).pos); bool old_is_void_expr_stmt = g->is_void_expr_stmt; g->is_void_expr_stmt = !(*node._v__ast__ExprStmt).is_expr; - if (!v__ast__Type_alias_eq((*node._v__ast__ExprStmt).typ, _const_v__ast__void_type) && g->expected_cast_type != 0 && ((*node._v__ast__ExprStmt).expr)._typ != 278 /* v.ast.MatchExpr */) { + if (!v__ast__Type_alias_eq((*node._v__ast__ExprStmt).typ, _const_v__ast__void_type) && g->expected_cast_type != 0 && ((*node._v__ast__ExprStmt).expr)._typ != 280 /* v.ast.MatchExpr */) { v__gen__c__Gen_expr_with_cast(g, (*node._v__ast__ExprStmt).expr, (*node._v__ast__ExprStmt).typ, g->expected_cast_type); } else { v__gen__c__Gen_expr(g, (*node._v__ast__ExprStmt).expr); } g->is_void_expr_stmt = old_is_void_expr_stmt; - if (g->inside_ternary == 0 && !g->inside_if_optional && !g->inside_match_optional && !(*node._v__ast__ExprStmt).is_expr && ((*node._v__ast__ExprStmt).expr)._typ != 269 /* v.ast.IfExpr */) { + if (g->inside_ternary == 0 && !g->inside_if_optional && !g->inside_match_optional && !(*node._v__ast__ExprStmt).is_expr && ((*node._v__ast__ExprStmt).expr)._typ != 271 /* v.ast.IfExpr */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } else if (node._typ == 185 /* v.ast.FnDecl */) { v__gen__c__Gen_fn_decl(g, (*node._v__ast__FnDecl)); } - else if (node._typ == 309 /* v.ast.ForCStmt */) { + else if (node._typ == 311 /* v.ast.ForCStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForCStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -71799,7 +69786,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForCStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 310 /* v.ast.ForInStmt */) { + else if (node._typ == 312 /* v.ast.ForInStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForInStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -71813,7 +69800,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForInStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 311 /* v.ast.ForStmt */) { + else if (node._typ == 313 /* v.ast.ForStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -71827,17 +69814,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 312 /* v.ast.GlobalDecl */) { + else if (node._typ == 314 /* v.ast.GlobalDecl */) { v__gen__c__Gen_global_decl(g, (*node._v__ast__GlobalDecl)); } - else if (node._typ == 313 /* v.ast.GotoLabel */) { + else if (node._typ == 315 /* v.ast.GotoLabel */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*node._v__ast__GotoLabel).name)}}, {_SLIT(": {}"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 314 /* v.ast.GotoStmt */) { + else if (node._typ == 316 /* v.ast.GotoStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__GotoStmt).pos); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("goto "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*node._v__ast__GotoStmt).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 315 /* v.ast.HashStmt */) { + else if (node._typ == 317 /* v.ast.HashStmt */) { int line_nr = (*node._v__ast__HashStmt).pos.line_nr + 1; string ct_condition = _SLIT(""); if ((*node._v__ast__HashStmt).ct_conds.len > 0) { @@ -71905,11 +69892,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } } - else if (node._typ == 316 /* v.ast.Import */) { + else if (node._typ == 318 /* v.ast.Import */) { } - else if (node._typ == 317 /* v.ast.InterfaceDecl */) { + else if (node._typ == 319 /* v.ast.InterfaceDecl */) { v__ast__TypeSymbol* ts = v__ast__Table_sym(g->table, (*node._v__ast__InterfaceDecl).typ); - if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ).is_generic) { + if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ).is_generic) { for (int _t4 = 0; _t4 < (*node._v__ast__InterfaceDecl).methods.len; ++_t4) { v__ast__FnDecl method = ((v__ast__FnDecl*)(*node._v__ast__InterfaceDecl).methods.data)[_t4]; if (v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__optional)) { @@ -71921,19 +69908,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } } - else if (node._typ == 318 /* v.ast.Module */) { + else if (node._typ == 320 /* v.ast.Module */) { g->is_builtin_mod = v__util__module_is_builtin((*node._v__ast__Module).name); g->cur_mod = (*node._v__ast__Module); } - else if (node._typ == 279 /* v.ast.NodeError */) { + else if (node._typ == 281 /* v.ast.NodeError */) { } - else if (node._typ == 319 /* v.ast.Return */) { + else if (node._typ == 321 /* v.ast.Return */) { v__gen__c__Gen_return_stmt(g, (*node._v__ast__Return)); } - else if (node._typ == 320 /* v.ast.SqlStmt */) { + else if (node._typ == 322 /* v.ast.SqlStmt */) { v__gen__c__Gen_sql_stmt(g, (*node._v__ast__SqlStmt)); } - else if (node._typ == 321 /* v.ast.StructDecl */) { + else if (node._typ == 323 /* v.ast.StructDecl */) { string name = ((*node._v__ast__StructDecl).language == v__ast__Language__c ? (v__util__no_dots((*node._v__ast__StructDecl).name)) : (string__eq((*node._v__ast__StructDecl).name, _SLIT("array")) || string__eq((*node._v__ast__StructDecl).name, _SLIT("string"))) ? ((*node._v__ast__StructDecl).name) : (v__gen__c__c_name((*node._v__ast__StructDecl).name))); if ((*node._v__ast__StructDecl).language == v__ast__Language__c) { return; @@ -71944,7 +69931,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { strings__Builder_writeln(&g->typedefs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("typedef struct "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 245 /* v.ast.TypeDecl */) { + else if (node._typ == 247 /* v.ast.TypeDecl */) { if (!g->pref->skip_unused) { v__gen__c__Gen_writeln(g, _SLIT("// TypeDecl")); } @@ -72027,8 +70014,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, strings__Builder_writeln(&sb, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT("_ptr = memdup("), /*115 &string*/0xfe10, {.d_s = accessor}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } strings__Builder_write_string(&sb, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = exp_cname}}, {_SLIT("){ ._"), /*115 &string*/0xfe10, {.d_s = got_cname}}, {_SLIT(" = ptr, ._typ = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_sidx(g, got)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ).fields.len; ++_t3) { - v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ).fields.data)[_t3]; + for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).fields.len; ++_t3) { + v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).fields.data)[_t3]; string ptr = _SLIT("ptr"); string type_cname = got_cname; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); @@ -72063,7 +70050,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_cfn_for_casting_expr(v__gen__c__Gen* g, } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fname}}, {_SLIT("("), 0, { .d_c = 0 }}}))); if (!got_is_ptr) { - if (!v__ast__Expr_is_lvalue(expr) || ((expr)._typ == 268 /* v.ast.Ident */ && v__ast__ScopeObject_is_simple_define_const((/* as */ *(v__ast__Ident*)__as_cast((expr)._v__ast__Ident,(expr)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).obj))) { + if (!v__ast__Expr_is_lvalue(expr) || ((expr)._typ == 270 /* v.ast.Ident */ && v__ast__ScopeObject_is_simple_define_const((/* as */ *(v__ast__Ident*)__as_cast((expr)._v__ast__Ident,(expr)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).obj))) { string promotion_macro_name = (string_contains(fname, _SLIT("_to_sumtype_")) ? (_SLIT("ADDR")) : (_SLIT("HEAP"))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = promotion_macro_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = got_styp}}, {_SLIT(", ("), 0, { .d_c = 0 }}}))); rparen_n += 2; @@ -72091,8 +70078,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_expr(g, expr); return; } - if ((exp_sym->info)._typ == 436 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { - if ((expr)._typ == 293 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { + if ((exp_sym->info)._typ == 438 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { + if ((expr)._typ == 295 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { g->inside_cast_in_heap++; string got_styp = v__gen__c__Gen_cc_type(g, v__ast__Type_ref(got_type), true); string exp_styp = exp_sym->cname; @@ -72132,7 +70119,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex if (v__ast__Table_sumtype_has_variant(g->table, expected_deref_type, got_deref_type, false)) { bool is_already_sum_type = false; v__ast__Scope* scope = v__ast__Scope_innermost(g->file->scope, v__ast__Expr_pos(expr).pos); - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { _option_v__ast__Var_ptr _t1; if (_t1 = v__ast__Scope_find_var(scope, (*expr._v__ast__Ident).name), _t1.state == 0) { v__ast__Var* v = *(v__ast__Var**)_t1.data; @@ -72140,7 +70127,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex is_already_sum_type = true; } } - } else if ((expr)._typ == 288 /* v.ast.SelectorExpr */) { + } else if ((expr)._typ == 290 /* v.ast.SelectorExpr */) { _option_v__ast__ScopeStructField _t2; if (_t2 = v__ast__Scope_find_struct_field(scope, v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr), (*expr._v__ast__SelectorExpr).expr_type, (*expr._v__ast__SelectorExpr).field_name), _t2.state == 0) { is_already_sum_type = true; @@ -72150,7 +70137,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex g->prevent_sum_type_unwrapping_once = true; v__gen__c__Gen_expr(g, expr); } else { - if ((unwrapped_got_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((unwrapped_got_sym->info)._typ == 433 /* v.ast.Aggregate */) { unwrapped_got_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*unwrapped_got_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); unwrapped_got_sym = v__ast__Table_sym(g->table, unwrapped_got_type); } @@ -72188,7 +70175,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_write(g, _SLIT("->val")); return; } - if (got_is_ptr && !expected_is_ptr && neither_void && exp_sym->kind != v__ast__Kind__placeholder && (expr)._typ != 272 /* v.ast.InfixExpr */) { + if (got_is_ptr && !expected_is_ptr && neither_void && exp_sym->kind != v__ast__Kind__placeholder && (expr)._typ != 274 /* v.ast.InfixExpr */) { v__ast__Type got_deref_type = v__ast__Type_deref(got_type); v__ast__TypeSymbol* deref_sym = v__ast__Table_sym(g->table, got_deref_type); bool deref_will_match = (v__ast__Type_alias_eq(expected_type, got_type) || v__ast__Type_alias_eq(expected_type, got_deref_type) || v__ast__Type_alias_eq(expected_type, deref_sym->parent_idx)); @@ -72197,11 +70184,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_write(g, _SLIT("*")); } } - if (v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional) && (expr)._typ == 280 /* v.ast.None */) { - v__gen__c__Gen_gen_optional_error(g, expected_type, expr); - return; - } - if ((expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((expr)._typ == 275 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(expected_type, _const_v__ast__u64_type) || v__ast__Type_alias_eq(expected_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(expected_type, _const_v__ast__u16_type)) && string_at((*expr._v__ast__IntegerLiteral).val, 0) != '-') { v__gen__c__Gen_expr(g, expr); v__gen__c__Gen_write(g, _SLIT("U")); @@ -72285,7 +70268,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmS } for (int i = 0; i < _v_template.args.len; ++i) { v__ast__AsmArg arg = ((v__ast__AsmArg*)_v_template.args.data)[i]; - if (stmt.arch == v__pref__Arch__amd64 && (string__eq(_v_template.name, _SLIT("call")) || string_at(_v_template.name, 0) == 'j') && (arg)._typ == 323 /* v.ast.AsmRegister */) { + if (stmt.arch == v__pref__Arch__amd64 && (string__eq(_v_template.name, _SLIT("call")) || string_at(_v_template.name, 0) == 'j') && (arg)._typ == 325 /* v.ast.AsmRegister */) { v__gen__c__Gen_write(g, _SLIT("*")); } v__gen__c__Gen_asm_arg(g, arg, stmt); @@ -72337,7 +70320,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmS } VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg arg, v__ast__AsmStmt stmt) { - if (arg._typ == 399 /* v.ast.AsmAlias */) { + if (arg._typ == 401 /* v.ast.AsmAlias */) { string name = (*arg._v__ast__AsmAlias).name; bool _t1 = (Array_string_contains(stmt.local_labels, name) || Array_string_contains(stmt.global_labels, name) || Array_string_contains(g->file->global_labels, name) || stmt.is_basic); Array_string _t3 = {0}; @@ -72372,29 +70355,29 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%["), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("]"), 0, { .d_c = 0 }}}))); } } - else if (arg._typ == 257 /* v.ast.CharLiteral */) { + else if (arg._typ == 259 /* v.ast.CharLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__CharLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } - else if (arg._typ == 273 /* v.ast.IntegerLiteral */) { + else if (arg._typ == 275 /* v.ast.IntegerLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__IntegerLiteral).val}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 266 /* v.ast.FloatLiteral */) { + else if (arg._typ == 268 /* v.ast.FloatLiteral */) { if (g->pref->nofloat) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*100 &int*/0xfe07, {.d_i32 = string_int((*arg._v__ast__FloatLiteral).val)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__FloatLiteral).val}}, {_SLIT0, 0, { .d_c = 0 }}}))); } } - else if (arg._typ == 252 /* v.ast.BoolLiteral */) { + else if (arg._typ == 254 /* v.ast.BoolLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = bool_str((*arg._v__ast__BoolLiteral).val)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 323 /* v.ast.AsmRegister */) { + else if (arg._typ == 325 /* v.ast.AsmRegister */) { if (!stmt.is_basic) { v__gen__c__Gen_write(g, _SLIT("%")); } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__AsmRegister).name}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 398 /* v.ast.AsmAddressing */) { + else if (arg._typ == 400 /* v.ast.AsmAddressing */) { if (((*arg._v__ast__AsmAddressing).segment).len != 0) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%%"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__AsmAddressing).segment}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -72425,10 +70408,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar } case v__ast__AddressingMode__index_times_scale_plus_displacement: { - if ((displacement)._typ == 400 /* v.ast.AsmDisp */) { + if ((displacement)._typ == 402 /* v.ast.AsmDisp */) { v__gen__c__Gen_asm_arg(g, displacement, stmt); v__gen__c__Gen_write(g, _SLIT("(, ")); - } else if ((displacement)._typ == 323 /* v.ast.AsmRegister */) { + } else if ((displacement)._typ == 325 /* v.ast.AsmRegister */) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_asm_arg(g, displacement, stmt); v__gen__c__Gen_write(g, _SLIT(",")); @@ -72477,7 +70460,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar } ; } - else if (arg._typ == 400 /* v.ast.AsmDisp */) { + else if (arg._typ == 402 /* v.ast.AsmDisp */) { v__gen__c__Gen_write(g, (*arg._v__ast__AsmDisp).val); } else if (arg._typ == 20 /* string */) { @@ -72547,7 +70530,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_ternary_name(v__gen__c__Gen* g, string } VV_LOCAL_SYMBOL bool v__gen__c__Gen_gen_clone_assignment(v__gen__c__Gen* g, v__ast__Expr val, v__ast__Type typ, bool add_eq) { - if ((val)._typ != 268 /* v.ast.Ident */ && (val)._typ != 288 /* v.ast.SelectorExpr */) { + if ((val)._typ != 270 /* v.ast.Ident */ && (val)._typ != 290 /* v.ast.SelectorExpr */) { bool _t1 = false; return _t1; } @@ -72566,7 +70549,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_gen_clone_assignment(v__gen__c__Gen* g, v__a if (v__ast__Type_share(typ) == v__ast__ShareType__shared_t) { v__gen__c__Gen_write(g, _SLIT("->val")); } - v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type; int array_depth = v__gen__c__Gen_get_array_depth(g, elem_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = array_depth}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); if (v__ast__Type_share(typ) == v__ast__ShareType__shared_t) { @@ -72616,7 +70599,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_scope_vars2(v__gen__c__Gen* g, v__a } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { ; if (string__eq((*obj._v__ast__Var).name, g->returned_var_name)) { ; @@ -72672,7 +70655,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_variable(v__gen__c__Gen* g, v__ast_ return; } if (sym->kind == v__ast__Kind__string) { - if (v.expr._typ == 292 /* v.ast.StringLiteral */) { + if (v.expr._typ == 294 /* v.ast.StringLiteral */) { ; } @@ -72840,36 +70823,36 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) g->discard_or_result = false; } v__ast__Expr node = node_; - if (node._typ == 261 /* v.ast.ComptimeType */) { + if (node._typ == 263 /* v.ast.ComptimeType */) { v__gen__c__Gen_error(g, _SLIT("g.expr(): Unhandled ComptimeType"), (*node._v__ast__ComptimeType).pos); VUNREACHABLE(); } - else if (node._typ == 264 /* v.ast.EmptyExpr */) { + else if (node._typ == 266 /* v.ast.EmptyExpr */) { v__gen__c__Gen_error(g, _SLIT("g.expr(): unhandled EmptyExpr"), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); VUNREACHABLE(); } - else if (node._typ == 246 /* v.ast.AnonFn */) { + else if (node._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn(g, (voidptr)&/*qq*/(*node._v__ast__AnonFn)); } - else if (node._typ == 247 /* v.ast.ArrayDecompose */) { + else if (node._typ == 249 /* v.ast.ArrayDecompose */) { v__gen__c__Gen_expr(g, (*node._v__ast__ArrayDecompose).expr); } - else if (node._typ == 248 /* v.ast.ArrayInit */) { + else if (node._typ == 250 /* v.ast.ArrayInit */) { v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit), _SLIT("")); } - else if (node._typ == 249 /* v.ast.AsCast */) { + else if (node._typ == 251 /* v.ast.AsCast */) { v__gen__c__Gen_as_cast(g, (*node._v__ast__AsCast)); } - else if (node._typ == 250 /* v.ast.Assoc */) { + else if (node._typ == 252 /* v.ast.Assoc */) { v__gen__c__Gen_assoc(g, (*node._v__ast__Assoc)); } - else if (node._typ == 251 /* v.ast.AtExpr */) { + else if (node._typ == 253 /* v.ast.AtExpr */) { v__gen__c__Gen_comptime_at(g, (*node._v__ast__AtExpr)); } - else if (node._typ == 252 /* v.ast.BoolLiteral */) { + else if (node._typ == 254 /* v.ast.BoolLiteral */) { v__gen__c__Gen_write(g, bool_str((*node._v__ast__BoolLiteral).val)); } - else if (node._typ == 254 /* v.ast.CallExpr */) { + else if (node._typ == 256 /* v.ast.CallExpr */) { v__ast__Type ret_type = ((*node._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent ? ((*node._v__ast__CallExpr).return_type) : (v__ast__Type_clear_flag((*node._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional))); string shared_styp = _SLIT(""); if (g->is_shared && !v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__shared_f)) { @@ -72897,10 +70880,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 255 /* v.ast.CastExpr */) { + else if (node._typ == 257 /* v.ast.CastExpr */) { v__gen__c__Gen_cast_expr(g, (*node._v__ast__CastExpr)); } - else if (node._typ == 256 /* v.ast.ChanInit */) { + else if (node._typ == 258 /* v.ast.ChanInit */) { string elem_typ_str = v__gen__c__Gen_typ(g, (*node._v__ast__ChanInit).elem_type); string noscan = v__gen__c__Gen_check_noscan(g, (*node._v__ast__ChanInit).elem_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__new_channel_st"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -72913,52 +70896,52 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, elem_typ_str); v__gen__c__Gen_write(g, _SLIT("))")); } - else if (node._typ == 257 /* v.ast.CharLiteral */) { + else if (node._typ == 259 /* v.ast.CharLiteral */) { v__gen__c__Gen_char_literal(g, (*node._v__ast__CharLiteral)); } - else if (node._typ == 258 /* v.ast.Comment */) { + else if (node._typ == 260 /* v.ast.Comment */) { } - else if (node._typ == 259 /* v.ast.ComptimeCall */) { + else if (node._typ == 261 /* v.ast.ComptimeCall */) { v__gen__c__Gen_comptime_call(g, (voidptr)&/*qq*/(*node._v__ast__ComptimeCall)); } - else if (node._typ == 260 /* v.ast.ComptimeSelector */) { + else if (node._typ == 262 /* v.ast.ComptimeSelector */) { v__gen__c__Gen_comptime_selector(g, (*node._v__ast__ComptimeSelector)); } - else if (node._typ == 262 /* v.ast.ConcatExpr */) { + else if (node._typ == 264 /* v.ast.ConcatExpr */) { v__gen__c__Gen_concat_expr(g, (*node._v__ast__ConcatExpr)); } - else if (node._typ == 253 /* v.ast.CTempVar */) { + else if (node._typ == 255 /* v.ast.CTempVar */) { v__gen__c__Gen_write(g, (*node._v__ast__CTempVar).name); } - else if (node._typ == 263 /* v.ast.DumpExpr */) { + else if (node._typ == 265 /* v.ast.DumpExpr */) { v__gen__c__Gen_dump_expr(g, (*node._v__ast__DumpExpr)); } - else if (node._typ == 265 /* v.ast.EnumVal */) { + else if (node._typ == 267 /* v.ast.EnumVal */) { v__gen__c__Gen_enum_val(g, (*node._v__ast__EnumVal)); } - else if (node._typ == 266 /* v.ast.FloatLiteral */) { + else if (node._typ == 268 /* v.ast.FloatLiteral */) { if (g->pref->nofloat) { v__gen__c__Gen_write(g, int_str(string_int((*node._v__ast__FloatLiteral).val))); } else { v__gen__c__Gen_write(g, (*node._v__ast__FloatLiteral).val); } } - else if (node._typ == 267 /* v.ast.GoExpr */) { + else if (node._typ == 269 /* v.ast.GoExpr */) { v__gen__c__Gen_go_expr(g, (*node._v__ast__GoExpr)); } - else if (node._typ == 268 /* v.ast.Ident */) { + else if (node._typ == 270 /* v.ast.Ident */) { v__gen__c__Gen_ident(g, (*node._v__ast__Ident)); } - else if (node._typ == 269 /* v.ast.IfExpr */) { + else if (node._typ == 271 /* v.ast.IfExpr */) { v__gen__c__Gen_if_expr(g, (*node._v__ast__IfExpr)); } - else if (node._typ == 270 /* v.ast.IfGuardExpr */) { + else if (node._typ == 272 /* v.ast.IfGuardExpr */) { v__gen__c__Gen_write(g, _SLIT("/* guard */")); } - else if (node._typ == 271 /* v.ast.IndexExpr */) { + else if (node._typ == 273 /* v.ast.IndexExpr */) { v__gen__c__Gen_index_expr(g, (*node._v__ast__IndexExpr)); } - else if (node._typ == 272 /* v.ast.InfixExpr */) { + else if (node._typ == 274 /* v.ast.InfixExpr */) { if ((*node._v__ast__InfixExpr).op == v__token__Kind__left_shift || (*node._v__ast__InfixExpr).op == v__token__Kind__plus_assign || (*node._v__ast__InfixExpr).op == v__token__Kind__minus_assign) { g->inside_map_infix = true; v__gen__c__Gen_infix_expr(g, (*node._v__ast__InfixExpr)); @@ -72967,7 +70950,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_infix_expr(g, (*node._v__ast__InfixExpr)); } } - else if (node._typ == 273 /* v.ast.IntegerLiteral */) { + else if (node._typ == 275 /* v.ast.IntegerLiteral */) { if (string_starts_with((*node._v__ast__IntegerLiteral).val, _SLIT("0o"))) { v__gen__c__Gen_write(g, _SLIT("0")); v__gen__c__Gen_write(g, string_substr((*node._v__ast__IntegerLiteral).val, 2, ((*node._v__ast__IntegerLiteral).val).len)); @@ -72978,7 +70961,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, (*node._v__ast__IntegerLiteral).val); } } - else if (node._typ == 274 /* v.ast.IsRefType */) { + else if (node._typ == 276 /* v.ast.IsRefType */) { v__ast__Type typ = (v__ast__Type_alias_eq((*node._v__ast__IsRefType).typ, g->field_data_type) ? (g->comptime_for_field_value.typ) : ((*node._v__ast__IsRefType).typ)); v__ast__Type node_typ = v__gen__c__Gen_unwrap_generic(g, typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node_typ); @@ -72989,7 +70972,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) bool is_ref_type = v__gen__c__Gen_contains_ptr(g, node_typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/*IsRefType*/ "), /*115 &bool*/0xfe10, {.d_s = is_ref_type ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (node._typ == 275 /* v.ast.Likely */) { + else if (node._typ == 277 /* v.ast.Likely */) { if ((*node._v__ast__Likely).is_likely) { v__gen__c__Gen_write(g, _SLIT("_likely_")); } else { @@ -72999,32 +70982,32 @@ 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__Likely).expr); v__gen__c__Gen_write(g, _SLIT(")")); } - else if (node._typ == 276 /* v.ast.LockExpr */) { + else if (node._typ == 278 /* v.ast.LockExpr */) { v__gen__c__Gen_lock_expr(g, (*node._v__ast__LockExpr)); } - else if (node._typ == 277 /* v.ast.MapInit */) { + else if (node._typ == 279 /* v.ast.MapInit */) { v__gen__c__Gen_map_init(g, (*node._v__ast__MapInit)); } - else if (node._typ == 278 /* v.ast.MatchExpr */) { + else if (node._typ == 280 /* v.ast.MatchExpr */) { v__gen__c__Gen_match_expr(g, (*node._v__ast__MatchExpr)); } - else if (node._typ == 279 /* v.ast.NodeError */) { + else if (node._typ == 281 /* v.ast.NodeError */) { } - else if (node._typ == 280 /* v.ast.None */) { + else if (node._typ == 282 /* v.ast.None */) { v__gen__c__Gen_write(g, _SLIT("_const_none__")); } - else if (node._typ == 281 /* v.ast.OffsetOf */) { + else if (node._typ == 283 /* v.ast.OffsetOf */) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__OffsetOf).struct_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("/*OffsetOf*/ (u32)(__offsetof("), /*115 &string*/0xfe10, {.d_s = v__util__no_dots(styp)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__OffsetOf).field}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 282 /* v.ast.OrExpr */) { + else if (node._typ == 284 /* v.ast.OrExpr */) { } - else if (node._typ == 283 /* v.ast.ParExpr */) { + else if (node._typ == 285 /* v.ast.ParExpr */) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_expr(g, (*node._v__ast__ParExpr).expr); v__gen__c__Gen_write(g, _SLIT(")")); } - else if (node._typ == 284 /* v.ast.PostfixExpr */) { + else if (node._typ == 286 /* v.ast.PostfixExpr */) { if (((*node._v__ast__PostfixExpr).auto_locked).len != 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_lock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx);"), 0, { .d_c = 0 }}}))); } @@ -73043,7 +71026,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_unlock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx)"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 285 /* v.ast.PrefixExpr */) { + else if (node._typ == 287 /* v.ast.PrefixExpr */) { bool gen_or = (*node._v__ast__PrefixExpr).op == v__token__Kind__arrow && ((*node._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent || (*node._v__ast__PrefixExpr).is_option); if ((*node._v__ast__PrefixExpr).op == v__token__Kind__amp) { g->is_amp = true; @@ -73051,7 +71034,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) if ((*node._v__ast__PrefixExpr).op == v__token__Kind__arrow) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__PrefixExpr).right_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, (*node._v__ast__PrefixExpr).right_type); - v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 442) /*expected idx: 442, name: v.ast.Chan */ ; + v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ; v__ast__Type elem_type = right_inf.elem_type; bool is_gen_or_and_assign_rhs = gen_or && !g->discard_or_result; string _t1; /* if prepend */ @@ -73090,27 +71073,27 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) } g->is_amp = false; } - else if (node._typ == 286 /* v.ast.RangeExpr */) { + else if (node._typ == 288 /* v.ast.RangeExpr */) { } - else if (node._typ == 287 /* v.ast.SelectExpr */) { + else if (node._typ == 289 /* v.ast.SelectExpr */) { v__gen__c__Gen_select_expr(g, (*node._v__ast__SelectExpr)); } - else if (node._typ == 288 /* v.ast.SelectorExpr */) { + else if (node._typ == 290 /* v.ast.SelectorExpr */) { v__gen__c__Gen_selector_expr(g, (*node._v__ast__SelectorExpr)); } - else if (node._typ == 289 /* v.ast.SizeOf */) { + else if (node._typ == 291 /* v.ast.SizeOf */) { v__gen__c__Gen_size_of(g, (*node._v__ast__SizeOf)); } - else if (node._typ == 290 /* v.ast.SqlExpr */) { + else if (node._typ == 292 /* v.ast.SqlExpr */) { v__gen__c__Gen_sql_select_expr(g, (*node._v__ast__SqlExpr)); } - else if (node._typ == 292 /* v.ast.StringLiteral */) { + else if (node._typ == 294 /* v.ast.StringLiteral */) { v__gen__c__Gen_string_literal(g, (*node._v__ast__StringLiteral)); } - else if (node._typ == 291 /* v.ast.StringInterLiteral */) { + else if (node._typ == 293 /* v.ast.StringInterLiteral */) { v__gen__c__Gen_string_inter_literal(g, (*node._v__ast__StringInterLiteral)); } - else if (node._typ == 293 /* v.ast.StructInit */) { + else if (node._typ == 295 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).unresolved) { v__gen__c__Gen_expr(g, v__ast__resolve_init((*node._v__ast__StructInit), v__gen__c__Gen_unwrap_generic(g, (*node._v__ast__StructInit).typ), g->table)); } else { @@ -73119,16 +71102,16 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) g->inside_struct_init = false; } } - else if (node._typ == 294 /* v.ast.TypeNode */) { + else if (node._typ == 296 /* v.ast.TypeNode */) { v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*node._v__ast__TypeNode).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); string sidx = v__gen__c__Gen_type_sidx(g, typ); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sidx}}, {_SLIT(" /* "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" */"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 295 /* v.ast.TypeOf */) { + else if (node._typ == 297 /* v.ast.TypeOf */) { v__gen__c__Gen_typeof_expr(g, (*node._v__ast__TypeOf)); } - else if (node._typ == 296 /* v.ast.UnsafeExpr */) { + else if (node._typ == 298 /* v.ast.UnsafeExpr */) { v__gen__c__Gen_expr(g, (*node._v__ast__UnsafeExpr).expr); } ; @@ -73163,9 +71146,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_type_name(v__gen__c__Gen* g, v__ast__Type ra string s = _SLIT(""); if (sym->kind == v__ast__Kind__function) { if (v__ast__Type_is_ptr(typ)) { - s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ )); + s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ )); } else { - s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ); + s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ); } } else { s = v__ast__Table_type_to_str(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); @@ -73181,11 +71164,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_typeof_expr(v__gen__c__Gen* g, v__ast__TypeO v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")._typ ))")); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; string typ_name = v__ast__Table_get_type_name(g->table, fixed_info.elem_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_SLIT(\"["), /*100 &int*/0xfe07, {.d_i32 = fixed_info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = v__util__strip_main_name(typ_name)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_SLIT(\""), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_fn_decl_str(g, info)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* varg_elem_type_sym = v__ast__Table_sym(g->table, v__ast__Table_value_type(g->table, typ)); @@ -73213,10 +71196,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel else if (node.gkind_field == (v__ast__GenericKindField__unknown)) { if (string__eq(node.field_name, _SLIT("name"))) { v__ast__Type name_type = node.name_type; - if ((node.expr)._typ == 295 /* v.ast.TypeOf */) { - if (((*node.expr._v__ast__TypeOf).expr)._typ == 260 /* v.ast.ComptimeSelector */) { - if (((*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 268 /* v.ast.Ident */) { + if ((node.expr)._typ == 297 /* v.ast.TypeOf */) { + if (((*node.expr._v__ast__TypeOf).expr)._typ == 262 /* v.ast.ComptimeSelector */) { + if (((*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 270 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t2 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t1 = {0}; @@ -73250,7 +71233,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_checker_bug(g, _SLIT("unexpected SelectorExpr.expr_type = 0"), node.pos); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - bool is_optional = (node.expr)._typ == 268 /* v.ast.Ident */ && v__ast__Type_has_flag(node.expr_type, v__ast__TypeFlag__optional); + bool is_optional = (node.expr)._typ == 270 /* v.ast.Ident */ && v__ast__Type_has_flag(node.expr_type, v__ast__TypeFlag__optional); if (is_optional) { string opt_base_typ = v__gen__c__Gen_base_type(g, node.expr_type); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("(*("), /*115 &string*/0xfe10, {.d_s = opt_base_typ}}, {_SLIT("*)"), 0, { .d_c = 0 }}}))); @@ -73263,7 +71246,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_error(g, _SLIT("field_name should be `len`"), node.pos); VUNREACHABLE(); } - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { @@ -73299,7 +71282,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel string dot = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("->")) : (_SLIT("."))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")"), /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = agg_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -73312,7 +71295,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel } else if (_t4 = v__ast__Table_find_method(g->table, sym, node.field_name), _t4.state == 0) { v__ast__Fn m = *(v__ast__Fn*)_t4.data; bool has_embeds = false; - if ((sym->info)._typ == 418 /* v.ast.Struct */ || (sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 433 /* v.ast.Aggregate */) { if (node.from_embed_types.len > 0) { has_embeds = true; } @@ -73383,7 +71366,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel if (is_optional) { v__gen__c__Gen_write(g, _SLIT(".data)")); } - if ((sym->info)._typ == 418 /* v.ast.Struct */ || (sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */ || (sym->info)._typ == 433 /* v.ast.Aggregate */) { for (int i = 0; i < node.from_embed_types.len; ++i) { v__ast__Type embed = ((v__ast__Type*)node.from_embed_types.data)[i]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); @@ -73448,7 +71431,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_enum_decl(v__gen__c__Gen* g, v__ast__EnumDec } VV_LOCAL_SYMBOL void v__gen__c__Gen_enum_expr(v__gen__c__Gen* g, v__ast__Expr node) { - if (node._typ == 265 /* v.ast.EnumVal */) { + if (node._typ == 267 /* v.ast.EnumVal */) { v__gen__c__Gen_write(g, (*node._v__ast__EnumVal).val); } @@ -73573,11 +71556,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_108466 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108466.arg0; - string key_eq_fn = mr_108466.arg1; - string clone_fn = mr_108466.arg2; - string free_fn = mr_108466.arg3; + multi_return_string_string_string_string mr_108350 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_108350.arg0; + string key_eq_fn = mr_108350.arg1; + string clone_fn = mr_108350.arg2; + string free_fn = mr_108350.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -73607,22 +71590,26 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit } if (size > 0) { if (value_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write(g, str_intp(10, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof(voidptr), _MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(8, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof(voidptr),"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_write(g, str_intp(11, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(9, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("),"), 0, { .d_c = 0 }}}))); } + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); for (int _t1 = 0; _t1 < node.keys.len; ++_t1) { v__ast__Expr expr = ((v__ast__Expr*)node.keys.data)[_t1]; + v__gen__c__Gen_write(g, _SLIT("\t\t\t")); v__gen__c__Gen_expr(g, expr); - v__gen__c__Gen_write(g, _SLIT(", ")); + v__gen__c__Gen_writeln(g, _SLIT(", ")); } + v__gen__c__Gen_writeln(g, _SLIT("\t\t}),")); if (value_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}), _MOV((voidptr["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV((voidptr["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("}), _MOV(("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV(("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); } for (int i = 0; i < node.vals.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.vals.data)[i]; + v__gen__c__Gen_write(g, _SLIT("\t\t\t")); if (v__ast__Expr_is_auto_deref_var(expr)) { v__gen__c__Gen_write(g, _SLIT("*")); } @@ -73631,12 +71618,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit } else { v__gen__c__Gen_expr(g, expr); } - v__gen__c__Gen_write(g, _SLIT(", ")); + v__gen__c__Gen_writeln(g, _SLIT(", ")); } - v__gen__c__Gen_write(g, _SLIT("}))")); + v__gen__c__Gen_writeln(g, _SLIT("\t\t})")); + v__gen__c__Gen_writeln(g, _SLIT("\t)")); } else { v__gen__c__Gen_write(g, str_intp(8, _MOV((StrIntpData[]){{_SLIT("new_map"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("(sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("), "), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } + v__gen__c__Gen_writeln(g, _SLIT("")); if (g->is_shared) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } else if (is_amp) { @@ -73672,12 +71661,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_select_expr(v__gen__c__Gen* g, v__ast__Selec } else if (branch.is_timeout) { has_timeout = true; exception_branch = j; - timeout_expr = (/* as */ *(v__ast__ExprStmt*)__as_cast((branch.stmt)._v__ast__ExprStmt,(branch.stmt)._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ).expr; + timeout_expr = (/* as */ *(v__ast__ExprStmt*)__as_cast((branch.stmt)._v__ast__ExprStmt,(branch.stmt)._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ).expr; } else { - if (branch.stmt._typ == 308 /* v.ast.ExprStmt */) { - v__ast__InfixExpr expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*branch.stmt._v__ast__ExprStmt).expr)._v__ast__InfixExpr,((*branch.stmt._v__ast__ExprStmt).expr)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ; + if (branch.stmt._typ == 310 /* v.ast.ExprStmt */) { + v__ast__InfixExpr expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*branch.stmt._v__ast__ExprStmt).expr)._v__ast__InfixExpr,((*branch.stmt._v__ast__ExprStmt).expr)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ; array_push((array*)&channels, _MOV((v__ast__Expr[]){ expr.left })); - if ((expr.right)._typ == 268 /* v.ast.Ident */ || (expr.right)._typ == 271 /* v.ast.IndexExpr */ || (expr.right)._typ == 288 /* v.ast.SelectorExpr */ || (expr.right)._typ == 293 /* v.ast.StructInit */) { + if ((expr.right)._typ == 270 /* v.ast.Ident */ || (expr.right)._typ == 273 /* v.ast.IndexExpr */ || (expr.right)._typ == 290 /* v.ast.SelectorExpr */ || (expr.right)._typ == 295 /* v.ast.StructInit */) { array_push((array*)&objs, _MOV((v__ast__Expr[]){ expr.right })); array_push((array*)&tmp_objs, _MOV((string[]){ string_clone(_SLIT("")) })); array_push((array*)&elem_types, _MOV((string[]){ string_clone(_SLIT("")) })); @@ -73690,8 +71679,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_select_expr(v__gen__c__Gen* g, v__ast__Selec } array_push((array*)&is_push, _MOV((bool[]){ true })); } - else if (branch.stmt._typ == 300 /* v.ast.AssignStmt */) { - v__ast__PrefixExpr rec_expr = /* as */ *(v__ast__PrefixExpr*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._v__ast__PrefixExpr,((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._typ, 285) /*expected idx: 285, name: v.ast.PrefixExpr */ ; + else if (branch.stmt._typ == 302 /* v.ast.AssignStmt */) { + v__ast__PrefixExpr rec_expr = /* as */ *(v__ast__PrefixExpr*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._v__ast__PrefixExpr,((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._typ, 287) /*expected idx: 287, name: v.ast.PrefixExpr */ ; array_push((array*)&channels, _MOV((v__ast__Expr[]){ rec_expr.right })); array_push((array*)&is_push, _MOV((bool[]){ false })); if ((*branch.stmt._v__ast__AssignStmt).op == v__token__Kind__decl_assign || !v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right_types, 0)), (*(v__ast__Type*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).left_types, 0)))) { @@ -73816,7 +71805,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } v__ast__IdentInfo node_info = node.info; bool is_auto_heap = false; - if ((node_info)._typ == 378 /* v.ast.IdentVar */) { + if ((node_info)._typ == 380 /* v.ast.IdentVar */) { if ((*node_info._v__ast__IdentVar).is_optional && !(g->is_assign_lhs && g->right_is_opt)) { v__gen__c__Gen_write(g, _SLIT("/*opt*/")); string styp = v__gen__c__Gen_base_type(g, (*node_info._v__ast__IdentVar).typ); @@ -73828,7 +71817,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) return; } v__ast__ScopeObject v = node.obj; - if ((v)._typ == 326 /* v.ast.Var */) { + if ((v)._typ == 328 /* v.ast.Var */) { is_auto_heap = (*v._v__ast__Var).is_auto_heap && (!g->is_assign_lhs || g->assign_op != v__token__Kind__decl_assign); if (is_auto_heap) { v__gen__c__Gen_write(g, _SLIT("(*(")); @@ -73853,7 +71842,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } } string dot = (is_ptr || is_auto_heap ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -73871,7 +71860,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) v__gen__c__Gen_write(g, string__plus(_const_v__gen__c__closure_ctx, _SLIT("->"))); } } - } else if ((node_info)._typ == 377 /* v.ast.IdentFn */) { + } else if ((node_info)._typ == 379 /* v.ast.IdentFn */) { if (g->pref->translated || g->file->is_translated) { _option_v__ast__Fn _t2; if (_t2 = v__ast__Table_find_fn(g->table, node.name), _t2.state == 0) { @@ -73912,13 +71901,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.typ); if (sym->kind == v__ast__Kind__sum_type || sym->kind == v__ast__Kind__interface_) { v__gen__c__Gen_expr_with_cast(g, node.expr, node.expr_type, node.typ); - } else if (sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(node.typ) && !(/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).is_typedef) { + } else if (sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(node.typ) && !(/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).is_typedef) { string styp = v__gen__c__Gen_typ(g, node.typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("*(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" *)(&"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT("))")); } else if (sym->kind == v__ast__Kind__alias && v__ast__Table_final_sym(g->table, node.typ)->kind == v__ast__Kind__array_fixed) { - if ((node.expr)._typ == 248 /* v.ast.ArrayInit */ && g->assign_op != v__token__Kind__decl_assign) { + if ((node.expr)._typ == 250 /* v.ast.ArrayInit */ && g->assign_op != v__token__Kind__decl_assign) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*node.expr._v__ast__ArrayInit).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } v__gen__c__Gen_expr(g, node.expr); @@ -73932,10 +71921,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp if ((g->pref->translated || g->file->is_translated) && sym->kind == v__ast__Kind__function) { } string cast_label = _SLIT(""); - if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { + if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { cast_label = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(")"), 0, { .d_c = 0 }}})); } - if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 280 /* v.ast.None */) { + if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 282 /* v.ast.None */) { v__gen__c__Gen_gen_optional_error(g, node.typ, node.expr); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = cast_label}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -73946,7 +71935,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp } } v__gen__c__Gen_expr(g, node.expr); - if ((node.expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((node.expr)._typ == 275 /* v.ast.IntegerLiteral */) { if (v__ast__Type_alias_eq(node.typ, _const_v__ast__u64_type) || v__ast__Type_alias_eq(node.typ, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.typ, _const_v__ast__u16_type)) { if (!string_starts_with((*node.expr._v__ast__IntegerLiteral).val, _SLIT("-"))) { v__gen__c__Gen_write(g, _SLIT("U")); @@ -73985,7 +71974,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_concat_expr(v__gen__c__Gen* g, v__ast__Conca // Attr: [inline] inline VV_LOCAL_SYMBOL bool v__gen__c__Gen_expr_is_multi_return_call(v__gen__c__Gen* g, v__ast__Expr expr) { - if ((expr)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 256 /* v.ast.CallExpr */) { bool _t1 = v__ast__Table_sym(g->table, (*expr._v__ast__CallExpr).return_type)->kind == v__ast__Kind__multi_return; return _t1; } @@ -74013,7 +72002,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; g->inside_return = true; v__gen__c__Gen_return_stmt_defer_0 = true; if (node.exprs.len > 0) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 259 /* v.ast.ComptimeCall */) { + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 261 /* v.ast.ComptimeCall */) { v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0))); v__gen__c__Gen_writeln(g, _SLIT(";")); // Defer begin @@ -74052,7 +72041,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; string ret_typ = v__gen__c__Gen_typ(g, v__gen__c__Gen_unwrap_generic(g, g->fn_decl->return_type)); bool use_tmp_var = g->defer_stmts.len > 0 || g->defer_profile_code.len > 0 || g->cur_lock.lockeds.len > 0; if (fn_return_is_optional) { - bool optional_none = ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 280 /* v.ast.None */; + bool optional_none = ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 282 /* v.ast.None */; string ftyp = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0))); bool is_regular_option = string__eq(ftyp, _SLIT("_option")); if (optional_none || is_regular_option || (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)) == _const_v__ast__error_type_idx) { @@ -74127,7 +72116,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; } } if (fn_return_is_multi && node.exprs.len > 0 && !v__gen__c__Gen_expr_is_multi_return_call(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))) { - if (node.exprs.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 269 /* v.ast.IfExpr */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 278 /* v.ast.MatchExpr */)) { + if (node.exprs.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 271 /* v.ast.IfExpr */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 280 /* v.ast.MatchExpr */)) { 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 = tmpvar}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0))); v__gen__c__Gen_writeln(g, _SLIT(";")); @@ -74141,7 +72130,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, g->fn_decl->return_type); - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; string styp = _SLIT(""); if (fn_return_is_optional || fn_return_is_result) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -74161,7 +72150,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; for (int i = 0; i < node.exprs.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.exprs.data)[i]; if (v__gen__c__Gen_expr_is_multi_return_call(g, expr)) { - v__ast__CallExpr c = /* as */ *(v__ast__CallExpr*)__as_cast((expr)._v__ast__CallExpr,(expr)._typ, 254) /*expected idx: 254, name: v.ast.CallExpr */ ; + v__ast__CallExpr c = /* as */ *(v__ast__CallExpr*)__as_cast((expr)._v__ast__CallExpr,(expr)._typ, 256) /*expected idx: 256, name: v.ast.CallExpr */ ; v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(g->table, c.return_type); string tmp = v__gen__c__Gen_new_tmp_var(g); if (!v__ast__Type_has_flag(c.return_type, v__ast__TypeFlag__optional)) { @@ -74229,7 +72218,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__ast__TypeSymbol* return_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0))); v__ast__Expr expr0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)); bool _t1 = 0; - if (expr0._typ == 254 /* v.ast.CallExpr */) { + if (expr0._typ == 256 /* v.ast.CallExpr */) { _t1 = v__ast__Type_has_flag((*expr0._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) && (*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent; } @@ -74242,7 +72231,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("opt_ok2(&("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]) { "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(g->fn_decl->return_type) && v__ast__Type_is_ptr((*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)))) { - if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 268 /* v.ast.Ident */ && !g->is_amp)) { + if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 270 /* v.ast.Ident */ && !g->is_amp)) { v__gen__c__Gen_write(g, _SLIT("*")); } } @@ -74265,7 +72254,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } bool _t2 = 0; - if (expr0._typ == 254 /* v.ast.CallExpr */) { + if (expr0._typ == 256 /* v.ast.CallExpr */) { _t2 = v__ast__Type_has_flag((*expr0._v__ast__CallExpr).return_type, v__ast__TypeFlag__result) && (*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent; } @@ -74278,7 +72267,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__result_name}}, {_SLIT("_ok(&("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]) { "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(g->fn_decl->return_type) && v__ast__Type_is_ptr((*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)))) { - if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 268 /* v.ast.Ident */ && !g->is_amp)) { + if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 270 /* v.ast.Ident */ && !g->is_amp)) { v__gen__c__Gen_write(g, _SLIT("*")); } } @@ -74302,13 +72291,13 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; } if (g->is_autofree) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)); - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { g->returned_var_name = (*expr._v__ast__Ident).name; } } use_tmp_var = use_tmp_var || !g->is_builtin_mod; if (use_tmp_var) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ != 268 /* v.ast.Ident */ || use_tmp_var) { + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ != 270 /* v.ast.Ident */ || use_tmp_var) { 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 = tmpvar}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); } else { use_tmp_var = false; @@ -74378,7 +72367,7 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; string name = v__gen__c__c_name(field.name); string const_name = (Array_v__ast__Attr_contains(node.attrs, _SLIT("export")) && !g->is_builtin_mod ? ((*(v__ast__Attr*)/*ee elem_sym */array_get(node.attrs, 0)).arg) : (string__plus(_SLIT("_const_"), name))); v__ast__Expr field_expr = field.expr; - if (field.expr._typ == 248 /* v.ast.ArrayInit */) { + if (field.expr._typ == 250 /* v.ast.ArrayInit */) { if ((*field.expr._v__ast__ArrayInit).is_fixed) { string styp = v__gen__c__Gen_typ(g, (*field.expr._v__ast__ArrayInit).typ); if (g->pref->build_mode != v__pref__BuildMode__build_module) { @@ -74391,14 +72380,14 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } } - else if (field.expr._typ == 292 /* v.ast.StringLiteral */) { + else if (field.expr._typ == 294 /* v.ast.StringLiteral */) { strings__Builder_writeln(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}}))); if (g->pref->build_mode != v__pref__BuildMode__build_module) { string val = v__gen__c__Gen_expr_string(g, field.expr); strings__Builder_writeln(&g->stringliterals, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (field.expr._typ == 254 /* v.ast.CallExpr */) { + else if (field.expr._typ == 256 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*field.expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional)) { g->inside_const_optional = true; bool unwrap_option = (*field.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent; @@ -74507,7 +72496,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st strings__Builder_writeln(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring_free(&"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } - else if (ct_value._typ == 264 /* v.ast.EmptyExpr */) { + else if (ct_value._typ == 266 /* v.ast.EmptyExpr */) { bool _t4 = false; return _t4; } @@ -74599,7 +72588,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa } string styp = v__gen__c__Gen_typ(g, field.typ); v__ast__Expr anon_fn_expr = field.expr; - if (field.has_expr && (anon_fn_expr)._typ == 246 /* v.ast.AnonFn */) { + if (field.has_expr && (anon_fn_expr)._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn)); string fn_type_name = v__gen__c__Gen_get_anon_fn_type_name(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn), field.name); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_type_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_sym(g->table, field.typ)->name}}, {_SLIT("; // global2"), 0, { .d_c = 0 }}}))); @@ -74636,13 +72625,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_assoc(v__gen__c__Gen* g, v__ast__Assoc node) } string styp = v__gen__c__Gen_typ(g, node.typ); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); - Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < node.fields.len; ++i) { string field = ((string*)node.fields.data)[i]; map_set(&inited_fields, &(string[]){field}, &(int[]) { i }); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.typ); - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; string field_name = v__gen__c__c_name(field.name); @@ -74683,7 +72673,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_checker_bug(v__gen__c__Gen* g, string s, v__ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_init_function(v__gen__c__Gen* g) { bool v__gen__c__Gen_write_init_function_defer_0 = false; - if (g->pref->no_builtin) { + if (g->pref->no_builtin || (g->pref->translated && g->pref->is_o)) { return; } v__util__timing_start(_SLIT("Gen.write_init_function")); @@ -74821,7 +72811,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->typedefs, _SLIT("typedef struct none none;")); } string name = sym->cname; - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { continue; } @@ -74852,9 +72842,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_148548 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_148548.arg0; - string base = mr_148548.arg1; + multi_return_string_string mr_148577 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_148577.arg0; + string base = mr_148577.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -74877,7 +72867,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ size_suffix = _SLIT(" : 1"); } else { v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); - if ((field_sym->info)._typ == 447 /* v.ast.Enum */) { + if ((field_sym->info)._typ == 449 /* 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; @@ -74900,9 +72890,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}"), /*115 &string*/0xfe10, {.d_s = ti_attrs}}, {_SLIT(";\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->type_definitions, post_pragma); } - else if (sym->info._typ == 433 /* v.ast.Alias */) { + else if (sym->info._typ == 435 /* v.ast.Alias */) { } - else if (sym->info._typ == 443 /* v.ast.Thread */) { + else if (sym->info._typ == 445 /* v.ast.Thread */) { if (g->pref->os == v__pref__OS__windows) { if (string__eq(name, _SLIT("__v_thread"))) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef HANDLE "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -74918,7 +72908,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { continue; } @@ -74948,7 +72938,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, _SLIT("};")); strings__Builder_writeln(&g->type_definitions, _SLIT("")); } - else if (sym->info._typ == 441 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym) && !v__ast__Type_has_flag((*sym->info._v__ast__ArrayFixed).elem_type, v__ast__TypeFlag__generic)) { string styp = sym->cname; @@ -74960,7 +72950,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ if (string_starts_with(fixed_elem_name, _SLIT("C__"))) { fixed_elem_name = string_substr(fixed_elem_name, 3, (fixed_elem_name).len); } - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed_elem_name = strings__Builder_cut_to(&g->out, pos); @@ -74996,13 +72986,13 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } Array_string field_deps = __new_array_with_default(0, 0, sizeof(string), 0); - if (sym->info._typ == 441 /* v.ast.ArrayFixed */) { + if (sym->info._typ == 443 /* v.ast.ArrayFixed */) { string dep = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; if (Array_string_contains(type_names, dep)) { array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); } } - else if (sym->info._typ == 418 /* v.ast.Struct */) { + else if (sym->info._typ == 420 /* v.ast.Struct */) { for (int _t5 = 0; _t5 < (*sym->info._v__ast__Struct).embeds.len; ++_t5) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t5]; string dep = v__ast__Table_sym(g->table, embed)->name; @@ -75022,7 +73012,7 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); - if ((fsym->info)._typ == 433 /* v.ast.Alias */) { + if ((fsym->info)._typ == 435 /* v.ast.Alias */) { string xdep = v__ast__Table_sym(g->table, (*fsym->info._v__ast__Alias).parent_type)->name; if (!Array_string_contains(type_names, xdep) || Array_string_contains(field_deps, xdep)) { continue; @@ -75119,12 +73109,12 @@ bool v__gen__c__Gen_or_block_defer_0 = false; g->inside_or_block = true; v__gen__c__Gen_or_block_defer_0 = true; Array_v__ast__Stmt stmts = or_block.stmts; - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 308 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 310 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { g->indent++; for (int i = 0; i < stmts.len; ++i) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[i]; if (i == stmts.len - 1) { - v__ast__ExprStmt expr_stmt = /* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ; + v__ast__ExprStmt expr_stmt = /* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("*("), /*115 &string*/0xfe10, {.d_s = mr_styp}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".data = "), 0, { .d_c = 0 }}}))); bool old_inside_opt_data = g->inside_opt_data; @@ -75140,47 +73130,20 @@ bool v__gen__c__Gen_or_block_defer_0 = false; g->indent--; } else { v__gen__c__Gen_stmts(g, stmts); - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 308 /* v.ast.ExprStmt */) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 310 /* v.ast.ExprStmt */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } g->or_expr_return_type = _const_v__ast__void_type; - } else if (or_block.kind == v__ast__OrKind__propagate_option) { + } else if (or_block.kind == v__ast__OrKind__propagate_result || (or_block.kind == v__ast__OrKind__propagate_option && v__ast__Type_has_flag(return_type, v__ast__TypeFlag__result))) { 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_158331 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158331.arg0; - string pafile = mr_158331.arg1; - string pamod = mr_158331.arg2; - string pafn = mr_158331.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 }}}))); - } - } else if (!isnil(g->fn_decl) && g->fn_decl->is_test) { - v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(g, or_block, cvar_name); - } else { - v__gen__c__Gen_write_defer_stmts(g); - if (v__ast__Type_alias_eq(g->fn_decl->return_type, _const_v__ast__void_type)) { - v__gen__c__Gen_writeln(g, _SLIT("\treturn;")); - } else { - string styp = v__gen__c__Gen_typ(g, g->fn_decl->return_type); - string err_obj = v__gen__c__Gen_new_tmp_var(g); - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tmemcpy(&"), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(", &"), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(", sizeof(Option));"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - } - } - } else if (or_block.kind == v__ast__OrKind__propagate_result) { - 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_159598 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_159598.arg0; - string pafile = mr_159598.arg1; - string pamod = mr_159598.arg2; - string pafn = mr_159598.arg3; + multi_return_int_string_string_string mr_158435 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_158435.arg0; + string pafile = mr_158435.arg1; + string pamod = mr_158435.arg2; + string pafn = mr_158435.arg3; 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 }}}))); @@ -75199,6 +73162,33 @@ bool v__gen__c__Gen_or_block_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } + } else if (or_block.kind == v__ast__OrKind__propagate_option) { + if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { + string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); + if (g->pref->is_debug) { + multi_return_int_string_string_string mr_159705 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_159705.arg0; + string pafile = mr_159705.arg1; + string pamod = mr_159705.arg2; + string pafn = mr_159705.arg3; + 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 }}}))); + } + } else if (!isnil(g->fn_decl) && g->fn_decl->is_test) { + v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(g, or_block, cvar_name); + } else { + v__gen__c__Gen_write_defer_stmts(g); + if (v__ast__Type_alias_eq(g->fn_decl->return_type, _const_v__ast__void_type)) { + v__gen__c__Gen_writeln(g, _SLIT("\treturn;")); + } else { + string styp = v__gen__c__Gen_typ(g, g->fn_decl->return_type); + string err_obj = v__gen__c__Gen_new_tmp_var(g); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tmemcpy(&"), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(", &"), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(", sizeof(_option));"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + } + } } v__gen__c__Gen_writeln(g, _SLIT("}")); v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -75253,7 +73243,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } case v__ast__Kind__alias: { - string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type); + string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type); return _t6; break; } @@ -75290,11 +73280,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_162208 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162208.arg0; - string key_eq_fn = mr_162208.arg1; - string clone_fn = mr_162208.arg2; - string free_fn = mr_162208.arg3; + multi_return_string_string_string_string mr_162313 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_162313.arg0; + string key_eq_fn = mr_162313.arg1; + string clone_fn = mr_162313.arg2; + string free_fn = mr_162313.arg3; 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(""))); @@ -75321,7 +73311,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { bool has_none_zero = false; string init_str = _SLIT("{"); - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; bool typ_is_shared_f = v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f); if (sym->language == v__ast__Language__v && !typ_is_shared_f) { for (int _t12 = 0; _t12 < info.fields.len; ++_t12) { @@ -75340,7 +73330,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } else { string zero_str = v__gen__c__Gen_type_default(g, field.typ); if (string__eq(zero_str, _SLIT("{0}"))) { - if ((field_sym->info)._typ == 418 /* v.ast.Struct */ && field_sym->language == v__ast__Language__v) { + if ((field_sym->info)._typ == 420 /* v.ast.Struct */ && field_sym->language == v__ast__Language__v) { if ((*field_sym->info._v__ast__Struct).fields.len == 0 && (*field_sym->info._v__ast__Struct).embeds.len == 0) { zero_str = _SLIT("{EMPTY_STRUCT_INITIALIZATION}"); } @@ -75460,6 +73450,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_size_of(v__gen__c__Gen* g, v__ast__SizeOf no v__gen__c__Gen_error(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); } + if ((node.expr)._typ == 294 /* v.ast.StringLiteral */) { + if ((*node.expr._v__ast__StringLiteral).language == v__ast__Language__c) { + v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof(\""), /*115 &string*/0xfe10, {.d_s = (*node.expr._v__ast__StringLiteral).val}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); + return; + } + } string styp = v__gen__c__Gen_typ(g, node_typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__util__no_dots(styp)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } @@ -75479,7 +73475,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no string styp = v__gen__c__Gen_typ(g, unwrapped_node_typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped_node_typ); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - if ((expr_type_sym->info)._typ == 437 /* v.ast.SumType */) { + if ((expr_type_sym->info)._typ == 439 /* v.ast.SumType */) { string dot = (v__ast__Type_is_ptr(node.expr_type) ? (_SLIT("->")) : (_SLIT("."))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* as */ *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)__as_cast("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT("(")); @@ -75509,7 +73505,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no } v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (!_IN_MAP(ADDR(int, node.typ), ADDR(map, info.conversions))) { Array_v__ast__Type left_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){expr_type_sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); Array_v__ast__Type right_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); @@ -75580,10 +73576,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 436 /* v.ast.Interface */) { + if ((isym->info)._typ != 438 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -75591,7 +73587,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { string methods_struct_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct _"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("_interface_methods"), 0, { .d_c = 0 }}})); strings__Builder methods_struct_def = strings__new_builder(100); strings__Builder_writeln(&methods_struct_def, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = methods_struct_name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); - Map_string_int methodidx = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int methodidx = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int k = 0; k < inter_info.methods.len; ++k) { v__ast__Fn method = ((v__ast__Fn*)inter_info.methods.data)[k]; map_set(&methodidx, &(string[]){method.name}, &(int[]) { k }); @@ -75618,7 +73615,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { strings__Builder cast_functions = strings__new_builder(100); strings__Builder methods_wrapper = strings__new_builder(100); strings__Builder_writeln(&methods_wrapper, str_intp(2, _MOV((StrIntpData[]){{_SLIT("// Methods wrapper for interface \""), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); - Map_string_int already_generated_mwrappers = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int already_generated_mwrappers = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int iinidx_minimum_base = 1000; int current_iinidx = iinidx_minimum_base; for (int _t2 = 0; _t2 < inter_info.types.len; ++_t2) { @@ -75717,7 +73715,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { array_push((array*)&_t10, &ti); } Array_string method_names =_t10; - if (st_sym->info._typ == 418 /* v.ast.Struct */) { + if (st_sym->info._typ == 420 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Struct).parent_type); for (int _t12 = 0; _t12 < parent_sym->methods.len; ++_t12) { @@ -75734,7 +73732,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 436 /* v.ast.Interface */) { + else if (st_sym->info._typ == 438 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Interface).parent_type); for (int _t15 = 0; _t15 < parent_sym->methods.len; ++_t15) { @@ -75751,7 +73749,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 437 /* v.ast.SumType */) { + else if (st_sym->info._typ == 439 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__SumType).parent_type); for (int _t18 = 0; _t18 < parent_sym->methods.len; ++_t18) { @@ -75794,13 +73792,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { string name = method.name; if (v__ast__Type_has_flag(inter_info.parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, inter_info.parent_type); - if (parent_sym->info._typ == 418 /* v.ast.Struct */) { + if (parent_sym->info._typ == 420 /* v.ast.Struct */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Struct).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 436 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Interface).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 437 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__SumType).concrete_types, method.name, false); } @@ -75811,7 +73809,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (!_IN_MAP(ADDR(string, method.name), ADDR(map, methodidx))) { continue; } - if ((st_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((st_sym->info)._typ == 420 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { name = v__gen__c__Gen_generic_fn_name(g, (*st_sym->info._v__ast__Struct).concrete_types, method.name, false); } @@ -75825,8 +73823,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,.typ = v__ast__Type_set_nr_muls(st, 1),(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,}) }); - multi_return_Array_string_Array_string_Array_bool mr_176690 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_176690.arg0; + multi_return_Array_string_Array_string_Array_bool mr_176920 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_176920.arg0; 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__")); @@ -75843,8 +73841,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_177154 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_177154.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_177384 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_177384.arg1; 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 }}})); @@ -75982,7 +73980,7 @@ int v__gen__c__Gen_get_array_depth(v__gen__c__Gen* g, v__ast__Type el_typ) { v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, el_typ); v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, typ); if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; int _t1 = 1 + v__gen__c__Gen_get_array_depth(g, info.elem_type); return _t1; } else { @@ -76029,14 +74027,14 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; bool _t5 = v__gen__c__Gen_contains_ptr(g, info.elem_type); return _t5; break; } case v__ast__Kind__struct_: { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; for (int _t6 = 0; _t6 < info.embeds.len; ++_t6) { v__ast__Type embed = ((v__ast__Type*)info.embeds.data)[_t6]; if (v__gen__c__Gen_contains_ptr(g, embed)) { @@ -76057,7 +74055,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__aggregate: { - v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ; + v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ; for (int _t11 = 0; _t11 < info.types.len; ++_t11) { v__ast__Type atyp = ((v__ast__Type*)info.types.data)[_t11]; if (v__gen__c__Gen_contains_ptr(g, atyp)) { @@ -76071,7 +74069,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__multi_return: { - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; for (int _t14 = 0; _t14 < info.types.len; ++_t14) { v__ast__Type mrtyp = ((v__ast__Type*)info.types.data)[_t14]; if (v__gen__c__Gen_contains_ptr(g, mrtyp)) { @@ -76214,23 +74212,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { v__gen__c__Gen_writeln(g, _SLIT("#endif")); } v__gen__c__Gen_writeln(g, _SLIT("\t_vinit(___argc, (voidptr)___argv);")); - if (g->pref->is_prof) { - v__gen__c__Gen_writeln(g, _SLIT("")); - v__gen__c__Gen_writeln(g, _SLIT("\tatexit(vprint_profile_stats);")); - v__gen__c__Gen_writeln(g, _SLIT("")); - } + v__gen__c__Gen_gen_c_main_profile_hook(g); if (g->pref->is_livemain) { v__gen__c__Gen_generate_hotcode_reloading_main_caller(g); } - if ((g->pref->profile_file).len != 0) { - if (Array_string_contains(g->pref->compile_defines, _SLIT("no_profile_startup"))) { - v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); - } - if (g->pref->profile_fns.len > 0) { - v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); - v__gen__c__Gen_writeln(g, _SLIT("v__profile_enabled = false;")); - } - } } void v__gen__c__Gen_gen_c_main_footer(v__gen__c__Gen* g) { @@ -76243,7 +74228,9 @@ void v__gen__c__Gen_gen_c_android_sokol_main(v__gen__c__Gen* g) { if (g->is_autofree) { v__gen__c__Gen_writeln(g, _SLIT("// Wrapping cleanup/free callbacks for sokol to include _vcleanup()\nvoid (*_vsokol_user_cleanup_ptr)(void);\nvoid (*_vsokol_user_cleanup_cb_ptr)(void *);\n\nvoid (_vsokol_cleanup_cb)(void) {\n\011if (_vsokol_user_cleanup_ptr) {\n\011\011_vsokol_user_cleanup_ptr();\n\011}\n\011_vcleanup();\n}\n\nvoid (_vsokol_cleanup_userdata_cb)(void* user_data) {\n\011if (_vsokol_user_cleanup_cb_ptr) {\n\011\011_vsokol_user_cleanup_cb_ptr(g_desc.user_data);\n\011}\n\011_vcleanup();\n}\n")); } - v__gen__c__Gen_writeln(g, _SLIT("// The sokol_main entry point on Android\nsapp_desc sokol_main(int argc, char* argv[]) {\n\011(void)argc; (void)argv;\n\n\011_vinit(argc, (voidptr)argv);\n\011main__main();\n")); + v__gen__c__Gen_writeln(g, _SLIT("// The sokol_main entry point on Android\nsapp_desc sokol_main(int argc, char* argv[]) {\n\011(void)argc; (void)argv;\n\n\011_vinit(argc, (voidptr)argv);\n\011")); + v__gen__c__Gen_gen_c_main_profile_hook(g); + v__gen__c__Gen_writeln(g, _SLIT("\tmain__main();")); if (g->is_autofree) { v__gen__c__Gen_writeln(g, _SLIT("\011// Wrap user provided cleanup/free functions for sokol to be able to call _vcleanup()\n\011if (g_desc.cleanup_cb) {\n\011\011_vsokol_user_cleanup_ptr = g_desc.cleanup_cb;\n\011\011g_desc.cleanup_cb = _vsokol_cleanup_cb;\n\011}\n\011else if (g_desc.cleanup_userdata_cb) {\n\011\011_vsokol_user_cleanup_cb_ptr = g_desc.cleanup_userdata_cb;\n\011\011g_desc.cleanup_userdata_cb = _vsokol_cleanup_userdata_cb;\n\011}\n")); } @@ -76257,27 +74244,44 @@ void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g) { } void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name) { - multi_return_int_string_string_string mr_5124 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_5124.arg0; - string pafile = mr_5124.arg1; - string pamod = mr_5124.arg2; - string pafn = mr_5124.arg3; + multi_return_int_string_string_string mr_4758 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_4758.arg0; + string pafile = mr_4758.arg1; + string pamod = mr_4758.arg2; + string pafn = mr_4758.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name) { - multi_return_int_string_string_string mr_5815 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); - int paline = mr_5815.arg0; - string pafile = mr_5815.arg1; - string pamod = mr_5815.arg2; - string pafn = mr_5815.arg3; + multi_return_int_string_string_string mr_5449 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5449.arg0; + string pafile = mr_5449.arg1; + string pamod = mr_5449.arg2; + string pafn = mr_5449.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } +void v__gen__c__Gen_gen_c_main_profile_hook(v__gen__c__Gen* g) { + if (g->pref->is_prof) { + v__gen__c__Gen_writeln(g, _SLIT("")); + v__gen__c__Gen_writeln(g, _SLIT("\tatexit(vprint_profile_stats);")); + v__gen__c__Gen_writeln(g, _SLIT("")); + } + if ((g->pref->profile_file).len != 0) { + if (Array_string_contains(g->pref->compile_defines, _SLIT("no_profile_startup"))) { + v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); + } + if (g->pref->profile_fns.len > 0) { + v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); + v__gen__c__Gen_writeln(g, _SLIT("v__profile_enabled = false;")); + } + } +} + void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { int main_fn_start_pos = g->out.len; v__gen__c__Gen_writeln(g, _SLIT("")); @@ -76295,6 +74299,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("\tmain__vtest_init();")); v__gen__c__Gen_writeln(g, _SLIT("\t_vinit(___argc, (voidptr)___argv);")); + v__gen__c__Gen_gen_c_main_profile_hook(g); Array_string all_tfuncs = v__gen__c__Gen_get_all_test_function_names(g); all_tfuncs = v__gen__c__Gen_filter_only_matching_fn_names(g, all_tfuncs); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring v_test_file = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(g->pref->path)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -76387,8 +74392,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast_ } else { v__gen__c__Gen_write(g, _SLIT(".")); } - if ((node.field_expr)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 268 /* v.ast.Ident */) { + if ((node.field_expr)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 270 /* 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"))) { 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)); @@ -76439,7 +74444,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com for (int _t3 = 0; _t3 < _t2_len; ++_t3) { v__ast__Stmt it = ((v__ast__Stmt*) _t2_orig.data)[_t3]; - if ((it)._typ != 319 /* v.ast.Return */) { + if ((it)._typ != 321 /* v.ast.Return */) { array_push((array*)&_t2, &it); } } @@ -76475,7 +74480,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com if (node->args.len > 0 && m.params.len - 1 >= node->args.len) { v__ast__CallArg arg = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, node->args.len - 1)); v__ast__Param param = (*(v__ast__Param*)/*ee elem_sym */array_get(m.params, node->args.len)); - _t5 = (arg.expr)._typ == 268 /* v.ast.Ident */ && string__eq(v__ast__Table_type_to_str(g->table, arg.typ), _SLIT("[]string")) && !string__eq(v__ast__Table_type_to_str(g->table, param.typ), _SLIT("[]string")); + _t5 = (arg.expr)._typ == 270 /* v.ast.Ident */ && string__eq(v__ast__Table_type_to_str(g->table, arg.typ), _SLIT("[]string")) && !string__eq(v__ast__Table_type_to_str(g->table, param.typ), _SLIT("[]string")); } else { _t5 = false; } @@ -76490,8 +74495,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com return; } v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__util__no_dots(sym->name)}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = g->comptime_for_method}}, {_SLIT("("), 0, { .d_c = 0 }}}))); - if ((node->left)._typ == 268 /* v.ast.Ident */) { - if (((*node->left._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((node->left)._typ == 270 /* v.ast.Ident */) { + if (((*node->left._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if (v__ast__Type_is_ptr((*(v__ast__Param*)/*ee elem_sym */array_get(m.params, 0)).typ) && !v__ast__Type_is_ptr((*((*node->left._v__ast__Ident).obj.typ)))) { v__gen__c__Gen_write(g, _SLIT("&")); } @@ -76502,7 +74507,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com v__gen__c__Gen_write(g, _SLIT(", ")); } for (int i = 1; i < m.params.len; ++i) { - if ((node->left)._typ == 268 /* v.ast.Ident */) { + if ((node->left)._typ == 270 /* v.ast.Ident */) { if (string__eq((*(v__ast__Param*)/*ee elem_sym */array_get(m.params, i)).name, (*node->left._v__ast__Ident).name)) { continue; } @@ -76586,7 +74591,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp return; } if (!g->pref->output_cross_c) { - if (((*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond)._typ == 268 /* v.ast.Ident */) { + if (((*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond)._typ == 270 /* v.ast.Ident */) { _option_v__pref__OS _t1 = v__pref__os_from_string((*(*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond._v__ast__Ident).name); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -76632,7 +74637,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp if (node.is_expr) { int len = branch.stmts.len; if (len > 0) { - v__ast__ExprStmt last = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ; + v__ast__ExprStmt last = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ; if (len > 1) { string tmp = v__gen__c__Gen_new_tmp_var(g); string styp = v__gen__c__Gen_typ(g, last.typ); @@ -76668,25 +74673,25 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp } VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__Expr cond, bool pkg_exist) { - if (cond._typ == 252 /* v.ast.BoolLiteral */) { + if (cond._typ == 254 /* v.ast.BoolLiteral */) { v__gen__c__Gen_expr(g, cond); bool _t1 = true; return _t1; } - else if (cond._typ == 283 /* v.ast.ParExpr */) { + else if (cond._typ == 285 /* v.ast.ParExpr */) { v__gen__c__Gen_write(g, _SLIT("(")); bool is_cond_true = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__ParExpr).expr, pkg_exist); v__gen__c__Gen_write(g, _SLIT(")")); bool _t2 = is_cond_true; return _t2; } - else if (cond._typ == 285 /* v.ast.PrefixExpr */) { + else if (cond._typ == 287 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*cond._v__ast__PrefixExpr).op)); bool _t3 = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__PrefixExpr).right, pkg_exist); return _t3; } - else if (cond._typ == 284 /* v.ast.PostfixExpr */) { - _option_string _t4 = v__gen__c__Gen_comptime_if_to_ifdef(g, (/* as */ *(v__ast__Ident*)__as_cast(((*cond._v__ast__PostfixExpr).expr)._v__ast__Ident,((*cond._v__ast__PostfixExpr).expr)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).name, true); + else if (cond._typ == 286 /* v.ast.PostfixExpr */) { + _option_string _t4 = v__gen__c__Gen_comptime_if_to_ifdef(g, (/* as */ *(v__ast__Ident*)__as_cast(((*cond._v__ast__PostfixExpr).expr)._v__ast__Ident,((*cond._v__ast__PostfixExpr).expr)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).name, true); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; v__gen__c__verror(IError_name_table[err._typ]._method_msg(err._object)); @@ -76700,7 +74705,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ bool _t6 = true; return _t6; } - else if (cond._typ == 272 /* v.ast.InfixExpr */) { + else if (cond._typ == 274 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__logical_or)) { bool l = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__InfixExpr).left, pkg_exist); @@ -76712,7 +74717,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__key_is) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__not_is)) { v__ast__Expr left = (*cond._v__ast__InfixExpr).left; string name = _SLIT(""); - if ((left)._typ == 294 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 261 /* v.ast.ComptimeType */) { + if ((left)._typ == 296 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 263 /* v.ast.ComptimeType */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_is_comptime_type(g->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -76734,10 +74739,10 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ } } v__ast__Type exp_type = ((v__ast__Type)(0)); - v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 294) /*expected idx: 294, name: v.ast.TypeNode */ ).typ; - if ((left)._typ == 294 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 294 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { + v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 296) /*expected idx: 296, name: v.ast.TypeNode */ ).typ; + if ((left)._typ == 296 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 296 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { v__ast__TypeSymbol* interface_sym = v__ast__Table_sym(g->table, got_type); - if ((interface_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((interface_sym->info)._typ == 438 /* v.ast.Interface */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_does_type_implement_interface(g->table, checked_type, got_type); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -76758,14 +74763,14 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ return _t11; } } - } else if ((left)._typ == 288 /* v.ast.SelectorExpr */) { + } else if ((left)._typ == 290 /* v.ast.SelectorExpr */) { if ((*left._v__ast__SelectorExpr).gkind_field == v__ast__GenericKindField__typ) { exp_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__SelectorExpr).name_type); } else { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*left._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*left._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); exp_type = (*(v__ast__Type*)map_get(ADDR(map, g->comptime_var_type_map), &(string[]){name}, &(v__ast__Type[]){ 0 })); } - } else if ((left)._typ == 294 /* v.ast.TypeNode */) { + } else if ((left)._typ == 296 /* v.ast.TypeNode */) { exp_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); } if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -76788,7 +74793,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ return _t15; }; } - else if (cond._typ == 268 /* v.ast.Ident */) { + else if (cond._typ == 270 /* v.ast.Ident */) { _option_string _t16 = v__gen__c__Gen_comptime_if_to_ifdef(g, (*cond._v__ast__Ident).name, false); if (_t16.state != 0) { /*or block*/ IError err = _t16.err; @@ -76800,7 +74805,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ bool _t17 = true; return _t17; } - else if (cond._typ == 259 /* v.ast.ComptimeCall */) { + else if (cond._typ == 261 /* v.ast.ComptimeCall */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &bool*/0xfe10, {.d_s = pkg_exist ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))); bool _t18 = true; return _t18; @@ -76923,7 +74928,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_for(v__gen__c__Gen* g, v__ast__Comp } } else if (node.kind == v__ast__ComptimeForKind__fields) { if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (sym_info.fields.len > 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tFieldData "), /*115 &string*/0xfe10, {.d_s = node.val_var}}, {_SLIT(" = {0};"), 0, { .d_c = 0 }}}))); } @@ -76956,7 +74961,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_for(v__gen__c__Gen* g, v__ast__Comp map_delete(&g->comptime_var_type_map, &(string[]){node.val_var}); } } else if (node.kind == v__ast__ComptimeForKind__attributes) { - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).attrs.len > 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tStructAttribute "), /*115 &string*/0xfe10, {.d_s = node.val_var}}, {_SLIT(" = {0};"), 0, { .d_c = 0 }}}))); } @@ -77243,7 +75248,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr(v__gen__c__Gen* g, v__ast__DumpExp } VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { - Map_string_bool dump_typedefs = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_bool dump_typedefs = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; strings__Builder dump_fns = strings__new_builder(100); strings__Builder dump_fn_defs = strings__new_builder(100); Map_int_string _t1 = g->table->dumps; @@ -77268,7 +75274,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { string ptr_asterisk = (is_ptr ? (_SLIT("*")) : (_SLIT(""))); string str_dumparg_type = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = ptr_asterisk}}, {_SLIT0, 0, { .d_c = 0 }}})); if (dump_sym->kind == v__ast__Kind__function) { - v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; str_dumparg_type = str_intp(2, _MOV((StrIntpData[]){{_SLIT("DumpFNType_"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, 0, { .d_c = 0 }}})); int tdef_pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &fninfo, str_dumparg_type); @@ -77860,7 +75866,7 @@ int ctmp; deref = _SLIT("*"); } } - v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 326) /*expected idx: 326, name: v.ast.Var */ ; + v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 328) /*expected idx: 328, name: v.ast.Var */ ; if (v__ast__Table_sym(g->table, info.typ)->kind != v__ast__Kind__function) { v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(var.name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } @@ -77911,7 +75917,7 @@ int ctmp; } else { g->defer_stmts = __new_array_with_default(0, 0, sizeof(v__ast__DeferStmt), 0); } - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && node->stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 319 /* v.ast.Return */ && !Array_v__ast__Attr_contains(node->attrs, _SLIT("_naked"))) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && node->stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 321 /* v.ast.Return */ && !Array_v__ast__Attr_contains(node->attrs, _SLIT("_naked"))) { string default_expr = v__gen__c__Gen_type_default(g, node->return_type); if (string__eq(default_expr, _SLIT("{0}"))) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = default_expr}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -78087,7 +76093,7 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen v__ast__TypeSymbol* arg_type_sym = v__ast__Table_sym(g->table, typ); string arg_type_name = v__gen__c__Gen_typ(g, typ); if (arg_type_sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ; v__ast__Fn func = info.func; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); strings__Builder_write_string(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); @@ -78153,13 +76159,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_anon_fn_type_name(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_call_expr(v__gen__c__Gen* g, v__ast__CallExpr node) { bool v__gen__c__Gen_call_expr_defer_0 = false; - if ((node.left)._typ == 246 /* v.ast.AnonFn */) { + if ((node.left)._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_expr(g, node.left); - } else if ((node.left)._typ == 271 /* v.ast.IndexExpr */ && (node.name).len == 0) { + } else if ((node.left)._typ == 273 /* v.ast.IndexExpr */ && (node.name).len == 0) { g->is_fn_index_call = true; v__gen__c__Gen_expr(g, node.left); g->is_fn_index_call = false; - } else if ((node.left)._typ == 254 /* v.ast.CallExpr */ && (node.name).len == 0) { + } else if ((node.left)._typ == 256 /* v.ast.CallExpr */ && (node.name).len == 0) { v__gen__c__Gen_expr(g, node.left); } if (node.should_be_skipped) { @@ -78189,7 +76195,7 @@ bool v__gen__c__Gen_call_expr_defer_0 = false; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp_opt}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); } if (node.is_method && !node.is_field) { - if (string__eq(node.name, _SLIT("writeln")) && g->pref->experimental && node.args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ == 291 /* v.ast.StringInterLiteral */ && string__eq(v__ast__Table_sym(g->table, node.receiver_type)->name, _SLIT("strings.Builder"))) { + if (string__eq(node.name, _SLIT("writeln")) && g->pref->experimental && node.args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ == 293 /* v.ast.StringInterLiteral */ && string__eq(v__ast__Table_sym(g->table, node.receiver_type)->name, _SLIT("strings.Builder"))) { v__gen__c__Gen_string_inter_literal_sb_optimized(g, node); } else { v__gen__c__Gen_method_call(g, node); @@ -78258,7 +76264,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, node.receiver_type); } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.receiver_type); - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*sym->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -78277,7 +76283,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 436 /* v.ast.Interface */) { + else if (sym->info._typ == 438 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*sym->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -78296,7 +76302,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 437 /* v.ast.SumType */) { + else if (sym->info._typ == 439 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*sym->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -78322,12 +76328,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); if (typ_sym->kind == v__ast__Kind__alias && !string__eq(node.name, _SLIT("str")) && !v__ast__TypeSymbol_has_method(typ_sym, node.name)) { - unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); } string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ )), node.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), node.name)) { #if defined(CUSTOM_DEFINE_debug_interface_method_call) { eprintln( str_intp(4, _MOV((StrIntpData[]){{_SLIT(">>> interface typ_sym.name: "), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT(" | receiver_type_name: "), /*115 &string*/0xfe10, {.d_s = receiver_type_name}}, {_SLIT(" | pos: "), /*115 &v.token.Pos*/0xfe10, {.d_s = v__token__Pos_str(node.pos)}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -78412,7 +76418,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE }; } if (left_sym->kind == v__ast__Kind__map && string__eq(node.name, _SLIT("delete"))) { - v__ast__Map left_info = /* as */ *(v__ast__Map*)__as_cast((left_sym->info)._v__ast__Map,(left_sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map left_info = /* as */ *(v__ast__Map*)__as_cast((left_sym->info)._v__ast__Map,(left_sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.key_type); v__gen__c__Gen_write(g, _SLIT("map_delete(")); if (v__ast__Type_is_ptr(node.left_type)) { @@ -78465,9 +76471,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (v__ast__Type_has_flag(rec_type, v__ast__TypeFlag__shared_f)) { rec_type = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(rec_type, v__ast__TypeFlag__shared_f), 0); } - if ((node.left)._typ == 260 /* v.ast.ComptimeSelector */) { - if (((*node.left._v__ast__ComptimeSelector).field_expr)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 268 /* v.ast.Ident */) { + if ((node.left)._typ == 262 /* v.ast.ComptimeSelector */) { + if (((*node.left._v__ast__ComptimeSelector).field_expr)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 270 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t11 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t10 = {0}; @@ -78487,7 +76493,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE return; } } - } else if ((node.left)._typ == 259 /* v.ast.ComptimeCall */) { + } else if ((node.left)._typ == 261 /* v.ast.ComptimeCall */) { if (string__eq((*node.left._v__ast__ComptimeCall).method_name, _SLIT("method"))) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*node.left._v__ast__ComptimeCall).left_type)); _option_v__ast__Fn _t12; @@ -78498,8 +76504,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE return; } } - } else if ((node.left)._typ == 268 /* v.ast.Ident */) { - if (((*node.left._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + } else if ((node.left)._typ == 270 /* v.ast.Ident */) { + if (((*node.left._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if (g->comptime_var_type_map.len > 0) { rec_type = (*(*node.left._v__ast__Ident).obj._v__ast__Var).typ; v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -78507,7 +76513,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } else if ((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { rec_type = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, rec_type); - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { rec_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -78528,7 +76534,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE receiver_type_name = _SLIT("map"); } if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { - if (!((left_sym->info)._typ == 433 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { + if (!((left_sym->info)._typ == 435 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } if (string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("pop"))) { @@ -78543,12 +76549,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__array) { bool needs_depth = (string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("repeat"))); if (needs_depth) { - v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ).elem_type; array_depth = v__gen__c__Gen_get_array_depth(g, elem_type); } bool maybe_noscan = needs_depth || (string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("push")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("grow_cap")) || string__eq(node.name, _SLIT("grow_len"))); if (maybe_noscan) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); } } else if (left_sym->kind == v__ast__Kind__chan) { @@ -78585,9 +76591,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } bool is_range_slice = false; if (v__ast__Type_is_ptr(node.receiver_type) && !v__ast__Type_is_ptr(node.left_type)) { - if ((node.left)._typ == 271 /* v.ast.IndexExpr */) { + if ((node.left)._typ == 273 /* v.ast.IndexExpr */) { v__ast__Expr idx = (*node.left._v__ast__IndexExpr).index; - if ((idx)._typ == 286 /* v.ast.RangeExpr */) { + if ((idx)._typ == 288 /* v.ast.RangeExpr */) { name = v__util__no_dots( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = receiver_type_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("_static"), 0, { .d_c = 0 }}}))); is_range_slice = true; } @@ -78638,7 +76644,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__array && v__ast__Expr_is_auto_deref_var(node.left) && (string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("repeat")))) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((node.left)._typ == 277 /* v.ast.MapInit */) { + if ((node.left)._typ == 279 /* v.ast.MapInit */) { v__gen__c__Gen_write(g, _SLIT("(map[]){")); v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT("}[0]")); @@ -78707,8 +76713,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__ast__CallExpr node_ = node; for (int i = 0; i < node_.args.len; ++i) { v__ast__CallArg* call_arg = ((v__ast__CallArg*)node_.args.data) + i; - if ((call_arg->expr)._typ == 268 /* v.ast.Ident */) { - if (((*call_arg->expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((call_arg->expr)._typ == 270 /* v.ast.Ident */) { + if (((*call_arg->expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { (*(v__ast__CallArg*)/*ee elem_sym */array_get(node_.args, i)).typ = (*(*call_arg->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -78747,7 +76753,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = tmp2}}, {_SLIT(" = json__json_print_pretty("), /*115 &string*/0xfe10, {.d_s = json_obj}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } else { - v__ast__TypeNode ast_type = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__TypeNode,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 294) /*expected idx: 294, name: v.ast.TypeNode */ ; + v__ast__TypeNode ast_type = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__TypeNode,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 296) /*expected idx: 296, name: v.ast.TypeNode */ ; string typ = v__gen__c__c_name(v__gen__c__Gen_typ(g, ast_type.typ)); string fn_name = string__plus(string__plus(v__gen__c__c_name(name), _SLIT("_")), typ); v__gen__c__Gen_gen_json_for_type(g, ast_type.typ); @@ -78823,7 +76829,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if (!v__ast__Type_alias_eq(typ, _const_v__ast__string_type) || g->comptime_for_method.len > 0) { v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, typ); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ )), _SLIT("str"))) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), _SLIT("str"))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -78842,9 +76848,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("; "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("); string_free(&"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); - if ((expr)._typ == 260 /* v.ast.ComptimeSelector */) { - if (((*expr._v__ast__ComptimeSelector).field_expr)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 262 /* v.ast.ComptimeSelector */) { + if (((*expr._v__ast__ComptimeSelector).field_expr)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 270 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t7 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t6 = {0}; @@ -78862,7 +76868,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr typ = *(v__ast__Type*)_t6.data; } } - } else if ((expr)._typ == 259 /* v.ast.ComptimeCall */) { + } else if ((expr)._typ == 261 /* v.ast.ComptimeCall */) { if (string__eq((*expr._v__ast__ComptimeCall).method_name, _SLIT("method"))) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*expr._v__ast__ComptimeCall).left_type)); _option_v__ast__Fn _t8; @@ -78871,13 +76877,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr typ = m.return_type; } } - } else if ((expr)._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + } else if ((expr)._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { typ = (*(*expr._v__ast__Ident).obj._v__ast__Var).typ; if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, typ); - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -78891,11 +76897,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_39765 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39765.arg0; - string pafile = mr_39765.arg1; - string pamod = mr_39765.arg2; - string pafn = mr_39765.arg3; + multi_return_int_string_string_string mr_39776 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39776.arg0; + string pafile = mr_39776.arg1; + string pamod = mr_39776.arg2; + string pafn = mr_39776.arg3; 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(")")); @@ -78904,7 +76910,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr _option_v__ast__ScopeObject _t9; if (_t9 = v__ast__Scope_find(node.scope, node.name), _t9.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t9.data; - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { if ((*obj._v__ast__Var).smartcasts.len > 0) { for (int _t10 = 0; _t10 < (*obj._v__ast__Var).smartcasts.len; ++_t10) { v__gen__c__Gen_write(g, _SLIT("(*")); @@ -78920,7 +76926,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } } string dot = (is_ptr ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -78992,7 +76998,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a if (!arg.is_tmp_autofree) { continue; } - if ((arg.expr)._typ == 254 /* v.ast.CallExpr */) { + if ((arg.expr)._typ == 256 /* v.ast.CallExpr */) { v__gen__c__Gen_autofree_call_pregen(g, (*arg.expr._v__ast__CallExpr)); } free_tmp_arg_vars = true; @@ -79004,7 +77010,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a _option_v__ast__ScopeObject _t2; if (_t2 = v__ast__Scope_find(scope, t), _t2.state == 0) { v__ast__ScopeObject x = *(v__ast__ScopeObject*)_t2.data; - if (x._typ == 326 /* v.ast.Var */) { + if (x._typ == 328 /* v.ast.Var */) { (*x._v__ast__Var).is_used = false; } @@ -79039,7 +77045,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_postgen(v__gen__c__Gen* g, int } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject* obj = &(*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj->_typ == 326 /* v.ast.Var */) { + if (obj->_typ == 328 /* v.ast.Var */) { bool is_optional = v__ast__Type_has_flag((*obj->_v__ast__Var).typ, v__ast__TypeFlag__optional); if (is_optional) { continue; @@ -79156,7 +77162,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp v__ast__Type varg_type = (*(v__ast__Type*)array_last(expected_types)); int variadic_count = args.len - arg_nr; v__ast__TypeSymbol* arr_sym = v__ast__Table_sym(g->table, varg_type); - v__ast__Array arr_info = /* as */ *(v__ast__Array*)__as_cast((arr_sym->info)._v__ast__Array,(arr_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array arr_info = /* as */ *(v__ast__Array*)__as_cast((arr_sym->info)._v__ast__Array,(arr_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; if (v__ast__Type_has_flag(varg_type, v__ast__TypeFlag__generic)) { if (node.is_method) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); @@ -79194,7 +77200,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp string elem_type = v__gen__c__Gen_typ(g, arr_info.elem_type); if ((g->pref->translated || g->file->is_translated) && args.len == 1) { v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, 0)).expr); - } else if (args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr)._typ == 247 /* v.ast.ArrayDecompose */) { + } else if (args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr)._typ == 249 /* v.ast.ArrayDecompose */) { v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr); } else { if (variadic_count > 0) { @@ -79232,7 +77238,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__TypeSymbol* receiver_sym = v__ast__Table_sym(g->table, expr.receiver_type); name = string__plus(string__plus(receiver_sym->name, _SLIT("_")), name); - } else if ((expr.left)._typ == 246 /* v.ast.AnonFn */) { + } else if ((expr.left)._typ == 248 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr.left._v__ast__AnonFn)); name = (*expr.left._v__ast__AnonFn).decl.name; } else if (expr.is_fn_var) { @@ -79411,7 +77417,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__Type unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, expr.receiver_type); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ )), expr.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), expr.name)) { string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(receiver_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -79527,7 +77533,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v if (arg.is_mut) { v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(g->table, arg_typ); if (exp_sym->kind == v__ast__Kind__array) { - if (((arg.expr)._typ == 268 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((arg.expr)._v__ast__Ident,(arg.expr)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ).kind == v__ast__IdentKind__variable) || (arg.expr)._typ == 288 /* v.ast.SelectorExpr */) { + if (((arg.expr)._typ == 270 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((arg.expr)._v__ast__Ident,(arg.expr)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ).kind == v__ast__IdentKind__variable) || (arg.expr)._typ == 290 /* v.ast.SelectorExpr */) { v__gen__c__Gen_write(g, _SLIT("&/*arr*/")); v__gen__c__Gen_expr(g, arg.expr); } else { @@ -79536,11 +77542,11 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v v__gen__c__Gen_write(g, _SLIT("}[0]")); } return; - } else if (arg_sym->kind == v__ast__Kind__sum_type && exp_sym->kind == v__ast__Kind__sum_type && ((arg.expr)._typ == 268 /* v.ast.Ident */ || (arg.expr)._typ == 288 /* v.ast.SelectorExpr */)) { + } else if (arg_sym->kind == v__ast__Kind__sum_type && exp_sym->kind == v__ast__Kind__sum_type && ((arg.expr)._typ == 270 /* v.ast.Ident */ || (arg.expr)._typ == 290 /* v.ast.SelectorExpr */)) { v__gen__c__Gen_write(g, _SLIT("&/*sum*/")); v__gen__c__Gen_expr(g, arg.expr); return; - } else if (arg_sym->kind == v__ast__Kind__interface_ && exp_sym->kind == v__ast__Kind__interface_ && ((arg.expr)._typ == 268 /* v.ast.Ident */ || (arg.expr)._typ == 288 /* v.ast.SelectorExpr */)) { + } else if (arg_sym->kind == v__ast__Kind__interface_ && exp_sym->kind == v__ast__Kind__interface_ && ((arg.expr)._typ == 270 /* v.ast.Ident */ || (arg.expr)._typ == 290 /* v.ast.SelectorExpr */)) { v__gen__c__Gen_write(g, _SLIT("&/*iface*/")); v__gen__c__Gen_expr(g, arg.expr); return; @@ -79577,7 +77583,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v v__gen__c__Gen_expr(g, arg.expr); v__gen__c__Gen_write(g, _SLIT("->val")); return; - } else if ((arg.expr)._typ == 248 /* v.ast.ArrayInit */) { + } else if ((arg.expr)._typ == 250 /* v.ast.ArrayInit */) { if ((*arg.expr._v__ast__ArrayInit).is_fixed) { if (!(*arg.expr._v__ast__ArrayInit).has_it) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*arg.expr._v__ast__ArrayInit).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -79819,7 +77825,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn string styp = v__gen__c__Gen_typ(g, node.val_type); v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); string cond_var = _SLIT(""); - if ((node.cond)._typ == 268 /* v.ast.Ident */ || (node.cond)._typ == 288 /* v.ast.SelectorExpr */) { + if ((node.cond)._typ == 270 /* v.ast.Ident */ || (node.cond)._typ == 290 /* v.ast.SelectorExpr */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { cond_var = v__gen__c__Gen_new_tmp_var(g); @@ -79837,7 +77843,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT(" = ((voidptr*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("];"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { string right = str_intp(5, _MOV((StrIntpData[]){{_SLIT("(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("]"), 0, { .d_c = 0 }}})); @@ -79851,7 +77857,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } else if (node.kind == v__ast__Kind__array_fixed) { string cond_var = _SLIT(""); bool cond_type_is_ptr = v__ast__Type_is_ptr(node.cond_type); - bool cond_is_literal = (node.cond)._typ == 248 /* v.ast.ArrayInit */; + bool cond_is_literal = (node.cond)._typ == 250 /* v.ast.ArrayInit */; if (cond_is_literal) { cond_var = v__gen__c__Gen_new_tmp_var(g); v__gen__c__Gen_write(g, v__gen__c__Gen_typ(g, node.cond_type)); @@ -79873,14 +77879,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } string idx = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__ast__TypeSymbol* cond_sym = v__ast__Table_sym(g->table, node.cond_type); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" != "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("; ++"), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); bool is_fixed_array = val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut; if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); } else if (is_fixed_array) { string styp = v__gen__c__Gen_typ(g, node.val_type); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(node.val_var)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -79904,7 +77910,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } } else if (node.kind == v__ast__Kind__map) { string cond_var = _SLIT(""); - if ((node.cond)._typ == 268 /* v.ast.Ident */) { + if ((node.cond)._typ == 270 /* v.ast.Ident */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { cond_var = v__gen__c__Gen_new_tmp_var(g); @@ -79942,7 +77948,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); if (val_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 445) /*expected idx: 445, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 447) /*expected idx: 447, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_write(g, _SLIT(" = (*(voidptr*)")); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("DenseArray_value(&"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arw_or_pt}}, {_SLIT("key_values, "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { @@ -79965,7 +77971,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } g->indent--; } else if (node.kind == v__ast__Kind__string) { - v__ast__Expr cond = ((node.cond)._typ == 292 /* v.ast.StringLiteral */ || (node.cond)._typ == 291 /* v.ast.StringInterLiteral */ ? (v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, node.cond, _const_v__ast__string_type))))) : (node.cond)); + v__ast__Expr cond = ((node.cond)._typ == 294 /* v.ast.StringLiteral */ || (node.cond)._typ == 293 /* v.ast.StringInterLiteral */ ? (v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, node.cond, _const_v__ast__string_type))))) : (node.cond)); string field_accessor = (v__ast__Type_is_ptr(node.cond_type) ? (_SLIT("->")) : (_SLIT("."))); string i = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT(" < "), 0, { .d_c = 0 }}}))); @@ -80002,7 +78008,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn string receiver_styp = v__gen__c__Gen_typ(g, receiver_typ); string fn_name = string__plus(string_replace_each(receiver_styp, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("*"), _SLIT(""), _SLIT("."), _SLIT("__")}))), _SLIT("_next")); v__ast__TypeSymbol* receiver_sym = v__ast__Table_sym(g->table, receiver_typ); - if ((receiver_sym->info)._typ == 418 /* v.ast.Struct */) { + if ((receiver_sym->info)._typ == 420 /* v.ast.Struct */) { if ((*receiver_sym->info._v__ast__Struct).concrete_types.len > 0) { fn_name = v__gen__c__Gen_generic_fn_name(g, (*receiver_sym->info._v__ast__Struct).concrete_types, fn_name, false); } @@ -80046,22 +78052,22 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_if(v__gen__c__Gen* g, v__ast } for (int _t2 = 0; _t2 < node.branches.len; ++_t2) { v__ast__IfBranch branch = ((v__ast__IfBranch*)node.branches.data)[_t2]; - if ((branch.cond)._typ == 270 /* v.ast.IfGuardExpr */ || branch.stmts.len > 1) { + if ((branch.cond)._typ == 272 /* v.ast.IfGuardExpr */ || branch.stmts.len > 1) { bool _t3 = true; return _t3; } if (branch.stmts.len == 1) { - if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 308 /* v.ast.ExprStmt */) { - v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ; + if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 310 /* v.ast.ExprStmt */) { + v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ; if (v__gen__c__is_noreturn_callexpr(stmt.expr)) { bool _t4 = true; return _t4; } - if ((stmt.expr)._typ == 278 /* v.ast.MatchExpr */) { + if ((stmt.expr)._typ == 280 /* v.ast.MatchExpr */) { bool _t5 = true; return _t5; } - if ((stmt.expr)._typ == 254 /* v.ast.CallExpr */) { + if ((stmt.expr)._typ == 256 /* v.ast.CallExpr */) { if ((*stmt.expr._v__ast__CallExpr).is_method) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, (*stmt.expr._v__ast__CallExpr).receiver_type); if (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map) { @@ -80133,13 +78139,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no for (int i = 0; i < node.branches.len; ++i) { v__ast__IfBranch branch = ((v__ast__IfBranch*)node.branches.data)[i]; v__ast__Expr cond = branch.cond; - if ((cond)._typ == 270 /* v.ast.IfGuardExpr */) { + if ((cond)._typ == 272 /* v.ast.IfGuardExpr */) { if (!is_guard) { is_guard = true; guard_idx = i; guard_vars = __new_array_with_default(node.branches.len, 0, sizeof(string), &(string[]){_SLIT("")}); } - if (((*cond._v__ast__IfGuardExpr).expr)._typ != 271 /* v.ast.IndexExpr */ && ((*cond._v__ast__IfGuardExpr).expr)._typ != 285 /* v.ast.PrefixExpr */) { + if (((*cond._v__ast__IfGuardExpr).expr)._typ != 273 /* v.ast.IndexExpr */ && ((*cond._v__ast__IfGuardExpr).expr)._typ != 287 /* v.ast.PrefixExpr */) { string var_name = v__gen__c__Gen_new_tmp_var(g); array_set(&guard_vars, i, &(string[]) { var_name }); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*cond._v__ast__IfGuardExpr).expr_type)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -80159,7 +78165,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string cvar_name = (*(string*)/*ee elem_sym */array_get(guard_vars, guard_idx)); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tIError err = "), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err;"), 0, { .d_c = 0 }}}))); } - } else if ((branch.cond)._typ == 270 /* v.ast.IfGuardExpr */) { + } else if ((branch.cond)._typ == 272 /* v.ast.IfGuardExpr */) { string var_name = (*(string*)/*ee elem_sym */array_get(guard_vars, i)); bool short_opt = false; if ((var_name).len == 0) { @@ -80167,11 +78173,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no var_name = v__gen__c__Gen_new_tmp_var(g); array_set(&guard_vars, i, &(string[]) { var_name }); g->tmp_count--; - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + } else if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if (!"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".is_error) {"), 0, { .d_c = 0 }}}))); + } } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*branch.cond._v__ast__IfGuardExpr).expr); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + } else if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", !"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".is_error) {"), 0, { .d_c = 0 }}}))); + } } if (short_opt || !string__eq((*(v__ast__IfGuardVar*)/*ee elem_sym */array_get((*branch.cond._v__ast__IfGuardExpr).vars, 0)).name, _SLIT("_"))) { string base_type = v__gen__c__Gen_base_type(g, (*branch.cond._v__ast__IfGuardExpr).expr_type); @@ -80203,7 +78217,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string left_var_name = v__gen__c__c_name(var.name); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 444) /*expected idx: 444, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 446) /*expected idx: 446, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*branch.cond._v__ast__IfGuardExpr).vars.len) { string var_typ = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(mr_info.types, vi))); if (is_auto_heap) { @@ -80219,8 +78233,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no } } else { bool no_needs_par = false; - if ((branch.cond)._typ == 272 /* v.ast.InfixExpr */) { - if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_in && ((*branch.cond._v__ast__InfixExpr).left)._typ != 272 /* v.ast.InfixExpr */ && ((*branch.cond._v__ast__InfixExpr).right)._typ == 248 /* v.ast.ArrayInit */) { + if ((branch.cond)._typ == 274 /* v.ast.InfixExpr */) { + if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_in && ((*branch.cond._v__ast__InfixExpr).left)._typ != 274 /* v.ast.InfixExpr */ && ((*branch.cond._v__ast__InfixExpr).right)._typ == 250 /* v.ast.ArrayInit */) { no_needs_par = true; } } @@ -80267,7 +78281,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_expr(v__gen__c__Gen* g, v__ast__IndexExpr node) { - if ((node.index)._typ == 286 /* v.ast.RangeExpr */) { + if ((node.index)._typ == 288 /* v.ast.RangeExpr */) { v__gen__c__Gen_range_expr(g, node, (*node.index._v__ast__RangeExpr)); } else { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.left_type)); @@ -80364,7 +78378,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE v__gen__c__Gen_write(g, tmp_left); } } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; string noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); if (node.is_gated) { v__gen__c__Gen_write(g, _SLIT("array_slice_ni(")); @@ -80392,7 +78406,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE if (range.has_high) { v__gen__c__Gen_expr(g, range.high); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__array) { if (v__ast__Type_is_ptr(node.left_type)) { @@ -80418,7 +78432,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, info.elem_type))); @@ -80492,7 +78506,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In v__gen__c__Gen_write(g, _SLIT("/*2*/string_clone(")); } if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")(*("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_sym */array_get("), 0, { .d_c = 0 }}}))); @@ -80556,10 +78570,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 445 /* v.ast.FnType */; + bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 447 /* v.ast.FnType */; if (is_fn_index_call) { v__gen__c__Gen_write(g, _SLIT("(*")); } @@ -80572,7 +78586,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__a } v__gen__c__Gen_write(g, _SLIT("[")); bool direct = g->fn_decl != 0 && g->fn_decl->is_direct_arr; - if ((direct || (node.index)._typ == 273 /* v.ast.IntegerLiteral */) || g->pref->translated) { + if ((direct || (node.index)._typ == 275 /* v.ast.IntegerLiteral */) || g->pref->translated) { v__gen__c__Gen_expr(g, node.index); } else { v__gen__c__Gen_write(g, _SLIT("v_fixed_index(")); @@ -80588,7 +78602,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__a VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; string key_type_str = v__gen__c__Gen_typ(g, info.key_type); v__ast__Type elem_type = info.value_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); @@ -80608,7 +78622,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde if (!left_is_ptr || v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f)) { v__gen__c__Gen_write(g, _SLIT("&")); } - if ((node.left)._typ == 271 /* v.ast.IndexExpr */) { + if ((node.left)._typ == 273 /* v.ast.IndexExpr */) { g->inside_map_index = true; v__gen__c__Gen_expr(g, node.left); g->inside_map_index = false; @@ -80668,7 +78682,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = tmp_opt_ptr}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_ptr_typ */(map_get_check("), 0, { .d_c = 0 }}}))); } else { if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 445 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 447 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, _SLIT(")(*(voidptr*)map_get(")); @@ -80893,7 +78907,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr(v__gen__c__Gen* g, v__ast__InfixE VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arrow_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); string styp = left.sym->cname; - v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 442) /*expected idx: 442, name: v.ast.Chan */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 444) /*expected idx: 444, name: v.ast.Chan */ ).elem_type; bool gen_or = node.or_block.kind != v__ast__OrKind__absent; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { @@ -80920,10 +78934,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_defined_eq_operator = v__ast__Table_has_method(g->table, left.sym, _SLIT("==")); - bool has_alias_eq_op_overload = (left.sym->info)._typ == 433 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + bool has_alias_eq_op_overload = (left.sym->info)._typ == 435 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); if ((v__ast__Type_is_ptr(left.typ) && v__ast__Type_is_int(right.typ)) || (v__ast__Type_is_ptr(right.typ) && v__ast__Type_is_int(left.typ))) { v__gen__c__Gen_gen_plain_infix_expr(g, node); - } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 292 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 292) /*expected idx: 292, name: v.ast.StringLiteral */ ).val).len == 0) { + } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 294 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 294) /*expected idx: 294, name: v.ast.StringLiteral */ ).val).len == 0) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT(")")); @@ -81005,7 +79019,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ if (v__ast__Type_is_ptr(left.typ)) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((node.left)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.left)._typ == 250 /* v.ast.ArrayInit */) { if (!(*node.left._v__ast__ArrayInit).has_it) { string s = v__gen__c__Gen_typ(g, left.unaliased); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -81013,7 +79027,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ } v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT(", ")); - if ((node.right)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 250 /* v.ast.ArrayInit */) { if (!(*node.right._v__ast__ArrayInit).has_it) { string s = v__gen__c__Gen_typ(g, right.unaliased); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -81157,11 +79171,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_cmp_op(v__gen__c__Gen* g, v__ast_ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_operator_overloading = v__ast__Table_has_method(g->table, left.sym, _SLIT("<")); - if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).generic_types.len > 0) { + if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { if (node.op == v__token__Kind__le || node.op == v__token__Kind__ge) { v__gen__c__Gen_write(g, _SLIT("!")); } - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).concrete_types; + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(left.sym->cname, _SLIT("__lt")); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, method_name); @@ -81238,7 +79252,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } if (right.unaliased_sym->kind == v__ast__Kind__array) { if (left.sym->kind == v__ast__Kind__sum_type || left.sym->kind == v__ast__Kind__interface_) { - if ((node.right)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 250 /* v.ast.ArrayInit */) { if ((*node.right._v__ast__ArrayInit).exprs.len > 0 && !(v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, 0)))->kind == v__ast__Kind__sum_type || v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, 0)))->kind == v__ast__Kind__interface_)) { 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) { @@ -81251,7 +79265,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } } } - if ((node.right)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 250 /* v.ast.ArrayInit */) { v__ast__Type elem_type = (*node.right._v__ast__ArrayInit).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { @@ -81268,7 +79282,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 413 /* v.ast.Array */) { + if ((right.sym->info)._typ == 415 /* v.ast.Array */) { v__ast__Type elem_type = (*right.sym->info._v__ast__Array).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) { @@ -81304,7 +79318,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_write(g, _SLIT(")")); } else if (right.unaliased_sym->kind == v__ast__Kind__array_fixed) { if (left.sym->kind == v__ast__Kind__sum_type || left.sym->kind == v__ast__Kind__interface_) { - if ((node.right)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 250 /* v.ast.ArrayInit */) { 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) { @@ -81317,7 +79331,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } } } - if ((node.right)._typ == 248 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 250 /* v.ast.ArrayInit */) { if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_optimization(g, node.left, (*node.right._v__ast__ArrayInit)); @@ -81325,7 +79339,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 441 /* v.ast.ArrayFixed */) { + if ((right.sym->info)._typ == 443 /* 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) { @@ -81390,7 +79404,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); bool is_aggregate = left_sym->kind == v__ast__Kind__aggregate; if (is_aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 431) /*expected idx: 431, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(g->table, parent_left_type); } v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); @@ -81414,10 +79428,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ if (left_sym->kind == v__ast__Kind__interface_) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_typ "), /*115 &string*/0xfe10, {.d_s = cmp_op}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); v__ast__Type _t1 = 0; - if (node.right._typ == 294 /* v.ast.TypeNode */) { + if (node.right._typ == 296 /* v.ast.TypeNode */) { _t1 = v__gen__c__Gen_unwrap_generic(g, (*node.right._v__ast__TypeNode).typ); } - else if (node.right._typ == 280 /* v.ast.None */) { + else if (node.right._typ == 282 /* v.ast.None */) { _t1 = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){_SLIT("None__")}, &(int[]){ 0 })); } @@ -81437,7 +79451,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; Array_v__ast__Type* _t2 = (Array_v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, info.conversions), &(int[]){node.right_type})); _option_Array_v__ast__Type _t1 = {0}; if (_t2) { @@ -81483,8 +79497,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arithmetic_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); - if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).generic_types.len > 0) { - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ).concrete_types; + if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).generic_types.len > 0) { + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(string__plus(left.sym->cname, _SLIT("_")), v__util__replace_op(v__token__Kind_str(node.op))); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, method_name); @@ -81519,7 +79533,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); if (left.unaliased_sym->kind == v__ast__Kind__array) { string tmp_var = v__gen__c__Gen_new_tmp_var(g); - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left.unaliased_sym->info)._v__ast__Array,(left.unaliased_sym->info)._typ, 413) /*expected idx: 413, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left.unaliased_sym->info)._v__ast__Array,(left.unaliased_sym->info)._typ, 415) /*expected idx: 415, name: v.ast.Array */ ; string noscan = v__gen__c__Gen_check_noscan(g, array_info.elem_type); if (right.unaliased_sym->kind == v__ast__Kind__array && !v__ast__Type_alias_eq(array_info.elem_type, right.typ)) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_PUSH_MANY"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -81547,7 +79561,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, } else { string elem_type_str = v__gen__c__Gen_typ(g, array_info.elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, array_info.elem_type); - bool elem_is_array_var = (elem_sym->kind == v__ast__Kind__array || elem_sym->kind == v__ast__Kind__array_fixed) && (node.right)._typ == 268 /* v.ast.Ident */; + bool elem_is_array_var = (elem_sym->kind == v__ast__Kind__array || elem_sym->kind == v__ast__Kind__array_fixed) && (node.right)._typ == 270 /* v.ast.Ident */; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("array_push"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("((array*)"), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(left.typ) || (v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f) && !v__ast__Type_is_ptr(v__ast__Type_deref(node.left_type)))) { v__gen__c__Gen_write(g, _SLIT("&")); @@ -81584,37 +79598,37 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, } VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_array_call(v__gen__c__Gen* g, v__ast__Expr node) { - if (node._typ == 254 /* v.ast.CallExpr */) { + if (node._typ == 256 /* v.ast.CallExpr */) { if ((*node._v__ast__CallExpr).left_type != 0 && v__ast__Table_sym(g->table, (*node._v__ast__CallExpr).left_type)->kind == v__ast__Kind__array && (string__eq((*node._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("any")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("map")))) { bool _t1 = true; return _t1; } } - else if (node._typ == 271 /* v.ast.IndexExpr */) { + else if (node._typ == 273 /* v.ast.IndexExpr */) { bool _t2 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__IndexExpr).left); return _t2; } - else if (node._typ == 272 /* v.ast.InfixExpr */) { + else if (node._typ == 274 /* v.ast.InfixExpr */) { bool _t3 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__InfixExpr).left) || v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__InfixExpr).right); return _t3; } - else if (node._typ == 283 /* v.ast.ParExpr */) { + else if (node._typ == 285 /* v.ast.ParExpr */) { bool _t4 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__ParExpr).expr); return _t4; } - else if (node._typ == 284 /* v.ast.PostfixExpr */) { + else if (node._typ == 286 /* v.ast.PostfixExpr */) { bool _t5 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__PostfixExpr).expr); return _t5; } - else if (node._typ == 285 /* v.ast.PrefixExpr */) { + else if (node._typ == 287 /* v.ast.PrefixExpr */) { bool _t6 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__PrefixExpr).right); return _t6; } - else if (node._typ == 286 /* v.ast.RangeExpr */) { + else if (node._typ == 288 /* v.ast.RangeExpr */) { bool _t7 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__RangeExpr).low) || v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__RangeExpr).high); return _t7; } - else if (node._typ == 288 /* v.ast.SelectorExpr */) { + else if (node._typ == 290 /* v.ast.SelectorExpr */) { bool _t8 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__SelectorExpr).expr); return _t8; } @@ -81627,7 +79641,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_array_call(v__gen__c__Gen* g } VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_and_or_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { - if ((node.right)._typ == 269 /* v.ast.IfExpr */) { + if ((node.right)._typ == 271 /* v.ast.IfExpr */) { int prev_inside_ternary = g->inside_ternary; g->inside_ternary = 0; if (v__gen__c__Gen_need_tmp_var_in_if(g, (*node.right._v__ast__IfExpr))) { @@ -81737,7 +79751,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { string init_styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" res"), 0, { .d_c = 0 }}})); if (sym->kind == v__ast__Kind__struct_) { int skips = 0; - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; for (int _t2 = 0; _t2 < info.fields.len; ++_t2) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t2]; for (int _t3 = 0; _t3 < field.attrs.len; ++_t3) { @@ -81764,13 +79778,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, v__gen__c__Gen_decode_array(g, value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_array(g, value_type)); } else if (sym->kind == v__ast__Kind__map) { - v__ast__Map m = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 414) /*expected idx: 414, name: v.ast.Map */ ; + v__ast__Map m = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 416) /*expected idx: 416, name: v.ast.Map */ ; v__gen__c__Gen_gen_json_for_type(g, m.key_type); v__gen__c__Gen_gen_json_for_type(g, m.value_type); strings__Builder_writeln(&dec, v__gen__c__Gen_decode_map(g, m.key_type, m.value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_map(g, m.key_type, m.value_type)); } else if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; v__ast__Type parent_typ = a.parent_type; v__ast__TypeSymbol* psym = v__ast__Table_sym(g->table, parent_typ); if (v__gen__c__is_js_prim(v__gen__c__Gen_typ(g, parent_typ))) { @@ -81778,7 +79792,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { continue; } strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((psym->info)._typ == 418 /* v.ast.Struct */) { + if ((psym->info)._typ == 420 /* v.ast.Struct */) { v__gen__c__Gen_gen_struct_enc_dec(g, psym->info, styp, (voidptr)&/*qq*/enc, (voidptr)&/*qq*/dec); } else if (psym->kind == v__ast__Kind__sum_type) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" aliased sumtypes does not work at the moment"), 0, { .d_c = 0 }}}))); @@ -81789,14 +79803,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } } else if (sym->kind == v__ast__Kind__sum_type) { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 437 /* v.ast.SumType */) { + if ((sym->info)._typ != 439 /* v.ast.SumType */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not a sumtype"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } v__gen__c__Gen_gen_sumtype_enc_dec(g, *sym, (voidptr)&/*qq*/enc, (voidptr)&/*qq*/dec); } else { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 418 /* v.ast.Struct */) { + if ((sym->info)._typ != 420 /* v.ast.Struct */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not struct"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } @@ -81813,7 +79827,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g, v__ast__TypeSymbol sym, strings__Builder* enc, strings__Builder* dec) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ; string type_var = v__gen__c__Gen_new_tmp_var(g); int typ = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){sym.name}, &(int[]){ 0 })); #if !defined(CUSTOM_DEFINE_json_no_inline_sumtypes) @@ -81983,7 +79997,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, v__ast__TypeInfo type_info, string styp, strings__Builder* enc, strings__Builder* dec) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_info)._v__ast__Struct,(type_info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_info)._v__ast__Struct,(type_info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; string name = field.name; @@ -82025,33 +80039,81 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, if (v__gen__c__is_js_prim(field_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (field_sym->kind == v__ast__Kind__enum_) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (string__eq(field_sym->name, _SLIT("time.Time"))) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; string parent_type = v__gen__c__Gen_typ(g, alias.parent_type); string parent_dec_name = v__gen__c__js_dec_name(parent_type); if (v__gen__c__is_js_prim(parent_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else { v__gen__c__Gen_gen_json_for_type(g, field.typ); string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } } else { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } } string enc_name = v__gen__c__js_enc_name(field_type); @@ -82060,7 +80122,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } if (!v__gen__c__is_js_prim(field_type)) { if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ; + v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ; enc_name = v__gen__c__js_enc_name(v__gen__c__Gen_typ(g, ainfo.parent_type)); } } @@ -82077,7 +80139,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, strings__Builder* dec, bool is_required) { - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root,\""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root, \""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); if (is_required) { strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = 2, .err = _v_error(_SLIT(\"expected field \'"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\' is missing\")), .data = {0} };"), 0, { .d_c = 0 }}}))); @@ -82136,11 +80198,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, key_type); string styp_v = v__gen__c__Gen_typ(g, value_type); v__ast__TypeSymbol* key_type_symbol = v__ast__Table_sym(g->table, key_type); - multi_return_string_string_string_string mr_18986 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); - string hash_fn = mr_18986.arg0; - string key_eq_fn = mr_18986.arg1; - string clone_fn = mr_18986.arg2; - string free_fn = mr_18986.arg3; + multi_return_string_string_string_string mr_20487 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20487.arg0; + string key_eq_fn = mr_20487.arg1; + string clone_fn = mr_20487.arg2; + string free_fn = mr_20487.arg3; string fn_name_v = v__gen__c__js_dec_name(styp_v); string s = _SLIT(""); if (v__gen__c__is_js_prim(styp_v)) { @@ -82274,9 +80336,9 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_match(v__gen__c__Gen* g, v__ return _t6; } if (branch.stmts.len == 1) { - if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 308 /* v.ast.ExprStmt */) { - v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ; - if (((stmt.expr)._typ == 254 /* v.ast.CallExpr */ || (stmt.expr)._typ == 269 /* v.ast.IfExpr */ || (stmt.expr)._typ == 278 /* v.ast.MatchExpr */) || ((stmt.expr)._typ == 271 /* v.ast.IndexExpr */ && (/* as */ *(v__ast__IndexExpr*)__as_cast((stmt.expr)._v__ast__IndexExpr,(stmt.expr)._typ, 271) /*expected idx: 271, name: v.ast.IndexExpr */ ).or_expr.kind != v__ast__OrKind__absent)) { + if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 310 /* v.ast.ExprStmt */) { + v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ; + if (((stmt.expr)._typ == 256 /* v.ast.CallExpr */ || (stmt.expr)._typ == 271 /* v.ast.IfExpr */ || (stmt.expr)._typ == 280 /* v.ast.MatchExpr */) || ((stmt.expr)._typ == 273 /* v.ast.IndexExpr */ && (/* as */ *(v__ast__IndexExpr*)__as_cast((stmt.expr)._v__ast__IndexExpr,(stmt.expr)._typ, 273) /*expected idx: 273, name: v.ast.IndexExpr */ ).or_expr.kind != v__ast__OrKind__absent)) { bool _t7 = true; return _t7; } @@ -82308,7 +80370,7 @@ bool old; v__gen__c__Gen_match_expr_defer_0 = true; g->inside_match_optional = true; } - if ((node.cond)._typ == 268 /* v.ast.Ident */ || (node.cond)._typ == 288 /* v.ast.SelectorExpr */ || (node.cond)._typ == 273 /* v.ast.IntegerLiteral */ || (node.cond)._typ == 292 /* v.ast.StringLiteral */ || (node.cond)._typ == 266 /* v.ast.FloatLiteral */) { + if ((node.cond)._typ == 270 /* v.ast.Ident */ || (node.cond)._typ == 290 /* v.ast.SelectorExpr */ || (node.cond)._typ == 275 /* v.ast.IntegerLiteral */ || (node.cond)._typ == 294 /* v.ast.StringLiteral */ || (node.cond)._typ == 268 /* v.ast.FloatLiteral */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { string _t1; /* if prepend */ @@ -82399,11 +80461,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index))); } else if (sym->kind == v__ast__Kind__interface_) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 294 /* v.ast.TypeNode */) { - v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._v__ast__TypeNode,((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ, 294) /*expected idx: 294, name: v.ast.TypeNode */ ; + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 296 /* v.ast.TypeNode */) { + v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._v__ast__TypeNode,((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ, 296) /*expected idx: 296, name: v.ast.TypeNode */ ; v__ast__TypeSymbol* branch_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ.typ)); v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == _"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = branch_sym->cname}}, {_SLIT("_index"), 0, { .d_c = 0 }}}))); - } else if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 280 /* v.ast.None */ && sym->idx == _const_v__ast__error_type_idx) { + } else if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 282 /* v.ast.None */ && sym->idx == _const_v__ast__error_type_idx) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == _IError_None___index"), 0, { .d_c = 0 }}}))); } } @@ -82433,7 +80495,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast__MatchExpr node, bool is_expr, string cond_var, string tmp_var, v__ast__TypeSymbol enum_typ) { string cname = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = enum_typ.cname}}, {_SLIT("__"), 0, { .d_c = 0 }}})); - Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); + Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); Array_v__ast__MatchBranch range_branches = __new_array_with_default(0, node.branches.len, sizeof(v__ast__MatchBranch), 0); bool default_generated = false; g->empty_line = true; @@ -82442,8 +80504,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ for (int _t1 = 0; _t1 < node.branches.len; ++_t1) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)node.branches.data)[_t1]; if (branch.is_else) { - for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ).vals.len; ++_t2) { - string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 447) /*expected idx: 447, name: v.ast.Enum */ ).vals.data)[_t2]; + for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.len; ++_t2) { + string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 449) /*expected idx: 449, name: v.ast.Enum */ ).vals.data)[_t2]; if (!Array_string_contains(covered_enum, val)) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("case "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -82460,9 +80522,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ if (i > 0) { v__gen__c__Gen_write(g, _SLIT(" || ")); } - if ((expr)._typ == 286 /* v.ast.RangeExpr */) { + if ((expr)._typ == 288 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 273 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 275 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -82495,7 +80557,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ int _t4_len = _t4_orig.len; for (int _t5 = 0; _t5 < _t4_len; ++_t5) { v__ast__Expr it = ((v__ast__Expr*) _t4_orig.data)[_t5]; - if ((it)._typ == 286 /* v.ast.RangeExpr */) { + if ((it)._typ == 288 /* v.ast.RangeExpr */) { _t4 = true; break; } @@ -82506,7 +80568,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ } for (int _t7 = 0; _t7 < branch.exprs.len; ++_t7) { v__ast__Expr expr = ((v__ast__Expr*)branch.exprs.data)[_t7]; - if ((expr)._typ == 265 /* v.ast.EnumVal */) { + if ((expr)._typ == 267 /* v.ast.EnumVal */) { array_push((array*)&covered_enum, _MOV((string[]){ string_clone((*expr._v__ast__EnumVal).val) })); v__gen__c__Gen_write(g, _SLIT("case ")); v__gen__c__Gen_expr(g, expr); @@ -82536,9 +80598,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ if (i > 0) { v__gen__c__Gen_write(g, _SLIT(" || ")); } - if ((expr)._typ == 286 /* v.ast.RangeExpr */) { + if ((expr)._typ == 288 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 273 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 275 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -82639,9 +80701,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_classic(v__gen__c__Gen* g, v__ast v__gen__c__Gen_write(g, _SLIT(")")); } else { - if ((expr)._typ == 286 /* v.ast.RangeExpr */) { + if ((expr)._typ == 288 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 273 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 275 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -83059,23 +81121,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_delete(v__gen__c__Gen* g, v__ast__SqlStm } VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_expr_to_orm_primitive(v__gen__c__Gen* g, v__ast__Expr expr) { - if (expr._typ == 272 /* v.ast.InfixExpr */) { + if (expr._typ == 274 /* v.ast.InfixExpr */) { v__gen__c__Gen_sql_write_orm_primitive(g, v__ast__Table_find_type_idx(g->table, _SLIT("orm.InfixType")), expr); } - else if (expr._typ == 292 /* v.ast.StringLiteral */) { + else if (expr._typ == 294 /* v.ast.StringLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__string_type, expr); } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__int_type, expr); } - else if (expr._typ == 252 /* v.ast.BoolLiteral */) { + else if (expr._typ == 254 /* v.ast.BoolLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__bool_type, expr); } - else if (expr._typ == 268 /* v.ast.Ident */) { - v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast(((*expr._v__ast__Ident).info)._v__ast__IdentVar,((*expr._v__ast__Ident).info)._typ, 378) /*expected idx: 378, name: v.ast.IdentVar */ ; + else if (expr._typ == 270 /* v.ast.Ident */) { + v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast(((*expr._v__ast__Ident).info)._v__ast__IdentVar,((*expr._v__ast__Ident).info)._typ, 380) /*expected idx: 380, name: v.ast.IdentVar */ ; v__gen__c__Gen_sql_write_orm_primitive(g, info.typ, expr); } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { v__gen__c__Gen_sql_write_orm_primitive(g, (*expr._v__ast__SelectorExpr).typ, expr); } @@ -83102,7 +81164,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_write_orm_primitive(v__gen__c__Gen* g, v typ = _SLIT("infix"); } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("orm__"), /*115 &string*/0xfe10, {.d_s = typ}}, {_SLIT("_to_primitive("), 0, { .d_c = 0 }}}))); - if ((expr)._typ == 272 /* v.ast.InfixExpr */) { + if ((expr)._typ == 274 /* v.ast.InfixExpr */) { v__gen__c__Gen_write(g, _SLIT("(orm__InfixType){")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".name = _SLIT(\""), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*expr._v__ast__InfixExpr).left)}}, {_SLIT("\"),"), 0, { .d_c = 0 }}}))); string kind = (((*expr._v__ast__InfixExpr).op == (v__token__Kind__plus))? (_SLIT("orm__MathOperationKind__add")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__minus))? (_SLIT("orm__MathOperationKind__sub")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__div))? (_SLIT("orm__MathOperationKind__div")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__mul))? (_SLIT("orm__MathOperationKind__mul")) : (_SLIT(""))); @@ -83117,7 +81179,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_write_orm_primitive(v__gen__c__Gen* g, v } VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_where_data(v__gen__c__Gen* g, v__ast__Expr expr, Array_string* fields, Array_string* kinds, Array_v__ast__Expr* data, Array_bool* is_and) { - if (expr._typ == 272 /* v.ast.InfixExpr */) { + if (expr._typ == 274 /* v.ast.InfixExpr */) { g->sql_side = v__gen__c__SqlExprSide__left; v__gen__c__Gen_sql_where_data(g, (*expr._v__ast__InfixExpr).left, fields, kinds, data, is_and); string _t1 = (string){.str=(byteptr)"", .is_lit=1}; @@ -83277,29 +81339,29 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_where_data(v__gen__c__Gen* g, v__ast__Ex kind = _SLIT("orm__OperationKind__eq"); } } - if (((*expr._v__ast__InfixExpr).left)._typ != 272 /* v.ast.InfixExpr */ && ((*expr._v__ast__InfixExpr).right)._typ != 272 /* v.ast.InfixExpr */) { + if (((*expr._v__ast__InfixExpr).left)._typ != 274 /* v.ast.InfixExpr */ && ((*expr._v__ast__InfixExpr).right)._typ != 274 /* v.ast.InfixExpr */) { array_push((array*)kinds, _MOV((string[]){ string_clone(kind) })); } g->sql_side = v__gen__c__SqlExprSide__right; v__gen__c__Gen_sql_where_data(g, (*expr._v__ast__InfixExpr).right, fields, kinds, data, is_and); } - else if (expr._typ == 268 /* v.ast.Ident */) { + else if (expr._typ == 270 /* v.ast.Ident */) { if (g->sql_side == v__gen__c__SqlExprSide__left) { array_push((array*)fields, _MOV((string[]){ string_clone(v__gen__c__Gen_get_field_name(g, v__gen__c__Gen_get_struct_field(g, (*expr._v__ast__Ident).name))) })); } else { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } } - else if (expr._typ == 292 /* v.ast.StringLiteral */) { + else if (expr._typ == 294 /* v.ast.StringLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 252 /* v.ast.BoolLiteral */) { + else if (expr._typ == 254 /* v.ast.BoolLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } @@ -83555,12 +81617,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, field.typ); if (sym->kind == v__ast__Kind__struct_ && !string__eq(sym->name, _SLIT("time.Time"))) { v__ast__SqlExpr sub = (*(v__ast__SqlExpr*)map_get(ADDR(map, node.sub_structs), &(int[]){((int)(field.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),} })); - v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ; - v__ast__Ident ident = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ; + v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ; + v__ast__Ident ident = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ; string name = sel; int s = v__ast__Table_find_type_idx(g->table, _SLIT("orm.Primitive")); if (s != 0) { - if ((ident.info)._typ == 378 /* v.ast.IdentVar */) { + if ((ident.info)._typ == 380 /* v.ast.IdentVar */) { (*ident.info._v__ast__IdentVar).typ = s; } } @@ -83583,9 +81645,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp v__ast__Array info = v__ast__TypeSymbol_array_info(sym); v__ast__Type arr_typ = info.elem_type; v__ast__SqlExpr sub = (*(v__ast__SqlExpr*)map_get(ADDR(map, node.sub_structs), &(int[]){((int)(arr_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),} })); - v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ; - v__ast__Ident l = /* as */ *(v__ast__Ident*)__as_cast((where_expr.left)._v__ast__Ident,(where_expr.left)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ; - v__ast__Ident r = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 268) /*expected idx: 268, name: v.ast.Ident */ ; + v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ; + v__ast__Ident l = /* as */ *(v__ast__Ident*)__as_cast((where_expr.left)._v__ast__Ident,(where_expr.left)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ; + v__ast__Ident r = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 270) /*expected idx: 270, name: v.ast.Ident */ ; l.name = fkey; r.name = tmp; where_expr.left = v__ast__Ident_to_sumtype_v__ast__Expr(&l); @@ -83596,7 +81658,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp .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, 378) /*expected idx: 378, name: v.ast.IdentVar */ ).typ, + .expr_type = (/* as */ *(v__ast__IdentVar*)__as_cast((r.info)._v__ast__IdentVar,(r.info)._typ, 380) /*expected idx: 380, name: v.ast.IdentVar */ ).typ, .typ = _const_v__ast__int_type, .name_type = 0, .next_token = 0, @@ -83645,13 +81707,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp } VV_LOCAL_SYMBOL v__gen__c__SqlType v__gen__c__Gen_parse_db_type(v__gen__c__Gen* g, v__ast__Expr expr) { - if (expr._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).info)._typ == 378 /* v.ast.IdentVar */) { + if (expr._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).info)._typ == 380 /* v.ast.IdentVar */) { v__gen__c__SqlType _t1 = v__gen__c__Gen_parse_db_from_type_string(g, v__ast__Table_get_type_name(g->table, (*(*expr._v__ast__Ident).info._v__ast__IdentVar).typ)); return _t1; } } - else if (expr._typ == 288 /* v.ast.SelectorExpr */) { + else if (expr._typ == 290 /* v.ast.SelectorExpr */) { v__gen__c__SqlType _t2 = v__gen__c__Gen_parse_db_from_type_string(g, v__ast__Table_get_type_name(g->table, (*expr._v__ast__SelectorExpr).typ)); return _t2; } @@ -83744,7 +81806,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_string_literal(v__gen__c__Gen* g, v__ast__St } VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal_sb_optimized(v__gen__c__Gen* g, v__ast__CallExpr call_expr) { - v__ast__StringInterLiteral node = /* as */ *(v__ast__StringInterLiteral*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._v__ast__StringInterLiteral,((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._typ, 291) /*expected idx: 291, name: v.ast.StringInterLiteral */ ; + v__ast__StringInterLiteral node = /* as */ *(v__ast__StringInterLiteral*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._v__ast__StringInterLiteral,((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._typ, 293) /*expected idx: 293, name: v.ast.StringInterLiteral */ ; v__gen__c__Gen_writeln(g, _SLIT("// sb inter opt")); bool is_nl = string__eq(call_expr.name, _SLIT("writeln")); for (int i = 0; i < node.vals.len; ++i) { @@ -83785,7 +81847,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast typ = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(typ, v__ast__TypeFlag__shared_f), 0); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - if ((sym->info)._typ == 433 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 435 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); if (v__ast__TypeSymbol_has_method(parent_sym, _SLIT("str"))) { typ = (*sym->info._v__ast__Alias).parent_type; @@ -83811,7 +81873,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast } else if (sym->kind == v__ast__Kind__none_) { v__gen__c__Gen_write(g, _SLIT("_SLIT(\"\")")); } else if (sym->kind == v__ast__Kind__enum_) { - if ((expr)._typ != 265 /* v.ast.EnumVal */) { + if ((expr)._typ != 267 /* v.ast.EnumVal */) { string str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_enum_expr(g, expr); @@ -83834,7 +81896,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast } else if ((!str_method_expects_ptr && is_ptr && !is_shared) || is_var_mut) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((expr)._typ == 248 /* v.ast.ArrayInit */) { + if ((expr)._typ == 250 /* v.ast.ArrayInit */) { if ((*expr._v__ast__ArrayInit).is_fixed) { string s = v__gen__c__Gen_typ(g, (*expr._v__ast__ArrayInit).typ); if (!(*expr._v__ast__ArrayInit).has_it) { @@ -83869,7 +81931,7 @@ VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i))); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (sym->kind == v__ast__Kind__alias) { - typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; } bool remove_tail_zeros = false; u8 fspec = (*(u8*)/*ee elem_sym */array_get(node.fmts, i)); @@ -83990,7 +82052,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } v__gen__c__Gen_expr(g, expr); } - } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ )), _SLIT("str"))) { + } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ )), _SLIT("str"))) { string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, expr); @@ -84001,14 +82063,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt v__gen__c__Gen_write(g, _SLIT(")")); } else if ((*(u8*)/*ee elem_sym */array_get(node.fmts, i)) == 's' || v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__Type exp_typ = typ; - if ((expr)._typ == 268 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { if (g->comptime_var_type_map.len > 0 || g->comptime_for_method.len > 0) { exp_typ = (*(*expr._v__ast__Ident).obj._v__ast__Var).typ; } else if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { exp_typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, exp_typ); - if ((cast_sym->info)._typ == 431 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 433 /* v.ast.Aggregate */) { exp_typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -84050,8 +82112,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal(v__gen__c__Gen* g, v__a v__ast__StringInterLiteral node_ = node; for (int i = 0; i < node_.exprs.len; ++i) { v__ast__Expr* expr = ((v__ast__Expr*)node_.exprs.data) + i; - if ((expr)->_typ == 268 /* v.ast.Ident */) { - if (((*expr->_v__ast__Ident).obj)._typ == 326 /* v.ast.Var */) { + if ((expr)->_typ == 270 /* v.ast.Ident */) { + if (((*expr->_v__ast__Ident).obj)._typ == 328 /* v.ast.Var */) { array_set(&node_.expr_types, i, &(v__ast__Type[]) { (*(*expr->_v__ast__Ident).obj._v__ast__Var).typ }); } } @@ -84127,7 +82189,8 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); } } - Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; if (is_multiline) { g->indent++; } @@ -84173,7 +82236,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; g->is_shared = old_is_shared; int nr_fields = 1; if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; nr_fields = info.fields.len; if (info.is_union && node.fields.len > 1) { v__gen__c__verror(_SLIT("union must not have more than 1 initializer")); @@ -84210,7 +82273,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); string embed_name = v__ast__TypeSymbol_embed_name(embed_sym); if (!_IN_MAP(ADDR(string, embed_name), ADDR(map, inited_fields))) { - v__ast__Struct embed_info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct embed_info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; Array_string _t6 = {0}; Array_v__ast__StructField _t6_orig = embed_info.fields; int _t6_len = _t6_orig.len; @@ -84266,7 +82329,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; if (!v__ast__Type_has_flag(field->typ, v__ast__TypeFlag__shared_f)) { g->is_shared = false; } - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { int found_equal_fields = 0; for (int _t14 = 0; _t14 < (*sym->info._v__ast__Struct).fields.len; ++_t14) { v__ast__StructField* sifield = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data) + _t14; @@ -84297,8 +82360,8 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; if (!cloned) { int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; - if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 268 /* v.ast.Ident */) { - v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 441) /*expected idx: 441, name: v.ast.ArrayFixed */ ; + if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 270 /* v.ast.Ident */) { + v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 443) /*expected idx: 443, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, _SLIT("{")); for (int i = 0; i < fixed_array_info.size; ++i) { v__gen__c__Gen_expr(g, sfield.expr); @@ -84408,7 +82471,7 @@ if (v__gen__c__Gen_struct_init_defer_0) { VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast__StructField field) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, field.typ); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (info.fields.len == 0) { bool _t1 = false; return _t1; @@ -84432,7 +82495,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast_ VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_empty_struct(v__gen__c__Gen* g, v__gen__c__Type t) { v__ast__TypeSymbol* sym = t.unaliased_sym; - if (sym->info._typ == 418 /* v.ast.Struct */) { + if (sym->info._typ == 420 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).fields.len > 0 || (*sym->info._v__ast__Struct).embeds.len > 0) { bool _t1 = false; return _t1; @@ -86095,10 +84158,10 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; // Defer end return _t1; } - if (val._typ == 268 /* v.ast.Ident */) { + if (val._typ == 270 /* v.ast.Ident */) { for (int _t2 = 0; _t2 < exprs.len; ++_t2) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t2]; - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { if (string__eq((*expr._v__ast__Ident).name, (*val._v__ast__Ident).name) && (*expr._v__ast__Ident).kind != v__ast__IdentKind__blank_ident) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable: `"), /*115 &string*/0xfe10, {.d_s = (*val._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*val._v__ast__Ident).pos); _option_void _t3 = (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable: `"), /*115 &string*/0xfe10, {.d_s = (*val._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -86112,7 +84175,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 248 /* v.ast.ArrayInit */) { + else if (val._typ == 250 /* v.ast.ArrayInit */) { if ((*val._v__ast__ArrayInit).has_cap) { _option_void _t4 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__ArrayInit).cap_expr); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { @@ -86122,7 +84185,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -86137,7 +84200,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -86152,7 +84215,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t9; - memcpy(&_t9, &_t8, sizeof(Option)); + memcpy(&_t9, &_t8, sizeof(_option)); return _t9; } @@ -86168,14 +84231,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t12; - memcpy(&_t12, &_t11, sizeof(Option)); + memcpy(&_t12, &_t11, sizeof(_option)); return _t12; } ; } } - else if (val._typ == 254 /* v.ast.CallExpr */) { + else if (val._typ == 256 /* v.ast.CallExpr */) { _option_void _t13 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__CallExpr).left); if (_t13.state != 0 && _t13.err._typ != _IError_None___index) { // Defer begin @@ -86184,7 +84247,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t14; - memcpy(&_t14, &_t13, sizeof(Option)); + memcpy(&_t14, &_t13, sizeof(_option)); return _t14; } @@ -86199,14 +84262,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t17; - memcpy(&_t17, &_t16, sizeof(Option)); + memcpy(&_t17, &_t16, sizeof(_option)); return _t17; } ; } } - else if (val._typ == 272 /* v.ast.InfixExpr */) { + else if (val._typ == 274 /* v.ast.InfixExpr */) { _option_void _t18 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__InfixExpr).left); if (_t18.state != 0 && _t18.err._typ != _IError_None___index) { // Defer begin @@ -86215,7 +84278,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t19; - memcpy(&_t19, &_t18, sizeof(Option)); + memcpy(&_t19, &_t18, sizeof(_option)); return _t19; } @@ -86228,13 +84291,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t21; - memcpy(&_t21, &_t20, sizeof(Option)); + memcpy(&_t21, &_t20, sizeof(_option)); return _t21; } ; } - else if (val._typ == 269 /* v.ast.IfExpr */) { + else if (val._typ == 271 /* v.ast.IfExpr */) { _option_void _t22 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__IfExpr).left); if (_t22.state != 0 && _t22.err._typ != _IError_None___index) { // Defer begin @@ -86243,7 +84306,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t23; - memcpy(&_t23, &_t22, sizeof(Option)); + memcpy(&_t23, &_t22, sizeof(_option)); return _t23; } @@ -86258,14 +84321,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t26; - memcpy(&_t26, &_t25, sizeof(Option)); + memcpy(&_t26, &_t25, sizeof(_option)); return _t26; } ; for (int _t27 = 0; _t27 < branch.stmts.len; ++_t27) { v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t27]; - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { _option_void _t28 = v__parser__Parser_check_undefined_variables(p, exprs, (*stmt._v__ast__ExprStmt).expr); if (_t28.state != 0 && _t28.err._typ != _IError_None___index) { // Defer begin @@ -86274,7 +84337,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t29; - memcpy(&_t29, &_t28, sizeof(Option)); + memcpy(&_t29, &_t28, sizeof(_option)); return _t29; } @@ -86283,7 +84346,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 277 /* v.ast.MapInit */) { + else if (val._typ == 279 /* v.ast.MapInit */) { for (int _t30 = 0; _t30 < (*val._v__ast__MapInit).keys.len; ++_t30) { v__ast__Expr key = ((v__ast__Expr*)(*val._v__ast__MapInit).keys.data)[_t30]; _option_void _t31 = v__parser__Parser_check_undefined_variables(p, exprs, key); @@ -86294,7 +84357,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t32; - memcpy(&_t32, &_t31, sizeof(Option)); + memcpy(&_t32, &_t31, sizeof(_option)); return _t32; } @@ -86310,14 +84373,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t35; - memcpy(&_t35, &_t34, sizeof(Option)); + memcpy(&_t35, &_t34, sizeof(_option)); return _t35; } ; } } - else if (val._typ == 278 /* v.ast.MatchExpr */) { + else if (val._typ == 280 /* v.ast.MatchExpr */) { _option_void _t36 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__MatchExpr).cond); if (_t36.state != 0 && _t36.err._typ != _IError_None___index) { // Defer begin @@ -86326,7 +84389,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t37; - memcpy(&_t37, &_t36, sizeof(Option)); + memcpy(&_t37, &_t36, sizeof(_option)); return _t37; } @@ -86343,7 +84406,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t41; - memcpy(&_t41, &_t40, sizeof(Option)); + memcpy(&_t41, &_t40, sizeof(_option)); return _t41; } @@ -86351,7 +84414,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } for (int _t42 = 0; _t42 < branch.stmts.len; ++_t42) { v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t42]; - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { _option_void _t43 = v__parser__Parser_check_undefined_variables(p, exprs, (*stmt._v__ast__ExprStmt).expr); if (_t43.state != 0 && _t43.err._typ != _IError_None___index) { // Defer begin @@ -86360,7 +84423,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t44; - memcpy(&_t44, &_t43, sizeof(Option)); + memcpy(&_t44, &_t43, sizeof(_option)); return _t44; } @@ -86369,7 +84432,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 283 /* v.ast.ParExpr */) { + else if (val._typ == 285 /* v.ast.ParExpr */) { _option_void _t45 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__ParExpr).expr); if (_t45.state != 0 && _t45.err._typ != _IError_None___index) { // Defer begin @@ -86378,13 +84441,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t46; - memcpy(&_t46, &_t45, sizeof(Option)); + memcpy(&_t46, &_t45, sizeof(_option)); return _t46; } ; } - else if (val._typ == 284 /* v.ast.PostfixExpr */) { + else if (val._typ == 286 /* v.ast.PostfixExpr */) { _option_void _t47 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); if (_t47.state != 0 && _t47.err._typ != _IError_None___index) { // Defer begin @@ -86393,13 +84456,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t48; - memcpy(&_t48, &_t47, sizeof(Option)); + memcpy(&_t48, &_t47, sizeof(_option)); return _t48; } ; } - else if (val._typ == 285 /* v.ast.PrefixExpr */) { + else if (val._typ == 287 /* v.ast.PrefixExpr */) { _option_void _t49 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__PrefixExpr).right); if (_t49.state != 0 && _t49.err._typ != _IError_None___index) { // Defer begin @@ -86408,13 +84471,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t50; - memcpy(&_t50, &_t49, sizeof(Option)); + memcpy(&_t50, &_t49, sizeof(_option)); return _t50; } ; } - else if (val._typ == 291 /* v.ast.StringInterLiteral */) { + else if (val._typ == 293 /* v.ast.StringInterLiteral */) { for (int _t51 = 0; _t51 < (*val._v__ast__StringInterLiteral).exprs.len; ++_t51) { v__ast__Expr expr_ = ((v__ast__Expr*)(*val._v__ast__StringInterLiteral).exprs.data)[_t51]; _option_void _t52 = v__parser__Parser_check_undefined_variables(p, exprs, expr_); @@ -86425,14 +84488,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t53; - memcpy(&_t53, &_t52, sizeof(Option)); + memcpy(&_t53, &_t52, sizeof(_option)); return _t53; } ; } } - else if (val._typ == 293 /* v.ast.StructInit */) { + else if (val._typ == 295 /* v.ast.StructInit */) { for (int _t54 = 0; _t54 < (*val._v__ast__StructInit).fields.len; ++_t54) { v__ast__StructInitField field = ((v__ast__StructInitField*)(*val._v__ast__StructInit).fields.data)[_t54]; _option_void _t55 = v__parser__Parser_check_undefined_variables(p, exprs, field.expr); @@ -86443,7 +84506,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t56; - memcpy(&_t56, &_t55, sizeof(Option)); + memcpy(&_t56, &_t55, sizeof(_option)); return _t56; } @@ -86464,10 +84527,10 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val) { string val_str = v__ast__Expr_str(val); - if (val._typ == 268 /* v.ast.Ident */) { + if (val._typ == 270 /* v.ast.Ident */) { for (int _t1 = 0; _t1 < exprs.len; ++_t1) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t1]; - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { if (string__eq((*expr._v__ast__Ident).name, (*val._v__ast__Ident).name)) { bool _t2 = true; return _t2; @@ -86475,7 +84538,7 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* } } } - else if (val._typ == 271 /* v.ast.IndexExpr */) { + else if (val._typ == 273 /* v.ast.IndexExpr */) { for (int _t3 = 0; _t3 < exprs.len; ++_t3) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t3]; if (string__eq(v__ast__Expr_str(expr), val_str)) { @@ -86484,19 +84547,19 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* } } } - else if (val._typ == 272 /* v.ast.InfixExpr */) { + else if (val._typ == 274 /* v.ast.InfixExpr */) { bool _t5 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).left) || v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).right); return _t5; } - else if (val._typ == 285 /* v.ast.PrefixExpr */) { + else if (val._typ == 287 /* v.ast.PrefixExpr */) { bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); return _t6; } - else if (val._typ == 284 /* v.ast.PostfixExpr */) { + else if (val._typ == 286 /* v.ast.PostfixExpr */) { bool _t7 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); return _t7; } - else if (val._typ == 288 /* v.ast.SelectorExpr */) { + else if (val._typ == 290 /* v.ast.SelectorExpr */) { for (int _t8 = 0; _t8 < exprs.len; ++_t8) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t8]; if (string__eq(v__ast__Expr_str(expr), val_str)) { @@ -86534,14 +84597,14 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa for (int i = 0; i < left.len; ++i) { v__ast__Expr lx_ = ((v__ast__Expr*)left.data)[i]; v__ast__Expr lx = lx_; - if (lx._typ == 268 /* v.ast.Ident */) { + if (lx._typ == 270 /* v.ast.Ident */) { if (op == v__token__Kind__decl_assign) { if (v__ast__Scope_known_var(p->scope, (*lx._v__ast__Ident).name)) { v__ast__Stmt _t4 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of `"), /*115 &string*/0xfe10, {.d_s = (*lx._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*lx._v__ast__Ident).pos)))); return _t4; } v__ast__ShareType share = ((v__ast__ShareType)(0)); - if (((*lx._v__ast__Ident).info)._typ == 378 /* v.ast.IdentVar */) { + if (((*lx._v__ast__Ident).info)._typ == 380 /* v.ast.IdentVar */) { share = (*(*lx._v__ast__Ident).info._v__ast__IdentVar).share; if ((*(*lx._v__ast__Ident).info._v__ast__IdentVar).is_static) { if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !p->inside_unsafe_fn) { @@ -86576,7 +84639,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa .is_stack_obj = p->inside_for, }); if (p->pref->autofree) { - if ((r0)._typ == 254 /* v.ast.CallExpr */) { + if ((r0)._typ == 256 /* v.ast.CallExpr */) { if ((*r0._v__ast__CallExpr).or_block.pos.pos > 0 && (*r0._v__ast__CallExpr).or_block.stmts.len > 0) { v.is_or = true; } @@ -86587,18 +84650,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa v__ast__Scope_register(p->scope, obj); } } - else if (lx._typ == 271 /* v.ast.IndexExpr */) { + else if (lx._typ == 273 /* v.ast.IndexExpr */) { if (op == v__token__Kind__decl_assign) { v__ast__Stmt _t6 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-name `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*lx._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*lx._v__ast__IndexExpr).index)}}, {_SLIT("]` on left side of `:=`"), 0, { .d_c = 0 }}})), (*lx._v__ast__IndexExpr).pos)))); return _t6; } (*lx._v__ast__IndexExpr).is_setter = true; } - else if (lx._typ == 283 /* v.ast.ParExpr */) { + else if (lx._typ == 285 /* v.ast.ParExpr */) { } - else if (lx._typ == 285 /* v.ast.PrefixExpr */) { + else if (lx._typ == 287 /* v.ast.PrefixExpr */) { } - else if (lx._typ == 288 /* v.ast.SelectorExpr */) { + else if (lx._typ == 290 /* v.ast.SelectorExpr */) { if (op == v__token__Kind__decl_assign) { v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("struct fields can only be declared during the initialization"), (*lx._v__ast__SelectorExpr).pos)))); return _t7; @@ -87482,6 +85545,10 @@ bool inside_array_lit; v__token__Pos pos = v__token__Token_pos(&p->tok); bool is_known_var = v__parser__Parser_mark_var_as_used(p, p->tok.lit) || v__ast__Scope_known_const(p->table->global_scope, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit)); bool is_type = v__parser__Parser_known_import(p, p->tok.lit) || v__token__Kind_is_start_of_type(p->tok.kind) || (p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0))); + if ((string__eq(p->tok.lit, _SLIT("c")) || string__eq(p->tok.lit, _SLIT("r"))) && p->peek_tok.kind == v__token__Kind__string) { + is_known_var = false; + is_type = false; + } if (is_known_var || !is_type) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); if (is_reftype) { @@ -87739,7 +85806,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr node = v__ast__IndexExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IndexExpr, (v__parser__Parser_index_expr(p, node, false)))); } p->is_stmt_ident = is_stmt_ident; - if (p->tok.kind == v__token__Kind__lpar && p->tok.line_nr == p->prev_tok.line_nr && (node)._typ == 271 /* v.ast.IndexExpr */) { + if (p->tok.kind == v__token__Kind__lpar && p->tok.line_nr == p->prev_tok.line_nr && (node)._typ == 273 /* v.ast.IndexExpr */) { v__parser__Parser_next(p); v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); @@ -87763,7 +85830,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__parser__Parser_next(p); v__ast__Expr right = v__parser__Parser_expr(p, precedence - 1); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - if ((node)._typ == 271 /* v.ast.IndexExpr */) { + if ((node)._typ == 273 /* 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){.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,})))); @@ -87789,7 +85856,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((p->tok.kind == v__token__Kind__inc || p->tok.kind == v__token__Kind__dec) && p->prev_tok.line_nr != p->tok.line_nr) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.token.Token*/0xfe10, {.d_s = v__token__Token_str(p->tok)}}, {_SLIT(" must be on the same line as the previous token"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); } - if ((node)._typ == 271 /* v.ast.IndexExpr */) { + if ((node)._typ == 273 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); } node = v__ast__PostfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PostfixExpr, (((v__ast__PostfixExpr){.op = p->tok.kind,.pos = v__token__Token_pos(&p->tok),.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); @@ -87829,7 +85896,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, p->inside_in_array = false; } p->expecting_type = prev_expecting_type; - if (p->pref->is_vet && (op == v__token__Kind__key_in || op == v__token__Kind__not_in) && (right)._typ == 248 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((right)._v__ast__ArrayInit,(right)._typ, 248) /*expected idx: 248, name: v.ast.ArrayInit */ ).exprs.len == 1) { + if (p->pref->is_vet && (op == v__token__Kind__key_in || op == v__token__Kind__not_in) && (right)._typ == 250 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((right)._v__ast__ArrayInit,(right)._typ, 250) /*expected idx: 250, name: v.ast.ArrayInit */ ).exprs.len == 1) { v__parser__Parser_vet_error(p, _SLIT("Use `var == value` instead of `var in [value]`"), pos.line_nr, v__vet__FixKind__vfmt, v__vet__ErrorType__default); } Array_v__ast__Stmt or_stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); @@ -87892,27 +85959,27 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) v__ast__Expr right = v__parser__Parser_expr(p, ((int)(v__token__Precedence__prefix))); p->is_amp = false; if (op == v__token__Kind__amp) { - if ((right)._typ == 255 /* v.ast.CastExpr */) { + if ((right)._typ == 257 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*right._v__ast__CastExpr), pos); v__ast__Expr _t1 = v__ast__CastExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__CastExpr)); return _t1; } - if ((right)._typ == 288 /* v.ast.SelectorExpr */) { - if (((*right._v__ast__SelectorExpr).expr)._typ == 255 /* v.ast.CastExpr */) { + if ((right)._typ == 290 /* v.ast.SelectorExpr */) { + if (((*right._v__ast__SelectorExpr).expr)._typ == 257 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*(*right._v__ast__SelectorExpr).expr._v__ast__CastExpr), pos); v__ast__Expr _t2 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__SelectorExpr)); return _t2; } } - if ((right)._typ == 271 /* v.ast.IndexExpr */) { - if (((*right._v__ast__IndexExpr).left)._typ == 255 /* v.ast.CastExpr */) { + if ((right)._typ == 273 /* v.ast.IndexExpr */) { + if (((*right._v__ast__IndexExpr).left)._typ == 257 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*(*right._v__ast__IndexExpr).left._v__ast__CastExpr), pos); v__ast__Expr _t3 = v__ast__IndexExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__IndexExpr)); return _t3; } } - if ((right)._typ == 283 /* v.ast.ParExpr */) { - if (((*right._v__ast__ParExpr).expr)._typ == 293 /* v.ast.StructInit */) { + if ((right)._typ == 285 /* v.ast.ParExpr */) { + if (((*right._v__ast__ParExpr).expr)._typ == 295 /* v.ast.StructInit */) { v__parser__Parser_note_with_pos(p, str_intp(3, _MOV((StrIntpData[]){{_SLIT("unnecessary `()`, use `&"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*right._v__ast__ParExpr).expr)}}, {_SLIT("` instead of `&("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*right._v__ast__ParExpr).expr)}}, {_SLIT(")`"), 0, { .d_c = 0 }}})), (*right._v__ast__ParExpr).pos); right = (*right._v__ast__ParExpr).expr; } @@ -87962,7 +86029,6 @@ string old_expr_mod; v__ast__OrKind or_kind = v__ast__OrKind__absent; if (string__eq(fn_name, _SLIT("json.decode"))) { p->expecting_type = true; - or_kind = v__ast__OrKind__block; } old_expr_mod = p->expr_mod; v__parser__Parser_call_expr_defer_0 = true; @@ -88075,7 +86141,7 @@ Array_v__ast__CallArg v__parser__Parser_call_args(v__parser__Parser* p) { if (array_decompose) { expr = v__ast__ArrayDecompose_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayDecompose, (((v__ast__ArrayDecompose){.pos = v__token__Token_pos(&p->tok),.expr = expr,.expr_type = 0,.arg_type = 0,})))); } - if ((expr)._typ == 293 /* v.ast.StructInit */) { + if ((expr)._typ == 295 /* v.ast.StructInit */) { _PUSH_MANY(&(*expr._v__ast__StructInit).pre_comments, (comments), _t2, Array_v__ast__Comment); comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); } @@ -88230,7 +86296,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { if (is_method) { bool is_duplicate = v__ast__TypeSymbol_has_method(type_sym, name); if (type_sym->kind == v__ast__Kind__interface_ && is_duplicate) { - if ((type_sym->info)._typ == 436 /* v.ast.Interface */) { + if ((type_sym->info)._typ == 438 /* v.ast.Interface */) { is_duplicate = !v__ast__Interface_has_method(&(*type_sym->info._v__ast__Interface), name); } } @@ -88260,11 +86326,11 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { 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); - Array_string generic_names = mr_8890.arg1; + multi_return_Array_v__ast__Type_Array_string mr_8871 = v__parser__Parser_parse_generic_types(p); + Array_string generic_names = mr_8871.arg1; if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ); - if ((sym->info)._typ == 418 /* v.ast.Struct */) { + if ((sym->info)._typ == 420 /* v.ast.Struct */) { Array_string fn_generic_names = array_clone_to_depth(&generic_names, 0); Array_string _t11 = {0}; Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types; @@ -88285,10 +86351,10 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } } } - multi_return_Array_v__ast__Param_bool_bool mr_9364 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_9364.arg0; - bool are_args_type_only = mr_9364.arg1; - bool is_variadic = mr_9364.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_9345 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_9345.arg0; + bool are_args_type_only = mr_9345.arg1; + bool is_variadic = mr_9345.arg2; if (is_c2v_variadic) { is_variadic = true; } @@ -88333,6 +86399,10 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { p->inside_fn_return = false; return_type_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->prev_tok)); } + if (p->tok.kind == v__token__Kind__comma) { + v__token__Pos mr_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->peek_tok)); + v__parser__Parser_error_with_pos(p, _SLIT("multiple return types in function declaration must use parentheses, .e.g (int, string)"), mr_pos); + } int type_sym_method_idx = 0; bool no_body = p->tok.kind != v__token__Kind__lcbr; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); @@ -88583,7 +86653,7 @@ bool v__parser__Parser_fn_receiver_defer_0 = false; v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec->typ); bool is_auto_rec = false; if (type_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 418) /*expected idx: 418, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 420) /*expected idx: 420, name: v.ast.Struct */ ; if (!rec->is_mut && !v__ast__Type_is_ptr(rec->typ) && info.fields.len > 8) { rec->typ = v__ast__Type_ref(rec->typ); is_auto_rec = true; @@ -88630,9 +86700,9 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_anon_fn_defer_0 = true; p->scope->detached_from_parent = true; Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0))); - multi_return_Array_v__ast__Param_bool_bool mr_18748 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args = mr_18748.arg0; - bool is_variadic = mr_18748.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_18932 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args = mr_18932.arg0; + bool is_variadic = mr_18932.arg2; for (int _t2 = 0; _t2 < args.len; ++_t2) { v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) { @@ -88932,7 +87002,7 @@ VV_LOCAL_SYMBOL v__ast__GoExpr v__parser__Parser_go_expr(v__parser__Parser* p) { v__token__Pos spos = v__token__Token_pos(&p->tok); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__ast__CallExpr _t1; /* if prepend */ - if ((expr)._typ == 254 /* v.ast.CallExpr */) { + if ((expr)._typ == 256 /* v.ast.CallExpr */) { _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)); @@ -88992,7 +87062,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check_fn_mutable_arguments(v__parser__Par return; } if (sym->kind == v__ast__Kind__alias) { - v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 433) /*expected idx: 433, name: v.ast.Alias */ ).parent_type; + v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 435) /*expected idx: 435, name: v.ast.Alias */ ).parent_type; v__parser__Parser_check_fn_mutable_arguments(p, atyp, pos); return; } @@ -89315,7 +87385,7 @@ bool was_inside_ct_if_expr; v__parser__Parser_check(p, v__token__Kind__decl_assign); _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t9, Array_v__ast__Comment); v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if (!((expr)._typ == 254 /* v.ast.CallExpr */ || (expr)._typ == 271 /* v.ast.IndexExpr */ || (expr)._typ == 285 /* v.ast.PrefixExpr */)) { + if (!((expr)._typ == 256 /* v.ast.CallExpr */ || (expr)._typ == 273 /* v.ast.IndexExpr */ || (expr)._typ == 287 /* v.ast.PrefixExpr */)) { v__parser__Parser_error_with_pos(p, _SLIT("if guard condition expression is illegal, it should return optional"), v__ast__Expr_pos(expr)); } cond = v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IfGuardExpr, (((v__ast__IfGuardExpr){.vars = vars,.expr = expr,.expr_type = 0,})))); @@ -89589,14 +87659,14 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars } p->inside_match = false; p->inside_select = false; - if (stmt._typ == 308 /* v.ast.ExprStmt */) { + if (stmt._typ == 310 /* v.ast.ExprStmt */) { bool check_timeout = false; if (!(*stmt._v__ast__ExprStmt).is_expr) { v__parser__Parser_error_with_pos(p, _SLIT("select: invalid expression"), (*stmt._v__ast__ExprStmt).pos); v__ast__SelectExpr _t4 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); return _t4; } else { - if ((*stmt._v__ast__ExprStmt).expr._typ == 272 /* v.ast.InfixExpr */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 274 /* v.ast.InfixExpr */) { if ((*(*stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).op != v__token__Kind__arrow) { check_timeout = true; } else if (is_gt) { @@ -89624,9 +87694,9 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars has_timeout = true; } } - else if (stmt._typ == 300 /* v.ast.AssignStmt */) { + else if (stmt._typ == 302 /* v.ast.AssignStmt */) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get((*stmt._v__ast__AssignStmt).right, 0)); - if (expr._typ == 285 /* v.ast.PrefixExpr */) { + if (expr._typ == 287 /* v.ast.PrefixExpr */) { if ((*expr._v__ast__PrefixExpr).op != v__token__Kind__arrow) { v__parser__Parser_error_with_pos(p, _SLIT("select key: `<-` operator expected"), (*expr._v__ast__PrefixExpr).pos); v__ast__SelectExpr _t7 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); @@ -89739,7 +87809,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Expr_Array_v__ast__Comment v__parser_ Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); for (;;) { v__ast__Expr expr = v__parser__Parser_lockable(p); - if ((expr)._typ == 258 /* v.ast.Comment */) { + if ((expr)._typ == 260 /* v.ast.Comment */) { array_push((array*)&comments, _MOV((v__ast__Comment[]){ (*expr._v__ast__Comment) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); @@ -89862,21 +87932,21 @@ v__ast__Type v__parser__Parser_parse_array_type(v__parser__Parser* p, v__token__ if (p->pref->is_fmt) { fixed_size = 987654321; } else { - if (size_expr._typ == 273 /* v.ast.IntegerLiteral */) { + if (size_expr._typ == 275 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*size_expr._v__ast__IntegerLiteral).val); } - else if (size_expr._typ == 268 /* v.ast.Ident */) { + else if (size_expr._typ == 270 /* v.ast.Ident */) { bool show_non_const_error = false; _option_v__ast__ConstField_ptr _t1; if (_t1 = v__ast__Scope_find_const(p->table->global_scope, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = p->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*size_expr._v__ast__Ident).name}}, {_SLIT0, 0, { .d_c = 0 }}}))), _t1.state == 0) { v__ast__ConstField* const_field = *(v__ast__ConstField**)_t1.data; - if ((const_field->expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((const_field->expr)._typ == 275 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*const_field->expr._v__ast__IntegerLiteral).val); } else { - if ((const_field->expr)._typ == 272 /* v.ast.InfixExpr */) { + if ((const_field->expr)._typ == 274 /* v.ast.InfixExpr */) { v__transformer__Transformer* t = v__transformer__new_transformer(p->pref); v__ast__Expr folded_expr = v__transformer__Transformer_infix_expr(t, (voidptr)&/*qq*/(*const_field->expr._v__ast__InfixExpr)); - if ((folded_expr)._typ == 273 /* v.ast.IntegerLiteral */) { + if ((folded_expr)._typ == 275 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*folded_expr._v__ast__IntegerLiteral).val); } else { show_non_const_error = true; @@ -90318,7 +88388,7 @@ v__ast__Type v__parser__Parser_parse_type(v__parser__Parser* p) { return _t4; } v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); - if (is_optional && (sym->info)._typ == 437 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 437) /*expected idx: 437, name: v.ast.SumType */ ).is_anon) { + if (is_optional && (sym->info)._typ == 439 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 439) /*expected idx: 439, name: v.ast.SumType */ ).is_anon) { v__parser__Parser_error_with_pos(p, _SLIT("an inline sum type cannot be optional"), v__token__Pos_extend(optional_pos, v__token__Token_pos(&p->prev_tok))); } } @@ -90580,21 +88650,21 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str parent_idx = v__ast__Table_add_placeholder_type(p->table, name, v__ast__Language__v); } v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(p->table, v__ast__new_type(parent_idx)); - if (parent_sym->info._typ == 418 /* v.ast.Struct */) { + if (parent_sym->info._typ == 420 /* v.ast.Struct */) { if ((*parent_sym->info._v__ast__Struct).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic struct, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Struct).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 436 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 438 /* v.ast.Interface */) { if ((*parent_sym->info._v__ast__Interface).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Interface).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of interfce `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 437 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 439 /* v.ast.SumType */) { if ((*parent_sym->info._v__ast__SumType).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__SumType).generic_types.len != concrete_types.len) { @@ -90620,7 +88690,7 @@ bool v__parser__parse_stmt_defer_0 = false; eprintln( str_intp(4, _MOV((StrIntpData[]){{_SLIT("> "), /*115 &string*/0xfe10, {.d_s = _SLIT("v.parser")}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = _SLIT("parse_stmt")}}, {_SLIT(" text: "), /*115 &string*/0xfe10, {.d_s = text}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.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,.script_mode = 0,}); + v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -91123,7 +89193,7 @@ bool v__parser__Parser_parse_defer_0 = false; break; } v__ast__Stmt stmt = v__parser__Parser_top_stmt(p); - if (!((stmt)._typ == 308 /* v.ast.ExprStmt */ && ((/* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 308) /*expected idx: 308, name: v.ast.ExprStmt */ ).expr)._typ == 258 /* v.ast.Comment */)) { + if (!((stmt)._typ == 310 /* v.ast.ExprStmt */ && ((/* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 310) /*expected idx: 310, name: v.ast.ExprStmt */ ).expr)._typ == 260 /* v.ast.Comment */)) { p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); } array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ stmt })); @@ -91456,6 +89526,9 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { if (p->pref->is_script && !p->pref->is_test) { p->script_mode = true; p->script_mode_start_token = p->tok; + if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { + v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); + } v__parser__Parser_open_scope(p); Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); for (;;) { @@ -91637,17 +89710,17 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { if (p->tok.kind == v__token__Kind__key_for) { v__token__Pos for_pos = v__token__Token_pos(&p->tok); v__ast__Stmt stmt = v__parser__Parser_stmt(p, is_top_level); - if (stmt._typ == 311 /* v.ast.ForStmt */) { + if (stmt._typ == 313 /* v.ast.ForStmt */) { (*stmt._v__ast__ForStmt).label = name; v__ast__Stmt _t7 = v__ast__ForStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForStmt)); return _t7; } - else if (stmt._typ == 310 /* v.ast.ForInStmt */) { + else if (stmt._typ == 312 /* v.ast.ForInStmt */) { (*stmt._v__ast__ForInStmt).label = name; v__ast__Stmt _t8 = v__ast__ForInStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForInStmt)); return _t8; } - else if (stmt._typ == 309 /* v.ast.ForCStmt */) { + else if (stmt._typ == 311 /* v.ast.ForCStmt */) { (*stmt._v__ast__ForCStmt).label = name; v__ast__Stmt _t9 = v__ast__ForCStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForCStmt)); return _t9; @@ -92013,10 +90086,10 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } else if (p->tok.kind == (v__token__Kind__number)) { v__ast__Expr number_lit = v__parser__Parser_parse_number_literal(p); - if (number_lit._typ == 266 /* v.ast.FloatLiteral */) { + if (number_lit._typ == 268 /* v.ast.FloatLiteral */) { array_push((array*)&args, _MOV((v__ast__AsmArg[]){ v__ast__FloatLiteral_to_sumtype_v__ast__AsmArg(ADDR(v__ast__FloatLiteral, (((v__ast__FloatLiteral){(*number_lit._v__ast__FloatLiteral).val,(*number_lit._v__ast__FloatLiteral).pos,})))) })); } - else if (number_lit._typ == 273 /* v.ast.IntegerLiteral */) { + else if (number_lit._typ == 275 /* v.ast.IntegerLiteral */) { if (is_directive) { array_push((array*)&args, _MOV((v__ast__AsmArg[]){ v__ast__AsmDisp_to_sumtype_v__ast__AsmArg(ADDR(v__ast__AsmDisp, (((v__ast__AsmDisp){.val = (*number_lit._v__ast__IntegerLiteral).val,.pos = (*number_lit._v__ast__IntegerLiteral).pos,})))) })); } else { @@ -92071,7 +90144,7 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; if (is_directive && (string__eq(name, _SLIT("globl")) || string__eq(name, _SLIT("global")))) { for (int _t12 = 0; _t12 < args.len; ++_t12) { v__ast__AsmArg arg = ((v__ast__AsmArg*)args.data)[_t12]; - array_push((array*)&p->global_labels, _MOV((string[]){ string_clone((/* as */ *(v__ast__AsmAlias*)__as_cast((arg)._v__ast__AsmAlias,(arg)._typ, 399) /*expected idx: 399, name: v.ast.AsmAlias */ ).name) })); + array_push((array*)&p->global_labels, _MOV((string[]){ string_clone((/* as */ *(v__ast__AsmAlias*)__as_cast((arg)._v__ast__AsmAlias,(arg)._typ, 401) /*expected idx: 401, name: v.ast.AsmAlias */ ).name) })); } } array_push((array*)&templates, _MOV((v__ast__AsmTemplate[]){ ((v__ast__AsmTemplate){ @@ -92173,7 +90246,7 @@ VV_LOCAL_SYMBOL v__ast__AsmArg v__parser__Parser_reg_or_alias(v__parser__Parser* } if (_IN_MAP(ADDR(string, p->prev_tok.lit), ADDR(map, p->scope->objects))) { v__ast__ScopeObject x = (*(v__ast__ScopeObject*)map_get(ADDR(map, p->scope->objects), &(string[]){p->prev_tok.lit}, &(v__ast__ScopeObject[]){ {0} })); - if ((x)._typ == 323 /* v.ast.AsmRegister */) { + if ((x)._typ == 325 /* v.ast.AsmRegister */) { v__ast__AsmArg _t1 = v__ast__AsmRegister_to_sumtype_v__ast__AsmArg(ADDR(v__ast__AsmRegister, ((*x._v__ast__AsmRegister)))); return _t1; } else { @@ -92347,7 +90420,7 @@ VV_LOCAL_SYMBOL Array_v__ast__AsmIO v__parser__Parser_asm_ios(v__parser__Parser* } } v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 283 /* v.ast.ParExpr */) { + if ((expr)._typ == 285 /* v.ast.ParExpr */) { expr = (*expr._v__ast__ParExpr).expr; } else { v__parser__Parser_error(p, _SLIT("asm in/output must be enclosed in brackets")); @@ -92357,7 +90430,7 @@ VV_LOCAL_SYMBOL Array_v__ast__AsmIO v__parser__Parser_asm_ios(v__parser__Parser* v__parser__Parser_next(p); alias = p->tok.lit; v__parser__Parser_check(p, v__token__Kind__name); - } else if ((expr)._typ == 268 /* v.ast.Ident */) { + } else if ((expr)._typ == 270 /* v.ast.Ident */) { alias = (*expr._v__ast__Ident).name; } Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); @@ -92380,7 +90453,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Expr_Array_v__ast__Comment v__parser_ Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); for (;;) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 258 /* v.ast.Comment */) { + if ((expr)._typ == 260 /* v.ast.Comment */) { array_push((array*)&comments, _MOV((v__ast__Comment[]){ (*expr._v__ast__Comment) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); @@ -92478,7 +90551,7 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) p->comptime_if_cond = false; p->inside_if_expr = false; p->inside_ct_if_expr = false; - if ((comptime_cond)._typ == 284 /* v.ast.PostfixExpr */) { + if ((comptime_cond)._typ == 286 /* v.ast.PostfixExpr */) { comptime_cond_opt = true; } name = v__ast__Expr_str(comptime_cond); @@ -92692,9 +90765,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_48309 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_48309.arg0; - Array_v__ast__Comment left_comments = mr_48309.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48447 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_48447.arg0; + Array_v__ast__Comment left_comments = mr_48447.arg1; if (!(p->inside_defer && p->tok.kind == v__token__Kind__decl_assign)) { _PUSH_MANY(&defer_vars, (p->defer_vars), _t1, Array_v__ast__Ident); } @@ -92710,8 +90783,8 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr node = ((v__ast__Expr*)left.data)[_t4]; - if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 254 /* v.ast.CallExpr */ && (node)._typ != 284 /* v.ast.PostfixExpr */ && (node)._typ != 259 /* v.ast.ComptimeCall */ && (node)._typ != 288 /* v.ast.SelectorExpr */ && (node)._typ != 263 /* v.ast.DumpExpr */) { - bool is_complex_infix_expr = (node)._typ == 272 /* v.ast.InfixExpr */ && ((/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ).op == v__token__Kind__left_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ).op == v__token__Kind__right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ).op == v__token__Kind__unsigned_right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 272) /*expected idx: 272, name: v.ast.InfixExpr */ ).op == v__token__Kind__arrow); + if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 256 /* v.ast.CallExpr */ && (node)._typ != 286 /* v.ast.PostfixExpr */ && (node)._typ != 261 /* v.ast.ComptimeCall */ && (node)._typ != 290 /* v.ast.SelectorExpr */ && (node)._typ != 265 /* v.ast.DumpExpr */) { + bool is_complex_infix_expr = (node)._typ == 274 /* v.ast.InfixExpr */ && ((/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ).op == v__token__Kind__left_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ).op == v__token__Kind__right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ).op == v__token__Kind__unsigned_right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 274) /*expected idx: 274, name: v.ast.InfixExpr */ ).op == v__token__Kind__arrow); if (!is_complex_infix_expr) { v__ast__Stmt _t5 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("expression evaluated but not used"), v__ast__Expr_pos(node))))); return _t5; @@ -93412,11 +91485,11 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ bool is_mut = false; v__token__Pos mut_pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); if (p->inside_match || p->inside_if_expr || p->inside_for) { - if (left._typ == 268 /* v.ast.Ident */) { + if (left._typ == 270 /* v.ast.Ident */) { is_mut = (*left._v__ast__Ident).is_mut; mut_pos = (*left._v__ast__Ident).mut_pos; } - else if (left._typ == 288 /* v.ast.SelectorExpr */) { + else if (left._typ == 290 /* v.ast.SelectorExpr */) { is_mut = (*left._v__ast__SelectorExpr).is_mut; mut_pos = (*left._v__ast__SelectorExpr).mut_pos; } @@ -93977,9 +92050,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_85049 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_85049.arg0; - Array_v__ast__Comment comments2 = mr_85049.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_85187 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_85187.arg0; + Array_v__ast__Comment comments2 = mr_85187.arg1; _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)),}); @@ -94042,40 +92115,40 @@ VV_LOCAL_SYMBOL v__ast__GlobalDecl v__parser__Parser_global_decl(v__parser__Pars if (has_expr) { v__parser__Parser_next(p); expr = v__parser__Parser_expr(p, 0); - if (expr._typ == 255 /* v.ast.CastExpr */) { + if (expr._typ == 257 /* v.ast.CastExpr */) { typ = (*expr._v__ast__CastExpr).typ; } - else if (expr._typ == 293 /* v.ast.StructInit */) { + else if (expr._typ == 295 /* v.ast.StructInit */) { typ = (*expr._v__ast__StructInit).typ; } - else if (expr._typ == 248 /* v.ast.ArrayInit */) { + else if (expr._typ == 250 /* v.ast.ArrayInit */) { typ = (*expr._v__ast__ArrayInit).typ; } - else if (expr._typ == 256 /* v.ast.ChanInit */) { + else if (expr._typ == 258 /* v.ast.ChanInit */) { typ = (*expr._v__ast__ChanInit).typ; } - else if (expr._typ == 252 /* v.ast.BoolLiteral */) { + else if (expr._typ == 254 /* v.ast.BoolLiteral */) { typ = _const_v__ast__bool_type; } - else if (expr._typ == 274 /* v.ast.IsRefType */) { + else if (expr._typ == 276 /* v.ast.IsRefType */) { typ = _const_v__ast__bool_type; } - else if (expr._typ == 257 /* v.ast.CharLiteral */) { + else if (expr._typ == 259 /* v.ast.CharLiteral */) { typ = _const_v__ast__char_type; } - else if (expr._typ == 266 /* v.ast.FloatLiteral */) { + else if (expr._typ == 268 /* v.ast.FloatLiteral */) { typ = _const_v__ast__f64_type; } - else if (expr._typ == 273 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 275 /* v.ast.IntegerLiteral */) { typ = _const_v__ast__int_type; } - else if (expr._typ == 289 /* v.ast.SizeOf */) { + else if (expr._typ == 291 /* v.ast.SizeOf */) { typ = _const_v__ast__int_type; } - else if (expr._typ == 292 /* v.ast.StringLiteral */) { + else if (expr._typ == 294 /* v.ast.StringLiteral */) { typ = _const_v__ast__string_type; } - else if (expr._typ == 291 /* v.ast.StringInterLiteral */) { + else if (expr._typ == 293 /* v.ast.StringInterLiteral */) { typ = _const_v__ast__string_type; } @@ -94249,8 +92322,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t3; } Array_v__ast__TypeNode sum_variants = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); - multi_return_Array_v__ast__Type_Array_string mr_91545 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_91545.arg0; + multi_return_Array_v__ast__Type_Array_string mr_91683 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_91683.arg0; 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); @@ -94467,12 +92540,12 @@ bool v__parser__Parser_mark_var_as_used(v__parser__Parser* p, string varname) { _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(p->scope, varname), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 326 /* v.ast.Var */) { + if (obj._typ == 328 /* v.ast.Var */) { (*obj._v__ast__Var).is_used = true; bool _t2 = true; return _t2; } - else if (obj._typ == 325 /* v.ast.GlobalField */) { + else if (obj._typ == 327 /* v.ast.GlobalField */) { bool _t3 = true; return _t3; } @@ -94509,7 +92582,7 @@ bool v__parser__Parser_unsafe_stmt_defer_0 = false; v__parser__Parser_unsafe_stmt_defer_0 = true; v__ast__Stmt stmt = v__parser__Parser_stmt(p, false); if (p->tok.kind == v__token__Kind__rcbr) { - if ((stmt)._typ == 308 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 310 /* v.ast.ExprStmt */) { if (v__ast__Expr_is_expr((*stmt._v__ast__ExprStmt).expr)) { v__parser__Parser_next(p); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); @@ -94587,13 +92660,13 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_sql_expr(v__parser__Parser* p) { if (has_where) { v__parser__Parser_next(p); where_expr = v__parser__Parser_expr(p, 0); - if (!is_count && (where_expr)._typ == 272 /* v.ast.InfixExpr */) { - if ((*where_expr._v__ast__InfixExpr).op == v__token__Kind__eq && ((*where_expr._v__ast__InfixExpr).left)._typ == 268 /* v.ast.Ident */) { + if (!is_count && (where_expr)._typ == 274 /* v.ast.InfixExpr */) { + if ((*where_expr._v__ast__InfixExpr).op == v__token__Kind__eq && ((*where_expr._v__ast__InfixExpr).left)._typ == 270 /* v.ast.Ident */) { if (string__eq((*(*where_expr._v__ast__InfixExpr).left._v__ast__Ident).name, _SLIT("id"))) { query_one = true; } } - if (((*where_expr._v__ast__InfixExpr).right)._typ == 268 /* v.ast.Ident */) { + if (((*where_expr._v__ast__InfixExpr).right)._typ == 270 /* v.ast.Ident */) { if (!v__ast__Scope_known_var(p->scope, (*(*where_expr._v__ast__InfixExpr).right._v__ast__Ident).name)) { _option_void _t2 = v__parser__Parser_check_undefined_variables(p, new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){(*where_expr._v__ast__InfixExpr).left})), (*where_expr._v__ast__InfixExpr).right); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { @@ -94741,7 +92814,7 @@ VV_LOCAL_SYMBOL v__ast__SqlStmtLine v__parser__Parser_parse_sql_stmt_line(v__par table_type = v__parser__Parser_parse_type(p); } else if (kind == v__ast__SqlStmtKind__insert) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 268 /* v.ast.Ident */) { + if ((expr)._typ == 270 /* v.ast.Ident */) { inserted_var_name = (*expr._v__ast__Ident).name; } else { v__parser__Parser_error(p, _SLIT("can only insert variables")); @@ -94869,8 +92942,8 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } v__ast__Table_start_parsing_type(p->table, v__parser__Parser_prepend_mod(p, name)); v__parser__Parser_struct_decl_defer_0 = true; - multi_return_Array_v__ast__Type_Array_string mr_1623 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_1623.arg0; + multi_return_Array_v__ast__Type_Array_string mr_1529 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_1529.arg0; 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 }}}))); @@ -95134,7 +93207,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; if (p->tok.kind == v__token__Kind__assign) { v__parser__Parser_next(p); default_expr = v__parser__Parser_expr(p, 0); - if (default_expr._typ == 265 /* v.ast.EnumVal */) { + if (default_expr._typ == 267 /* v.ast.EnumVal */) { (*default_expr._v__ast__EnumVal).typ = typ; } @@ -95223,8 +93296,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; // Defer end return _t27; } - int ret = 0; - ret = v__ast__Table_register_sym(p->table, t); + int ret = v__ast__Table_register_sym(p->table, t); if (ret == -1 && language != v__ast__Language__c) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); v__ast__StructDecl _t28 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); @@ -95382,8 +93454,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13271 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13271.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13120 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13120.arg0; 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))) { @@ -95412,7 +93484,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } v__ast__Type typ = v__ast__new_type(reg_idx); v__ast__TypeSymbol* ts = v__ast__Table_sym(p->table, typ); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 436) /*expected idx: 436, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 438) /*expected idx: 438, name: v.ast.Interface */ ; 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); @@ -95478,9 +93550,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t8; } - multi_return_Array_v__ast__Param_bool_bool mr_16407 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16407.arg0; - bool is_variadic = mr_16407.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16256 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16256.arg0; + bool is_variadic = mr_16256.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ @@ -95995,7 +94067,7 @@ VV_LOCAL_SYMBOL _option_void v__callgraph__Mapper_visit(v__callgraph__Mapper* m, if (node->_typ == 176 /* v.ast.File */) { m->file = &(*node->_v__ast__File); } - else if (node->_typ == 322 /* v.ast.Stmt */) { + else if (node->_typ == 324 /* v.ast.Stmt */) { if ((*node->_v__ast__Stmt)._typ == 185 /* v.ast.FnDecl */) { m->is_caller_used = true; if (m->pref->skip_unused) { @@ -96013,8 +94085,8 @@ VV_LOCAL_SYMBOL _option_void v__callgraph__Mapper_visit(v__callgraph__Mapper* m, } ; } - else if (node->_typ == 297 /* v.ast.Expr */) { - if ((*node->_v__ast__Expr)._typ == 254 /* v.ast.CallExpr */) { + else if (node->_typ == 299 /* v.ast.Expr */) { + if ((*node->_v__ast__Expr)._typ == 256 /* v.ast.CallExpr */) { if (m->is_caller_used) { string dot_called_name = v__callgraph__Mapper_dot_fn_name(m, (*(*node->_v__ast__Expr)._v__ast__CallExpr).name, (*(*node->_v__ast__Expr)._v__ast__CallExpr).receiver_type, (*(*node->_v__ast__Expr)._v__ast__CallExpr).is_method); v__dotgraph__DotGraph_new_edge(&m->dg, m->dot_caller_name, dot_called_name, ((v__dotgraph__NewEdgeConfig){.should_highlight = string__eq(m->caller_name, _SLIT("main.main")),.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); @@ -96129,7 +94201,7 @@ _option_void v__builder__Builder_front_and_middle_stages(v__builder__Builder* b, _option_void _t1 = v__builder__Builder_front_stages(b, v_files); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -96137,7 +94209,7 @@ _option_void v__builder__Builder_front_and_middle_stages(v__builder__Builder* b, _option_void _t3 = v__builder__Builder_middle_stages(b); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -96218,6 +94290,19 @@ bool v__builder__Builder_parse_imports_defer_0 = false; _v_exit(0); VUNREACHABLE(); } + if ((b->pref->dump_files).len != 0) { + Array_string _t19 = {0}; + Array_v__ast__File_ptr _t19_orig = b->parsed_files; + int _t19_len = _t19_orig.len; + _t19 = __new_array(0, _t19_len, sizeof(string)); + + for (int _t20 = 0; _t20 < _t19_len; ++_t20) { + v__ast__File* it = ((v__ast__File**) _t19_orig.data)[_t20]; + string ti = it->path; + array_push((array*)&_t19, &ti); + } + v__builder__Builder_dump_files(b,_t19); + } v__builder__Builder_rebuild_modules(b); // Defer begin if (v__builder__Builder_parse_imports_defer_0) { @@ -96250,6 +94335,7 @@ bool v__builder__Builder_resolve_deps_defer_0 = false; v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)deps_resolved->nodes.data)[_t1]; array_push((array*)&mods, _MOV((string[]){ string_clone(node.name) })); } + v__builder__Builder_dump_modules(b, mods); if (b->pref->is_verbose) { eprintln(_SLIT("------ imported modules: ------")); eprintln(Array_string_str(mods)); @@ -96283,7 +94369,7 @@ v__depgraph__DepGraph* v__builder__Builder_import_graph(v__builder__Builder* b) if (!Array_string_contains(builtins, p->mod.name)) { array_push((array*)&deps, _MOV((string[]){ string_clone(_SLIT("builtin")) })); if (b->pref->backend == v__pref__Backend__c) { - if (b->pref->is_vsh && !(string__eq(p->mod.name, _SLIT("os")) || string__eq(p->mod.name, _SLIT("dl")))) { + if (b->pref->is_vsh && !(string__eq(p->mod.name, _SLIT("os")) || string__eq(p->mod.name, _SLIT("dl")) || string__eq(p->mod.name, _SLIT("strings.textscanner")))) { array_push((array*)&deps, _MOV((string[]){ string_clone(_SLIT("os")) })); } } @@ -96547,14 +94633,16 @@ bool v__builder__Builder_print_warnings_and_errors_defer_0 = false; for (int _t11 = 0; _t11 < b->table->redefined_fns.len; ++_t11) { string fn_name = ((string*)b->table->redefined_fns.data)[_t11]; Array_v__builder__FunctionRedefinition redefines = __new_array_with_default(0, 0, sizeof(v__builder__FunctionRedefinition), 0); - Map_string_int redefine_conflicts = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int redefine_conflicts = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t12 = 0; _t12 < b->parsed_files.len; ++_t12) { v__ast__File* file = ((v__ast__File**)b->parsed_files.data)[_t12]; for (int _t13 = 0; _t13 < file->stmts.len; ++_t13) { v__ast__Stmt stmt = ((v__ast__Stmt*)file->stmts.data)[_t13]; if ((stmt)._typ == 185 /* v.ast.FnDecl */) { if (string__eq((*stmt._v__ast__FnDecl).name, fn_name)) { - string fheader = v__ast__FnDecl_stringify(&(*stmt._v__ast__FnDecl), b->table, _SLIT("main"), new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string fheader = v__ast__FnDecl_stringify(&(*stmt._v__ast__FnDecl), b->table, _SLIT("main"), new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); array_push((array*)&redefines, _MOV((v__builder__FunctionRedefinition[]){ ((v__builder__FunctionRedefinition){.fpath = file->path,.fline = (*stmt._v__ast__FnDecl).pos.line_nr,.fheader = fheader,.f = (*stmt._v__ast__FnDecl),}) })); (*(int*)map_get_and_set((map*)&redefine_conflicts, &(string[]){fheader}, &(int[]){ 0 }))++; } @@ -96991,36 +95079,6 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_output_name(v__builder__Builder* array_push((array*)&v->ccoptions.o_args, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-o \""), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); } -VV_LOCAL_SYMBOL void v__builder__Builder_dump_c_options(v__builder__Builder* v, Array_string all_args) { - if ((v->pref->dump_c_flags).len != 0) { - Array_string _t1 = {0}; - Array_string _t1_orig = all_args; - 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]; - if ((it).len != 0) { - array_push((array*)&_t1, &it); - } - } - string non_empty_args = string__plus(Array_string_join(_t1, _SLIT("\n")), _SLIT("\n")); - if (string__eq(v->pref->dump_c_flags, _SLIT("-"))) { - print(non_empty_args); - } else { - _option_void _t3 = os__write_file(v->pref->dump_c_flags, non_empty_args); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - } - } -} - void v__builder__Builder_cc(v__builder__Builder* v) { if (string_contains(os__executable(), _SLIT("vfmt"))) { return; @@ -97320,10 +95378,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_23274 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_23274.arg0; - Array_string others = mr_23274.arg1; - Array_string libs = mr_23274.arg2; + multi_return_Array_string_Array_string_Array_string mr_22971 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_22971.arg0; + Array_string others = mr_22971.arg1; + Array_string libs = mr_22971.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")) })); @@ -98031,6 +96089,48 @@ Array_string v__builder__Builder_get_user_files(v__builder__Builder* v) { return _t15; } +void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all_args) { + v__builder__dump_list(b->pref->dump_c_flags, all_args); +} + +void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods) { + v__builder__dump_list(b->pref->dump_modules, mods); +} + +void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files) { + v__builder__dump_list(b->pref->dump_files, files); +} + +VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list) { + if ((file_path).len != 0) { + Array_string _t1 = {0}; + Array_string _t1_orig = list; + 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]; + if ((it).len != 0) { + array_push((array*)&_t1, &it); + } + } + string content = string__plus(Array_string_join(_t1, _SLIT("\n")), _SLIT("\n")); + if (string__eq(file_path, _SLIT("-"))) { + print(content); + } else { + _option_void _t3 = os__write_file(file_path, content); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + } + } +} + // TypeDecl VV_LOCAL_SYMBOL _option_string v__builder__find_windows_kit_internal(v__builder__RegKey key, Array_string versions) { #if defined(_WIN32) @@ -98131,7 +96231,7 @@ VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__new_windows_kit(strin _option_Array_string _t1 = os__ls(kit_lib); if (_t1.state != 0) { /*or block*/ _option_v__builder__WindowsKit _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -98341,20 +96441,15 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { Array_string lib_paths = sflags.lib_paths; Array_string defines = sflags.defines; Array_string other_flags = sflags.other_flags; - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.ucrt_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.vs_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.um_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.shared_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - _PUSH_MANY(&a, (defines), _t17, Array_string); - _PUSH_MANY(&a, (inc_paths), _t18, Array_string); - _PUSH_MANY(&a, (other_flags), _t19, Array_string); + _PUSH_MANY(&a, (v__builder__MsvcResult_include_paths(&r)), _t13, Array_string); + _PUSH_MANY(&a, (defines), _t14, Array_string); + _PUSH_MANY(&a, (inc_paths), _t15, Array_string); + _PUSH_MANY(&a, (other_flags), _t16, Array_string); array_push((array*)&a, _MOV((string[]){ string_clone(Array_string_join(real_libs, _SLIT(" "))) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/link")) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/NOLOGO")) })); array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/OUT:\""), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.ucrt_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.um_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.vs_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + _PUSH_MANY(&a, (v__builder__MsvcResult_library_paths(&r)), _t21, Array_string); if (!string_contains(all_cflags, _SLIT("/DEBUG"))) { array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/DEBUG:FULL")) })); } @@ -98363,15 +96458,16 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/OPT:REF")) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/OPT:ICF")) })); } - _PUSH_MANY(&a, (lib_paths), _t31, Array_string); + _PUSH_MANY(&a, (lib_paths), _t26, Array_string); string env_ldflags = os__getenv(_SLIT("LDFLAGS")); if ((env_ldflags).len != 0) { array_push((array*)&a, _MOV((string[]){ string_clone(env_ldflags) })); } + v__builder__Builder_dump_c_options(v, a); string args = Array_string_join(a, _SLIT(" ")); - _option_void _t33 = os__write_file(out_name_cmd_line, args); - if (_t33.state != 0 && _t33.err._typ != _IError_None___index) { - IError err = _t33.err; + _option_void _t28 = os__write_file(out_name_cmd_line, args); + if (_t28.state != 0 && _t28.err._typ != _IError_None___index) { + IError err = _t28.err; v__builder__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unable to write response file to \""), /*115 &string*/0xfe10, {.d_s = out_name_cmd_line}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); VUNREACHABLE(); ; @@ -98397,9 +96493,9 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { } else { v__builder__Builder_post_process_c_compiler_output(v, res); } - _option_void _t34 = os__rm(out_name_obj); - if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { - IError err = _t34.err; + _option_void _t29 = os__rm(out_name_obj); + if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { + IError err = _t29.err; } ; @@ -98422,13 +96518,14 @@ VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__ v__builder__MsvcStringFlags flags = v__builder__msvc_string_flags(moduleflags); string inc_dirs = Array_string_join(flags.inc_paths, _SLIT(" ")); string defines = Array_string_join(flags.defines, _SLIT(" ")); - string include_string = str_intp(6, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = msvc.ucrt_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.vs_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.um_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.shared_include_path}}, {_SLIT("\" "), /*115 &string*/0xfe10, {.d_s = inc_dirs}}, {_SLIT0, 0, { .d_c = 0 }}})); Array_string oargs = __new_array_with_default(0, 0, sizeof(string), 0); string env_cflags = os__getenv(_SLIT("CFLAGS")); string all_cflags = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_cflags}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v->pref->cflags}}, {_SLIT0, 0, { .d_c = 0 }}})); if (!string__eq(all_cflags, _SLIT(" "))) { array_push((array*)&oargs, _MOV((string[]){ string_clone(all_cflags) })); } + array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/NOLOGO")) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/volatile:ms")) })); if (v->pref->is_prod) { array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/O2")) })); array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/MD")) })); @@ -98437,12 +96534,18 @@ VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__ array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/MDd")) })); array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/D_DEBUG")) })); } + array_push((array*)&oargs, _MOV((string[]){ string_clone(defines) })); + _PUSH_MANY(&oargs, (v__builder__MsvcResult_include_paths(&msvc)), _t10, Array_string); + array_push((array*)&oargs, _MOV((string[]){ string_clone(inc_dirs) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/c \""), /*115 &string*/0xfe10, {.d_s = cfile}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/Fo\""), /*115 &string*/0xfe10, {.d_s = obj_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); string env_ldflags = os__getenv(_SLIT("LDFLAGS")); if ((env_ldflags).len != 0) { array_push((array*)&oargs, _MOV((string[]){ string_clone(env_ldflags) })); } + v__builder__Builder_dump_c_options(v, oargs); string str_oargs = Array_string_join(oargs, _SLIT(" ")); - string cmd = str_intp(7, _MOV((StrIntpData[]){{_SLIT("\""), /*115 &string*/0xfe10, {.d_s = msvc.full_cl_exe_path}}, {_SLIT("\" /volatile:ms "), /*115 &string*/0xfe10, {.d_s = str_oargs}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = defines}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = include_string}}, {_SLIT(" /c \""), /*115 &string*/0xfe10, {.d_s = cfile}}, {_SLIT("\" /Fo\""), /*115 &string*/0xfe10, {.d_s = obj_path}}, {_SLIT("\""), 0, { .d_c = 0 }}})); + string cmd = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\""), /*115 &string*/0xfe10, {.d_s = msvc.full_cl_exe_path}}, {_SLIT("\" "), /*115 &string*/0xfe10, {.d_s = str_oargs}}, {_SLIT0, 0, { .d_c = 0 }}})); #if defined(CUSTOM_DEFINE_trace_thirdparty_obj_files) { println( str_intp(2, _MOV((StrIntpData[]){{_SLIT(">>> build_thirdparty_obj_file_with_msvc cmd: "), /*115 &string*/0xfe10, {.d_s = cmd}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -98490,19 +96593,54 @@ v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag Array_string lpaths = __new_array_with_default(0, 0, sizeof(string), 0); for (int _t10 = 0; _t10 < lib_paths.len; ++_t10) { string l = ((string*)lib_paths.data)[_t10]; - array_push((array*)&lpaths, _MOV((string[]){ string_clone(string__plus(string__plus(_SLIT("/LIBPATH:\""), os__real_path(l)), _SLIT("\""))) })); + array_push((array*)&lpaths, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = os__real_path(l)}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); } v__builder__MsvcStringFlags _t12 = ((v__builder__MsvcStringFlags){.real_libs = real_libs,.inc_paths = inc_paths,.lib_paths = lpaths,.defines = defines,.other_flags = other_flags,}); return _t12; } +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r) { + Array_string res = __new_array_with_default(0, 4, sizeof(string), 0); + if ((r->ucrt_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->ucrt_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->vs_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->vs_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->um_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->um_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->shared_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->shared_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + Array_string _t5 = res; + return _t5; +} + +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r) { + Array_string res = __new_array_with_default(0, 3, sizeof(string), 0); + if ((r->ucrt_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->ucrt_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->um_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->um_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->vs_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->vs_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + Array_string _t4 = res; + return _t4; +} + void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (!b->pref->use_cache || b->pref->build_mode == v__pref__BuildMode__build_module) { return; } v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); - Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; strings__Builder sb_new_hashes = strings__new_builder(1024); Array_string _t1 = {0}; Array_v__ast__File_ptr _t1_orig = b->parsed_files; @@ -98576,7 +96714,8 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { string k = /*key*/ *(string*)DenseArray_key(&_t8.key_values, _t9); k = string_clone(k); Array_string v = (*(Array_string*)DenseArray_value(&_t8.key_values, _t9)); - Map_string_bool m = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_bool m = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; Array_string _t12 = (*(Array_string*)map_get(ADDR(map, b->mod_invalidates_mods), &(string[]){k}, &(Array_string[]){ __new_array(0, 0, sizeof(string)) })); for (int _t13 = 0; _t13 < _t12.len; ++_t13) { string mm = ((string*)_t12.data)[_t13]; @@ -98590,8 +96729,10 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { } } #endif - Map_string_int invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t16 = new_hashes.key_values.len; for (int _t15 = 0; _t15 < _t16; ++_t15 ) { int _t17 = new_hashes.key_values.len - _t16; @@ -98646,7 +96787,8 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { eprintln( str_intp(3, _MOV((StrIntpData[]){{_SLIT("> cycle: "), /*100 &int*/0xfe07, {.d_i32 = cycle}}, {_SLIT(" | invalidated_paths: "), /*115 &map[string]int*/0xfe10, {.d_s = Map_string_int_str(invalidated_paths)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } #endif - Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t22 = invalidated_paths.key_values.len; for (int _t21 = 0; _t21 < _t22; ++_t21 ) { int _t23 = invalidated_paths.key_values.len - _t22; @@ -98694,7 +96836,8 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { invalidated_paths = map_clone(&new_invalidated_paths); } if (rebuild_everything) { - invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t28 = new_hashes.key_values.len; for (int _t27 = 0; _t27 < _t28; ++_t27 ) { int _t29 = new_hashes.key_values.len - _t28; @@ -99105,106 +97248,106 @@ void _vinit(int ___argc, voidptr ___argv) { #endif as_cast_type_indexes = new_array_from_c_array(102, 102, sizeof(VCastTypeIndexName), _MOV((VCastTypeIndexName[102]){ (VCastTypeIndexName){.tindex = 0, .tname = _SLIT("unknown")} - , (VCastTypeIndexName){.tindex = 431, .tname = _SLIT("v.ast.Aggregate")} - , (VCastTypeIndexName){.tindex = 433, .tname = _SLIT("v.ast.Alias")} - , (VCastTypeIndexName){.tindex = 413, .tname = _SLIT("v.ast.Array")} - , (VCastTypeIndexName){.tindex = 441, .tname = _SLIT("v.ast.ArrayFixed")} - , (VCastTypeIndexName){.tindex = 442, .tname = _SLIT("v.ast.Chan")} - , (VCastTypeIndexName){.tindex = 447, .tname = _SLIT("v.ast.Enum")} - , (VCastTypeIndexName){.tindex = 445, .tname = _SLIT("v.ast.FnType")} - , (VCastTypeIndexName){.tindex = 446, .tname = _SLIT("v.ast.GenericInst")} - , (VCastTypeIndexName){.tindex = 436, .tname = _SLIT("v.ast.Interface")} - , (VCastTypeIndexName){.tindex = 414, .tname = _SLIT("v.ast.Map")} - , (VCastTypeIndexName){.tindex = 444, .tname = _SLIT("v.ast.MultiReturn")} - , (VCastTypeIndexName){.tindex = 418, .tname = _SLIT("v.ast.Struct")} - , (VCastTypeIndexName){.tindex = 437, .tname = _SLIT("v.ast.SumType")} - , (VCastTypeIndexName){.tindex = 443, .tname = _SLIT("v.ast.Thread")} - , (VCastTypeIndexName){.tindex = 377, .tname = _SLIT("v.ast.IdentFn")} - , (VCastTypeIndexName){.tindex = 378, .tname = _SLIT("v.ast.IdentVar")} - , (VCastTypeIndexName){.tindex = 246, .tname = _SLIT("v.ast.AnonFn")} - , (VCastTypeIndexName){.tindex = 247, .tname = _SLIT("v.ast.ArrayDecompose")} - , (VCastTypeIndexName){.tindex = 248, .tname = _SLIT("v.ast.ArrayInit")} - , (VCastTypeIndexName){.tindex = 249, .tname = _SLIT("v.ast.AsCast")} - , (VCastTypeIndexName){.tindex = 250, .tname = _SLIT("v.ast.Assoc")} - , (VCastTypeIndexName){.tindex = 251, .tname = _SLIT("v.ast.AtExpr")} - , (VCastTypeIndexName){.tindex = 252, .tname = _SLIT("v.ast.BoolLiteral")} - , (VCastTypeIndexName){.tindex = 253, .tname = _SLIT("v.ast.CTempVar")} - , (VCastTypeIndexName){.tindex = 254, .tname = _SLIT("v.ast.CallExpr")} - , (VCastTypeIndexName){.tindex = 255, .tname = _SLIT("v.ast.CastExpr")} - , (VCastTypeIndexName){.tindex = 256, .tname = _SLIT("v.ast.ChanInit")} - , (VCastTypeIndexName){.tindex = 257, .tname = _SLIT("v.ast.CharLiteral")} - , (VCastTypeIndexName){.tindex = 258, .tname = _SLIT("v.ast.Comment")} - , (VCastTypeIndexName){.tindex = 259, .tname = _SLIT("v.ast.ComptimeCall")} - , (VCastTypeIndexName){.tindex = 260, .tname = _SLIT("v.ast.ComptimeSelector")} - , (VCastTypeIndexName){.tindex = 261, .tname = _SLIT("v.ast.ComptimeType")} - , (VCastTypeIndexName){.tindex = 262, .tname = _SLIT("v.ast.ConcatExpr")} - , (VCastTypeIndexName){.tindex = 263, .tname = _SLIT("v.ast.DumpExpr")} - , (VCastTypeIndexName){.tindex = 264, .tname = _SLIT("v.ast.EmptyExpr")} - , (VCastTypeIndexName){.tindex = 265, .tname = _SLIT("v.ast.EnumVal")} - , (VCastTypeIndexName){.tindex = 266, .tname = _SLIT("v.ast.FloatLiteral")} - , (VCastTypeIndexName){.tindex = 267, .tname = _SLIT("v.ast.GoExpr")} - , (VCastTypeIndexName){.tindex = 268, .tname = _SLIT("v.ast.Ident")} - , (VCastTypeIndexName){.tindex = 269, .tname = _SLIT("v.ast.IfExpr")} - , (VCastTypeIndexName){.tindex = 270, .tname = _SLIT("v.ast.IfGuardExpr")} - , (VCastTypeIndexName){.tindex = 271, .tname = _SLIT("v.ast.IndexExpr")} - , (VCastTypeIndexName){.tindex = 272, .tname = _SLIT("v.ast.InfixExpr")} - , (VCastTypeIndexName){.tindex = 273, .tname = _SLIT("v.ast.IntegerLiteral")} - , (VCastTypeIndexName){.tindex = 274, .tname = _SLIT("v.ast.IsRefType")} - , (VCastTypeIndexName){.tindex = 275, .tname = _SLIT("v.ast.Likely")} - , (VCastTypeIndexName){.tindex = 276, .tname = _SLIT("v.ast.LockExpr")} - , (VCastTypeIndexName){.tindex = 277, .tname = _SLIT("v.ast.MapInit")} - , (VCastTypeIndexName){.tindex = 278, .tname = _SLIT("v.ast.MatchExpr")} - , (VCastTypeIndexName){.tindex = 279, .tname = _SLIT("v.ast.NodeError")} - , (VCastTypeIndexName){.tindex = 280, .tname = _SLIT("v.ast.None")} - , (VCastTypeIndexName){.tindex = 281, .tname = _SLIT("v.ast.OffsetOf")} - , (VCastTypeIndexName){.tindex = 282, .tname = _SLIT("v.ast.OrExpr")} - , (VCastTypeIndexName){.tindex = 283, .tname = _SLIT("v.ast.ParExpr")} - , (VCastTypeIndexName){.tindex = 284, .tname = _SLIT("v.ast.PostfixExpr")} - , (VCastTypeIndexName){.tindex = 285, .tname = _SLIT("v.ast.PrefixExpr")} - , (VCastTypeIndexName){.tindex = 286, .tname = _SLIT("v.ast.RangeExpr")} - , (VCastTypeIndexName){.tindex = 287, .tname = _SLIT("v.ast.SelectExpr")} - , (VCastTypeIndexName){.tindex = 288, .tname = _SLIT("v.ast.SelectorExpr")} - , (VCastTypeIndexName){.tindex = 289, .tname = _SLIT("v.ast.SizeOf")} - , (VCastTypeIndexName){.tindex = 290, .tname = _SLIT("v.ast.SqlExpr")} - , (VCastTypeIndexName){.tindex = 291, .tname = _SLIT("v.ast.StringInterLiteral")} - , (VCastTypeIndexName){.tindex = 292, .tname = _SLIT("v.ast.StringLiteral")} - , (VCastTypeIndexName){.tindex = 293, .tname = _SLIT("v.ast.StructInit")} - , (VCastTypeIndexName){.tindex = 294, .tname = _SLIT("v.ast.TypeNode")} - , (VCastTypeIndexName){.tindex = 295, .tname = _SLIT("v.ast.TypeOf")} - , (VCastTypeIndexName){.tindex = 296, .tname = _SLIT("v.ast.UnsafeExpr")} - , (VCastTypeIndexName){.tindex = 323, .tname = _SLIT("v.ast.AsmRegister")} - , (VCastTypeIndexName){.tindex = 324, .tname = _SLIT("v.ast.ConstField")} - , (VCastTypeIndexName){.tindex = 325, .tname = _SLIT("v.ast.GlobalField")} - , (VCastTypeIndexName){.tindex = 326, .tname = _SLIT("v.ast.Var")} - , (VCastTypeIndexName){.tindex = 298, .tname = _SLIT("v.ast.AsmStmt")} - , (VCastTypeIndexName){.tindex = 299, .tname = _SLIT("v.ast.AssertStmt")} - , (VCastTypeIndexName){.tindex = 300, .tname = _SLIT("v.ast.AssignStmt")} - , (VCastTypeIndexName){.tindex = 301, .tname = _SLIT("v.ast.Block")} - , (VCastTypeIndexName){.tindex = 302, .tname = _SLIT("v.ast.BranchStmt")} - , (VCastTypeIndexName){.tindex = 303, .tname = _SLIT("v.ast.ComptimeFor")} - , (VCastTypeIndexName){.tindex = 304, .tname = _SLIT("v.ast.ConstDecl")} - , (VCastTypeIndexName){.tindex = 305, .tname = _SLIT("v.ast.DeferStmt")} - , (VCastTypeIndexName){.tindex = 306, .tname = _SLIT("v.ast.EmptyStmt")} - , (VCastTypeIndexName){.tindex = 307, .tname = _SLIT("v.ast.EnumDecl")} - , (VCastTypeIndexName){.tindex = 308, .tname = _SLIT("v.ast.ExprStmt")} + , (VCastTypeIndexName){.tindex = 433, .tname = _SLIT("v.ast.Aggregate")} + , (VCastTypeIndexName){.tindex = 435, .tname = _SLIT("v.ast.Alias")} + , (VCastTypeIndexName){.tindex = 415, .tname = _SLIT("v.ast.Array")} + , (VCastTypeIndexName){.tindex = 443, .tname = _SLIT("v.ast.ArrayFixed")} + , (VCastTypeIndexName){.tindex = 444, .tname = _SLIT("v.ast.Chan")} + , (VCastTypeIndexName){.tindex = 449, .tname = _SLIT("v.ast.Enum")} + , (VCastTypeIndexName){.tindex = 447, .tname = _SLIT("v.ast.FnType")} + , (VCastTypeIndexName){.tindex = 448, .tname = _SLIT("v.ast.GenericInst")} + , (VCastTypeIndexName){.tindex = 438, .tname = _SLIT("v.ast.Interface")} + , (VCastTypeIndexName){.tindex = 416, .tname = _SLIT("v.ast.Map")} + , (VCastTypeIndexName){.tindex = 446, .tname = _SLIT("v.ast.MultiReturn")} + , (VCastTypeIndexName){.tindex = 420, .tname = _SLIT("v.ast.Struct")} + , (VCastTypeIndexName){.tindex = 439, .tname = _SLIT("v.ast.SumType")} + , (VCastTypeIndexName){.tindex = 445, .tname = _SLIT("v.ast.Thread")} + , (VCastTypeIndexName){.tindex = 379, .tname = _SLIT("v.ast.IdentFn")} + , (VCastTypeIndexName){.tindex = 380, .tname = _SLIT("v.ast.IdentVar")} + , (VCastTypeIndexName){.tindex = 248, .tname = _SLIT("v.ast.AnonFn")} + , (VCastTypeIndexName){.tindex = 249, .tname = _SLIT("v.ast.ArrayDecompose")} + , (VCastTypeIndexName){.tindex = 250, .tname = _SLIT("v.ast.ArrayInit")} + , (VCastTypeIndexName){.tindex = 251, .tname = _SLIT("v.ast.AsCast")} + , (VCastTypeIndexName){.tindex = 252, .tname = _SLIT("v.ast.Assoc")} + , (VCastTypeIndexName){.tindex = 253, .tname = _SLIT("v.ast.AtExpr")} + , (VCastTypeIndexName){.tindex = 254, .tname = _SLIT("v.ast.BoolLiteral")} + , (VCastTypeIndexName){.tindex = 255, .tname = _SLIT("v.ast.CTempVar")} + , (VCastTypeIndexName){.tindex = 256, .tname = _SLIT("v.ast.CallExpr")} + , (VCastTypeIndexName){.tindex = 257, .tname = _SLIT("v.ast.CastExpr")} + , (VCastTypeIndexName){.tindex = 258, .tname = _SLIT("v.ast.ChanInit")} + , (VCastTypeIndexName){.tindex = 259, .tname = _SLIT("v.ast.CharLiteral")} + , (VCastTypeIndexName){.tindex = 260, .tname = _SLIT("v.ast.Comment")} + , (VCastTypeIndexName){.tindex = 261, .tname = _SLIT("v.ast.ComptimeCall")} + , (VCastTypeIndexName){.tindex = 262, .tname = _SLIT("v.ast.ComptimeSelector")} + , (VCastTypeIndexName){.tindex = 263, .tname = _SLIT("v.ast.ComptimeType")} + , (VCastTypeIndexName){.tindex = 264, .tname = _SLIT("v.ast.ConcatExpr")} + , (VCastTypeIndexName){.tindex = 265, .tname = _SLIT("v.ast.DumpExpr")} + , (VCastTypeIndexName){.tindex = 266, .tname = _SLIT("v.ast.EmptyExpr")} + , (VCastTypeIndexName){.tindex = 267, .tname = _SLIT("v.ast.EnumVal")} + , (VCastTypeIndexName){.tindex = 268, .tname = _SLIT("v.ast.FloatLiteral")} + , (VCastTypeIndexName){.tindex = 269, .tname = _SLIT("v.ast.GoExpr")} + , (VCastTypeIndexName){.tindex = 270, .tname = _SLIT("v.ast.Ident")} + , (VCastTypeIndexName){.tindex = 271, .tname = _SLIT("v.ast.IfExpr")} + , (VCastTypeIndexName){.tindex = 272, .tname = _SLIT("v.ast.IfGuardExpr")} + , (VCastTypeIndexName){.tindex = 273, .tname = _SLIT("v.ast.IndexExpr")} + , (VCastTypeIndexName){.tindex = 274, .tname = _SLIT("v.ast.InfixExpr")} + , (VCastTypeIndexName){.tindex = 275, .tname = _SLIT("v.ast.IntegerLiteral")} + , (VCastTypeIndexName){.tindex = 276, .tname = _SLIT("v.ast.IsRefType")} + , (VCastTypeIndexName){.tindex = 277, .tname = _SLIT("v.ast.Likely")} + , (VCastTypeIndexName){.tindex = 278, .tname = _SLIT("v.ast.LockExpr")} + , (VCastTypeIndexName){.tindex = 279, .tname = _SLIT("v.ast.MapInit")} + , (VCastTypeIndexName){.tindex = 280, .tname = _SLIT("v.ast.MatchExpr")} + , (VCastTypeIndexName){.tindex = 281, .tname = _SLIT("v.ast.NodeError")} + , (VCastTypeIndexName){.tindex = 282, .tname = _SLIT("v.ast.None")} + , (VCastTypeIndexName){.tindex = 283, .tname = _SLIT("v.ast.OffsetOf")} + , (VCastTypeIndexName){.tindex = 284, .tname = _SLIT("v.ast.OrExpr")} + , (VCastTypeIndexName){.tindex = 285, .tname = _SLIT("v.ast.ParExpr")} + , (VCastTypeIndexName){.tindex = 286, .tname = _SLIT("v.ast.PostfixExpr")} + , (VCastTypeIndexName){.tindex = 287, .tname = _SLIT("v.ast.PrefixExpr")} + , (VCastTypeIndexName){.tindex = 288, .tname = _SLIT("v.ast.RangeExpr")} + , (VCastTypeIndexName){.tindex = 289, .tname = _SLIT("v.ast.SelectExpr")} + , (VCastTypeIndexName){.tindex = 290, .tname = _SLIT("v.ast.SelectorExpr")} + , (VCastTypeIndexName){.tindex = 291, .tname = _SLIT("v.ast.SizeOf")} + , (VCastTypeIndexName){.tindex = 292, .tname = _SLIT("v.ast.SqlExpr")} + , (VCastTypeIndexName){.tindex = 293, .tname = _SLIT("v.ast.StringInterLiteral")} + , (VCastTypeIndexName){.tindex = 294, .tname = _SLIT("v.ast.StringLiteral")} + , (VCastTypeIndexName){.tindex = 295, .tname = _SLIT("v.ast.StructInit")} + , (VCastTypeIndexName){.tindex = 296, .tname = _SLIT("v.ast.TypeNode")} + , (VCastTypeIndexName){.tindex = 297, .tname = _SLIT("v.ast.TypeOf")} + , (VCastTypeIndexName){.tindex = 298, .tname = _SLIT("v.ast.UnsafeExpr")} + , (VCastTypeIndexName){.tindex = 325, .tname = _SLIT("v.ast.AsmRegister")} + , (VCastTypeIndexName){.tindex = 326, .tname = _SLIT("v.ast.ConstField")} + , (VCastTypeIndexName){.tindex = 327, .tname = _SLIT("v.ast.GlobalField")} + , (VCastTypeIndexName){.tindex = 328, .tname = _SLIT("v.ast.Var")} + , (VCastTypeIndexName){.tindex = 300, .tname = _SLIT("v.ast.AsmStmt")} + , (VCastTypeIndexName){.tindex = 301, .tname = _SLIT("v.ast.AssertStmt")} + , (VCastTypeIndexName){.tindex = 302, .tname = _SLIT("v.ast.AssignStmt")} + , (VCastTypeIndexName){.tindex = 303, .tname = _SLIT("v.ast.Block")} + , (VCastTypeIndexName){.tindex = 304, .tname = _SLIT("v.ast.BranchStmt")} + , (VCastTypeIndexName){.tindex = 305, .tname = _SLIT("v.ast.ComptimeFor")} + , (VCastTypeIndexName){.tindex = 306, .tname = _SLIT("v.ast.ConstDecl")} + , (VCastTypeIndexName){.tindex = 307, .tname = _SLIT("v.ast.DeferStmt")} + , (VCastTypeIndexName){.tindex = 308, .tname = _SLIT("v.ast.EmptyStmt")} + , (VCastTypeIndexName){.tindex = 309, .tname = _SLIT("v.ast.EnumDecl")} + , (VCastTypeIndexName){.tindex = 310, .tname = _SLIT("v.ast.ExprStmt")} , (VCastTypeIndexName){.tindex = 185, .tname = _SLIT("v.ast.FnDecl")} - , (VCastTypeIndexName){.tindex = 309, .tname = _SLIT("v.ast.ForCStmt")} - , (VCastTypeIndexName){.tindex = 310, .tname = _SLIT("v.ast.ForInStmt")} - , (VCastTypeIndexName){.tindex = 311, .tname = _SLIT("v.ast.ForStmt")} - , (VCastTypeIndexName){.tindex = 312, .tname = _SLIT("v.ast.GlobalDecl")} - , (VCastTypeIndexName){.tindex = 313, .tname = _SLIT("v.ast.GotoLabel")} - , (VCastTypeIndexName){.tindex = 314, .tname = _SLIT("v.ast.GotoStmt")} - , (VCastTypeIndexName){.tindex = 315, .tname = _SLIT("v.ast.HashStmt")} - , (VCastTypeIndexName){.tindex = 316, .tname = _SLIT("v.ast.Import")} - , (VCastTypeIndexName){.tindex = 317, .tname = _SLIT("v.ast.InterfaceDecl")} - , (VCastTypeIndexName){.tindex = 318, .tname = _SLIT("v.ast.Module")} - , (VCastTypeIndexName){.tindex = 319, .tname = _SLIT("v.ast.Return")} - , (VCastTypeIndexName){.tindex = 320, .tname = _SLIT("v.ast.SqlStmt")} - , (VCastTypeIndexName){.tindex = 321, .tname = _SLIT("v.ast.StructDecl")} - , (VCastTypeIndexName){.tindex = 245, .tname = _SLIT("v.ast.TypeDecl")} - , (VCastTypeIndexName){.tindex = 398, .tname = _SLIT("v.ast.AsmAddressing")} - , (VCastTypeIndexName){.tindex = 399, .tname = _SLIT("v.ast.AsmAlias")} - , (VCastTypeIndexName){.tindex = 400, .tname = _SLIT("v.ast.AsmDisp")} + , (VCastTypeIndexName){.tindex = 311, .tname = _SLIT("v.ast.ForCStmt")} + , (VCastTypeIndexName){.tindex = 312, .tname = _SLIT("v.ast.ForInStmt")} + , (VCastTypeIndexName){.tindex = 313, .tname = _SLIT("v.ast.ForStmt")} + , (VCastTypeIndexName){.tindex = 314, .tname = _SLIT("v.ast.GlobalDecl")} + , (VCastTypeIndexName){.tindex = 315, .tname = _SLIT("v.ast.GotoLabel")} + , (VCastTypeIndexName){.tindex = 316, .tname = _SLIT("v.ast.GotoStmt")} + , (VCastTypeIndexName){.tindex = 317, .tname = _SLIT("v.ast.HashStmt")} + , (VCastTypeIndexName){.tindex = 318, .tname = _SLIT("v.ast.Import")} + , (VCastTypeIndexName){.tindex = 319, .tname = _SLIT("v.ast.InterfaceDecl")} + , (VCastTypeIndexName){.tindex = 320, .tname = _SLIT("v.ast.Module")} + , (VCastTypeIndexName){.tindex = 321, .tname = _SLIT("v.ast.Return")} + , (VCastTypeIndexName){.tindex = 322, .tname = _SLIT("v.ast.SqlStmt")} + , (VCastTypeIndexName){.tindex = 323, .tname = _SLIT("v.ast.StructDecl")} + , (VCastTypeIndexName){.tindex = 247, .tname = _SLIT("v.ast.TypeDecl")} + , (VCastTypeIndexName){.tindex = 400, .tname = _SLIT("v.ast.AsmAddressing")} + , (VCastTypeIndexName){.tindex = 401, .tname = _SLIT("v.ast.AsmAlias")} + , (VCastTypeIndexName){.tindex = 402, .tname = _SLIT("v.ast.AsmDisp")} , (VCastTypeIndexName){.tindex = 20, .tname = _SLIT("string")} })); @@ -99556,10 +97699,6 @@ void _vinit(int ___argc, voidptr ___argv) { _const_none__ = /*&IError*/I_None___to_Interface_IError(((None__*)memdup(&(None__){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(None__)))); _const_children_bytes = sizeof(voidptr) * (_const_max_len + 1); } - { // Initializations for module os : - _const_os__args = os__init_os_args(___argc, (byte**)___argv); - _const_os__wd_at_startup = os__getwd(); - } { // Initializations for module strings.textscanner : } { // Initializations for module os.cmdline : @@ -99578,148 +97717,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.mathutil : } - { // Initializations for module v.dotgraph : - } - { // Initializations for module hash : - } - { // Initializations for module rand.constants : - _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; - _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; - } - { // Initializations for module hash.fnv1a : - } - { // Initializations for module math.internal : - } - { // Initializations for module flag : - } - { // Initializations for module semver : - _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); - } - { // Initializations for module sync.stdatomic : - } - { // Initializations for module sync.threads : - } - { // Initializations for module term : - } - { // Initializations for module v.util.version : - } - { // Initializations for module v.vcache : - } - { // Initializations for module v.vmod : - _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); - _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); - } - { // Initializations for module v.util.recompilation : - } - { // Initializations for module v.errors : - } - { // Initializations for module v.depgraph : - } - { // Initializations for module v.cflag : - } - { // Initializations for module math : - _const_math__pi_2 = _const_math__pi / 2.0; - _const_math__pi_4 = _const_math__pi / 4.0; - _const_math__log2_e = 1.0 / _const_math__ln2; - _const_math__log10_e = 1.0 / _const_math__ln10; - _const_math__min_i64 = ((i64)(-9223372036854775807 - 1)); - _const_math__max_i64 = ((i64)(9223372036854775807)); - _const_math__bernoulli = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ - 1.0 / (12.), -1.0 / (360), 1.0 / (1260), -1.0 / (1680), 5.0 / (5940), -691.0 / (360360), 7.0 / (1092.), -3617.0 / (122400), 43867.0 / (243576.), - -174611.0 / (125400)})); - _const_math__factorials_table = new_array_from_c_array(171, 171, sizeof(f64), _MOV((f64[171]){ - 1.000000000000000000000e+0, 1.000000000000000000000e+0, 2.000000000000000000000e+0, 6.000000000000000000000e+0, 2.400000000000000000000e+1, 1.200000000000000000000e+2, 7.200000000000000000000e+2, 5.040000000000000000000e+3, 4.032000000000000000000e+4, - 3.628800000000000000000e+5, 3.628800000000000000000e+6, 3.991680000000000000000e+7, 4.790016000000000000000e+8, 6.227020800000000000000e+9, 8.717829120000000000000e+10, 1.307674368000000000000e+12, 2.092278988800000000000e+13, - 3.556874280960000000000e+14, 6.402373705728000000000e+15, 1.216451004088320000000e+17, 2.432902008176640000000e+18, 5.109094217170944000000e+19, 1.124000727777607680000e+21, 2.585201673888497664000e+22, 6.204484017332394393600e+23, - 1.551121004333098598400e+25, 4.032914611266056355840e+26, 1.088886945041835216077e+28, 3.048883446117138605015e+29, 8.841761993739701954544e+30, 2.652528598121910586363e+32, 8.222838654177922817726e+33, 2.631308369336935301672e+35, - 8.683317618811886495518e+36, 2.952327990396041408476e+38, 1.033314796638614492967e+40, 3.719933267899012174680e+41, 1.376375309122634504632e+43, 5.230226174666011117600e+44, 2.039788208119744335864e+46, 8.159152832478977343456e+47, - 3.345252661316380710817e+49, 1.405006117752879898543e+51, 6.041526306337383563736e+52, 2.658271574788448768044e+54, 1.196222208654801945620e+56, 5.502622159812088949850e+57, 2.586232415111681806430e+59, 1.241391559253607267086e+61, - 6.082818640342675608723e+62, 3.041409320171337804361e+64, 1.551118753287382280224e+66, 8.065817517094387857166e+67, 4.274883284060025564298e+69, 2.308436973392413804721e+71, 1.269640335365827592597e+73, 7.109985878048634518540e+74, - 4.052691950487721675568e+76, 2.350561331282878571829e+78, 1.386831185456898357379e+80, 8.320987112741390144276e+81, 5.075802138772247988009e+83, 3.146997326038793752565e+85, 1.982608315404440064116e+87, 1.268869321858841641034e+89, - 8.247650592082470666723e+90, 5.443449390774430640037e+92, 3.647111091818868528825e+94, 2.480035542436830599601e+96, 1.711224524281413113725e+98, 1.197857166996989179607e+100, 8.504785885678623175212e+101, 6.123445837688608686152e+103, - 4.470115461512684340891e+105, 3.307885441519386412260e+107, 2.480914081139539809195e+109, 1.885494701666050254988e+111, 1.451830920282858696341e+113, 1.132428117820629783146e+115, 8.946182130782975286851e+116, 7.156945704626380229481e+118, - 5.797126020747367985880e+120, 4.753643337012841748421e+122, 3.945523969720658651190e+124, 3.314240134565353266999e+126, 2.817104114380550276949e+128, 2.422709538367273238177e+130, 2.107757298379527717214e+132, 1.854826422573984391148e+134, - 1.650795516090846108122e+136, 1.485715964481761497310e+138, 1.352001527678402962552e+140, 1.243841405464130725548e+142, 1.156772507081641574759e+144, 1.087366156656743080274e+146, 1.032997848823905926260e+148, 9.916779348709496892096e+149, - 9.619275968248211985333e+151, 9.426890448883247745626e+153, 9.332621544394415268170e+155, 9.332621544394415268170e+157, 9.425947759838359420852e+159, 9.614466715035126609269e+161, 9.902900716486180407547e+163, 1.029901674514562762385e+166, - 1.081396758240290900504e+168, 1.146280563734708354534e+170, 1.226520203196137939352e+172, 1.324641819451828974500e+174, 1.443859583202493582205e+176, 1.588245541522742940425e+178, 1.762952551090244663872e+180, 1.974506857221074023537e+182, - 2.231192748659813646597e+184, 2.543559733472187557120e+186, 2.925093693493015690688e+188, 3.393108684451898201198e+190, 3.969937160808720895402e+192, 4.684525849754290656574e+194, 5.574585761207605881323e+196, 6.689502913449127057588e+198, - 8.094298525273443739682e+200, 9.875044200833601362412e+202, 1.214630436702532967577e+205, 1.506141741511140879795e+207, 1.882677176888926099744e+209, 2.372173242880046885677e+211, 3.012660018457659544810e+213, 3.856204823625804217357e+215, - 4.974504222477287440390e+217, 6.466855489220473672507e+219, 8.471580690878820510985e+221, 1.118248651196004307450e+224, 1.487270706090685728908e+226, 1.992942746161518876737e+228, 2.690472707318050483595e+230, 3.659042881952548657690e+232, - 5.012888748274991661035e+234, 6.917786472619488492228e+236, 9.615723196941089004197e+238, 1.346201247571752460588e+241, 1.898143759076170969429e+243, 2.695364137888162776589e+245, 3.854370717180072770522e+247, 5.550293832739304789551e+249, - 8.047926057471991944849e+251, 1.174997204390910823948e+254, 1.727245890454638911203e+256, 2.556323917872865588581e+258, 3.808922637630569726986e+260, 5.713383956445854590479e+262, 8.627209774233240431623e+264, 1.311335885683452545607e+267, - 2.006343905095682394778e+269, 3.089769613847350887959e+271, 4.789142901463393876336e+273, 7.471062926282894447084e+275, 1.172956879426414428192e+278, 1.853271869493734796544e+280, 2.946702272495038326504e+282, 4.714723635992061322407e+284, - 7.590705053947218729075e+286, 1.229694218739449434110e+289, 2.004401576545302577600e+291, 3.287218585534296227263e+293, 5.423910666131588774984e+295, 9.003691705778437366474e+297, 1.503616514864999040201e+300, 2.526075744973198387538e+302, - 4.269068009004705274939e+304, 7.257415615307998967397e+306})); - _const_math__log_factorials_table = new_array_from_c_array(172, 172, sizeof(f64), _MOV((f64[172]){ - 0.000000000000000000000e+0, 0.000000000000000000000e+0, 6.931471805599453094172e-1, 1.791759469228055000812e+0, 3.178053830347945619647e+0, 4.787491742782045994248e+0, 6.579251212010100995060e+0, 8.525161361065414300166e+0, 1.060460290274525022842e+1, - 1.280182748008146961121e+1, 1.510441257307551529523e+1, 1.750230784587388583929e+1, 1.998721449566188614952e+1, 2.255216385312342288557e+1, 2.519122118273868150009e+1, 2.789927138384089156609e+1, 3.067186010608067280376e+1, - 3.350507345013688888401e+1, 3.639544520803305357622e+1, 3.933988418719949403622e+1, 4.233561646075348502966e+1, 4.538013889847690802616e+1, 4.847118135183522387964e+1, 5.160667556776437357045e+1, 5.478472939811231919009e+1, - 5.800360522298051993929e+1, 6.126170176100200198477e+1, 6.455753862700633105895e+1, 6.788974313718153498289e+1, 7.125703896716800901007e+1, 7.465823634883016438549e+1, 7.809222355331531063142e+1, 8.155795945611503717850e+1, - 8.505446701758151741396e+1, 8.858082754219767880363e+1, 9.213617560368709248333e+1, 9.571969454214320248496e+1, 9.933061245478742692933e+1, 1.029681986145138126988e+2, 1.066317602606434591262e+2, 1.103206397147573954291e+2, - 1.140342117814617032329e+2, 1.177718813997450715388e+2, 1.215330815154386339623e+2, 1.253172711493568951252e+2, 1.291239336391272148826e+2, 1.329525750356163098828e+2, 1.368027226373263684696e+2, 1.406739236482342593987e+2, - 1.445657439463448860089e+2, 1.484777669517730320675e+2, 1.524095925844973578392e+2, 1.563608363030787851941e+2, 1.603311282166309070282e+2, 1.643201122631951814118e+2, 1.683274454484276523305e+2, 1.723527971391628015638e+2, - 1.763958484069973517152e+2, 1.804562914175437710518e+2, 1.845338288614494905025e+2, 1.886281734236715911873e+2, 1.927390472878449024360e+2, 1.968661816728899939914e+2, 2.010093163992815266793e+2, 2.051681994826411985358e+2, - 2.093425867525368356464e+2, 2.135322414945632611913e+2, 2.177369341139542272510e+2, 2.219564418191303339501e+2, 2.261905483237275933323e+2, 2.304390435657769523214e+2, 2.347017234428182677427e+2, 2.389783895618343230538e+2, - 2.432688490029827141829e+2, 2.475729140961868839366e+2, 2.518904022097231943772e+2, 2.562211355500095254561e+2, 2.605649409718632093053e+2, 2.649216497985528010421e+2, 2.692910976510198225363e+2, 2.736731242856937041486e+2, - 2.780675734403661429141e+2, 2.824742926876303960274e+2, 2.868931332954269939509e+2, 2.913239500942703075662e+2, 2.957666013507606240211e+2, 3.002209486470141317540e+2, 3.046868567656687154726e+2, 3.091641935801469219449e+2, - 3.136528299498790617832e+2, 3.181526396202093268500e+2, 3.226634991267261768912e+2, 3.271852877037752172008e+2, 3.317178871969284731381e+2, 3.362611819791984770344e+2, 3.408150588707990178690e+2, 3.453794070622668541074e+2, - 3.499541180407702369296e+2, 3.545390855194408088492e+2, 3.591342053695753987760e+2, 3.637393755555634901441e+2, 3.683544960724047495950e+2, 3.729794688856890206760e+2, 3.776141978739186564468e+2, 3.822585887730600291111e+2, - 3.869125491232175524822e+2, 3.915759882173296196258e+2, 3.962488170517915257991e+2, 4.009309482789157454921e+2, 4.056222961611448891925e+2, 4.103227765269373054205e+2, 4.150323067282496395563e+2, 4.197508055995447340991e+2, - 4.244781934182570746677e+2, 4.292143918666515701285e+2, 4.339593239950148201939e+2, 4.387129141861211848399e+2, 4.434750881209189409588e+2, 4.482457727453846057188e+2, 4.530248962384961351041e+2, 4.578123879812781810984e+2, - 4.626081785268749221865e+2, 4.674121995716081787447e+2, 4.722243839269805962399e+2, 4.770446654925856331047e+2, 4.818729792298879342285e+2, 4.867092611368394122258e+2, 4.915534482232980034989e+2, 4.964054784872176206648e+2, - 5.012652908915792927797e+2, 5.061328253420348751997e+2, 5.110080226652360267439e+2, 5.158908245878223975982e+2, 5.207811737160441513633e+2, 5.256790135159950627324e+2, 5.305842882944334921812e+2, 5.354969431801695441897e+2, - 5.404169241059976691050e+2, 5.453441777911548737966e+2, 5.502786517242855655538e+2, 5.552202941468948698523e+2, 5.601690540372730381305e+2, 5.651248810948742988613e+2, 5.700877257251342061414e+2, 5.750575390247102067619e+2, - 5.800342727671307811636e+2, 5.850178793888391176022e+2, 5.900083119756178539038e+2, 5.950055242493819689670e+2, 6.000094705553274281080e+2, 6.050201058494236838580e+2, 6.100373856862386081868e+2, 6.150612662070848845750e+2, - 6.200917041284773200381e+2, 6.251286567308909491967e+2, 6.301720818478101958172e+2, 6.352219378550597328635e+2, 6.402781836604080409209e+2, 6.453407786934350077245e+2, 6.504096828956552392500e+2, 6.554848567108890661717e+2, - 6.605662610758735291676e+2, 6.656538574111059132426e+2, 6.707476076119126755767e+2, 6.758474740397368739994e+2, 6.809534195136374546094e+2, 6.860654073019939978423e+2, 6.911834011144107529496e+2, 6.963073650938140118743e+2, - 7.014372638087370853465e+2, 7.065730622457873471107e+2, 7.117147258022900069535e+2})); - _const_math__gamma_p = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.60119522476751861407e-04, 1.19135147006586384913e-03, 1.04213797561761569935e-02, 4.76367800457137231464e-02, 2.07448227648435975150e-01, 4.94214826801497100753e-01, 9.99999999999999996796e-01})); - _const_math__gamma_q = new_array_from_c_array(8, 8, sizeof(f64), _MOV((f64[8]){-2.31581873324120129819e-05, 5.39605580493303397842e-04, -4.45641913851797240494e-03, 1.18139785222060435552e-02, 3.58236398605498653373e-02, -2.34591795718243348568e-01, 7.14304917030273074085e-02, 1.00000000000000000320e+00})); - _const_math__gamma_s = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){7.87311395793093628397e-04, -2.29549961613378126380e-04, -2.68132617805781232825e-03, 3.47222221605458667310e-03, 8.33333333333482257126e-02})); - _const_math__lgamma_a = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ - 7.72156649015328655494e-02, 3.22467033424113591611e-01, 6.73523010531292681824e-02, 2.05808084325167332806e-02, 7.38555086081402883957e-03, 2.89051383673415629091e-03, 1.19270763183362067845e-03, 5.10069792153511336608e-04, 2.20862790713908385557e-04, - 1.08011567247583939954e-04, 2.52144565451257326939e-05, 4.48640949618915160150e-05})); - _const_math__lgamma_r = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.0, 1.39200533467621045958e+00, 7.21935547567138069525e-01, 1.71933865632803078993e-01, 1.86459191715652901344e-02, 7.77942496381893596434e-04, 7.32668430744625636189e-06})); - _const_math__lgamma_s = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){-7.72156649015328655494e-02, 2.14982415960608852501e-01, 3.25778796408930981787e-01, 1.46350472652464452805e-01, 2.66422703033638609560e-02, 1.84028451407337715652e-03, 3.19475326584100867617e-05})); - _const_math__lgamma_t = new_array_from_c_array(15, 15, sizeof(f64), _MOV((f64[15]){ - 4.83836122723810047042e-01, -1.47587722994593911752e-01, 6.46249402391333854778e-02, -3.27885410759859649565e-02, 1.79706750811820387126e-02, -1.03142241298341437450e-02, 6.10053870246291332635e-03, -3.68452016781138256760e-03, 2.25964780900612472250e-03, - -1.40346469989232843813e-03, 8.81081882437654011382e-04, -5.38595305356740546715e-04, 3.15632070903625950361e-04, -3.12754168375120860518e-04, 3.35529192635519073543e-04})); - _const_math__lgamma_u = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){-7.72156649015328655494e-02, 6.32827064025093366517e-01, 1.45492250137234768737e+00, 9.77717527963372745603e-01, 2.28963728064692451092e-01, 1.33810918536787660377e-02})); - _const_math__lgamma_v = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){1.0, 2.45597793713041134822e+00, 2.12848976379893395361e+00, 7.69285150456672783825e-01, 1.04222645593369134254e-01, 3.21709242282423911810e-03})); - _const_math__lgamma_w = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){4.18938533204672725052e-01, 8.33333333333329678849e-02, -2.77777777728775536470e-03, 7.93650558643019558500e-04, -5.95187557450339963135e-04, 8.36339918996282139126e-04, -1.63092934096575273989e-03})); - _const_math__pow10tab = new_array_from_c_array(32, 32, sizeof(f64), _MOV((f64[32]){ - ((f64)(1e+00)), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, - 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, - 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, - 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31})); - _const_math__pow10postab32 = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ - ((f64)(1e+00)), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, - 1e+288})); - _const_math__pow10negtab32 = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ - ((f64)(1e-00)), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, - 1e-288, 1e-320})); - _const_math__sin_data = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ - -0.3295190160663511504173, 0.0025374284671667991990, 0.0006261928782647355874, -4.6495547521854042157541e-06, -5.6917531549379706526677e-07, 3.7283335140973803627866e-09, 3.0267376484747473727186e-10, -1.7400875016436622322022e-12, -1.0554678305790849834462e-13, - 5.3701981409132410797062e-16, 2.5984137983099020336115e-17, -1.1821555255364833468288e-19})); - _const_math__sin_cs = ((math__ChebSeries){.c = _const_math__sin_data,.order = 11,.a = -1,.b = 1,}); - _const_math__cos_data = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ - 0.165391825637921473505668118136, -0.00084852883845000173671196530195, -0.000210086507222940730213625768083, 1.16582269619760204299639757584e-6, 1.43319375856259870334412701165e-7, -7.4770883429007141617951330184e-10, -6.0969994944584252706997438007e-11, 2.90748249201909353949854872638e-13, 1.77126739876261435667156490461e-14, - -7.6896421502815579078577263149e-17, -3.7363121133079412079201377318e-18})); - _const_math__cos_cs = ((math__ChebSeries){.c = _const_math__cos_data,.order = 10,.a = -1,.b = 1,}); - _const_math__tan_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-1.30936939181383777646e+4, 1.15351664838587416140e+6, -1.79565251976484877988e+7})); - _const_math__tan_q = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){1.00000000000000000000e+0, 1.36812963470692954678e+4, -1.32089234440210967447e+6, 2.50083801823357915839e+7, -5.38695755929454629881e+7})); - _const_math__tanh_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-9.64399179425052238628e-1, -9.92877231001918586564e+1, -1.61468768441708447952e+3})); - _const_math__tanh_q = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){1.12811678491632931402e+2, 2.23548839060100448583e+3, 4.84406305325125486048e+3})); - } - { // Initializations for module v.pkgconfig : - _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ - _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), - _SLIT("/opt/homebrew/lib/pkgconfig"), _SLIT("/usr/local/libdata/pkgconfig")})); - } - { // Initializations for module v.vet : - } - { // Initializations for module runtime : - } { // Initializations for module time : _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), @@ -99745,14 +97742,66 @@ void _vinit(int ___argc, voidptr ___argv) { _const_time__hour = ((60 * _const_time__minute)); _const_time__infinite = ((((i64)(9223372036854775807)))); } - { // Initializations for module v.util.diff : + { // Initializations for module v.dotgraph : + } + { // Initializations for module hash : + } + { // Initializations for module rand.constants : + _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; + _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; + } + { // Initializations for module hash.fnv1a : + } + { // Initializations for module rand.buffer : + } + { // Initializations for module flag : + } + { // Initializations for module semver : + _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); + } + { // Initializations for module sync.stdatomic : + } + { // Initializations for module sync.threads : + } + { // Initializations for module os : + _const_os__args = os__init_os_args(___argc, (byte**)___argv); + _const_os__wd_at_startup = os__getwd(); + } + { // Initializations for module v.errors : + } + { // Initializations for module v.depgraph : + } + { // Initializations for module v.vet : } { // Initializations for module rand.seed : } + { // Initializations for module term : + } + { // Initializations for module v.util.version : + } + { // Initializations for module v.vcache : + } + { // Initializations for module v.util.diff : + } + { // Initializations for module v.vmod : + _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); + _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); + } + { // Initializations for module v.util.recompilation : + } + { // Initializations for module v.cflag : + } { // Initializations for module rand.config : } { // Initializations for module rand.wyrand : } + { // Initializations for module v.pkgconfig : + _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ + _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), + _SLIT("/opt/homebrew/lib/pkgconfig"), _SLIT("/usr/local/libdata/pkgconfig")})); + } + { // Initializations for module runtime : + } { // Initializations for module rand : _const_rand__clock_seq_hi_and_reserved_valid_values = new_array_from_c_array(4, 4, sizeof(rune), _MOV((rune[4]){'8', '9', 'a', 'b'})); default_rng = *(rand__PRNG**)&((rand__PRNG*[]){0}[0]); // global @@ -99774,7 +97823,16 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__util__invalid_escapes = string_bytes(_SLIT("({$`.")); _const_v__util__builtin_module_parts = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("math.bits"), _SLIT("strconv"), _SLIT("dlmalloc"), _SLIT("strconv.ftoa"), _SLIT("strings"), _SLIT("builtin")})); _const_v__util__bundle_modules = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("clipboard"), _SLIT("fontstash"), _SLIT("gg"), _SLIT("gx"), _SLIT("sokol"), _SLIT("szip"), _SLIT("ui")})); - _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), _MOV((string[1]){_SLIT("vdoc"), }), _MOV((Array_string[1]){new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("markdown")})), })); + _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), + _MOV((string[1]){ + _SLIT("vdoc"), + }), + _MOV((Array_string[1]){ + new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("markdown")})), + }) + ) + +; _const_v__util__const_tabs = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT(""), _SLIT("\t"), _SLIT("\t\t"), _SLIT("\t\t\t"), _SLIT("\t\t\t\t"), _SLIT("\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t\t")})); @@ -99786,21 +97844,161 @@ void _vinit(int ___argc, voidptr ___argv) { _const_sync__pool__no_result = ((voidptr)(0)); } { // Initializations for module v.ast : - _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), _MOV((int[4]){8, 16, 32, 64, }), _MOV((Array_string[4]){new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ + _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), + _MOV((int[4]){ + 8, + 16, + 32, + 64, + }), + _MOV((Array_string[4]){ + new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ _SLIT("al"), _SLIT("ah"), _SLIT("bl"), _SLIT("bh"), _SLIT("cl"), _SLIT("ch"), _SLIT("dl"), _SLIT("dh"), _SLIT("bpl"), - _SLIT("sil"), _SLIT("dil"), _SLIT("spl")})), new_array_from_c_array(23, 23, sizeof(string), _MOV((string[23]){ + _SLIT("sil"), _SLIT("dil"), _SLIT("spl")})), + new_array_from_c_array(23, 23, sizeof(string), _MOV((string[23]){ _SLIT("ax"), _SLIT("bx"), _SLIT("cx"), _SLIT("dx"), _SLIT("bp"), _SLIT("si"), _SLIT("di"), _SLIT("sp"), _SLIT("cs"), _SLIT("ss"), _SLIT("ds"), _SLIT("es"), _SLIT("fs"), _SLIT("gs"), _SLIT("flags"), _SLIT("ip"), _SLIT("gdtr"), - _SLIT("idtr"), _SLIT("tr"), _SLIT("ldtr"), _SLIT("fp_cs"), _SLIT("fp_ds"), _SLIT("fp_opc")})), new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ + _SLIT("idtr"), _SLIT("tr"), _SLIT("ldtr"), _SLIT("fp_cs"), _SLIT("fp_ds"), _SLIT("fp_opc")})), + new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("eax"), _SLIT("ebx"), _SLIT("ecx"), _SLIT("edx"), _SLIT("ebp"), _SLIT("esi"), _SLIT("edi"), _SLIT("esp"), _SLIT("eflags"), - _SLIT("eip"), _SLIT("mxcsr")})), new_array_from_c_array(10, 10, sizeof(string), _MOV((string[10]){ + _SLIT("eip"), _SLIT("mxcsr")})), + new_array_from_c_array(10, 10, sizeof(string), _MOV((string[10]){ _SLIT("rax"), _SLIT("rbx"), _SLIT("rcx"), _SLIT("rdx"), _SLIT("rbp"), _SLIT("rsi"), _SLIT("rdi"), _SLIT("rsp"), _SLIT("rflags"), - _SLIT("rip")})), })); - _const_v__ast__x86_with_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 8, sizeof(int), sizeof(Map_string_int), _MOV((int[8]){8, 16, 32, 64, 80, 128, 256, 512, }), _MOV((Map_string_int[8]){new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#b"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#w"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#d"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), _MOV((string[4]){_SLIT("r#"), _SLIT("mm#"), _SLIT("cr#"), _SLIT("dr#"), }), _MOV((int[4]){16, 16, 16, 16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("st#"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("xmm#"), }), _MOV((int[1]){32, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("ymm#"), }), _MOV((int[1]){32, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("zmm#"), }), _MOV((int[1]){32, })), })); + _SLIT("rip")})), + }) + ) + +; + _const_v__ast__x86_with_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 8, sizeof(int), sizeof(Map_string_int), + _MOV((int[8]){ + 8, + 16, + 32, + 64, + 80, + 128, + 256, + 512, + }), + _MOV((Map_string_int[8]){ + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#b"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#w"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#d"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), + _MOV((string[4]){ + _SLIT("r#"), + _SLIT("mm#"), + _SLIT("cr#"), + _SLIT("dr#"), + }), + _MOV((int[4]){ + 16, + 16, + 16, + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("st#"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("xmm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("ymm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("zmm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + }) + ) + +; _const_v__ast__arm_no_number_register_list = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("fp"), _SLIT("ip"), _SLIT("sp"), _SLIT("lr"), _SLIT("pc")})); - _const_v__ast__arm_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#"), }), _MOV((int[1]){16, })); + _const_v__ast__arm_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#"), + }), + _MOV((int[1]){ + 16, + }) + ) + +; _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__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){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0}, diff --git a/v_win.c b/v_win.c index 7375dcf..4c8627b 100644 --- a/v_win.c +++ b/v_win.c @@ -1,11 +1,11 @@ -#define V_COMMIT_HASH "f9079b670" +#define V_COMMIT_HASH "585cb9ec2" #ifndef V_COMMIT_HASH - #define V_COMMIT_HASH "9a0f49950" + #define V_COMMIT_HASH "f9079b670" #endif #ifndef V_CURRENT_COMMIT_HASH - #define V_CURRENT_COMMIT_HASH "f9079b6" + #define V_CURRENT_COMMIT_HASH "585cb9e" #endif // V comptime_definitions: @@ -44,6 +44,7 @@ typedef struct multi_return_ref_v__pref__Preferences_string multi_return_ref_v__ typedef struct multi_return_string_string multi_return_string_string; typedef struct multi_return_u64_u64 multi_return_u64_u64; typedef struct multi_return_f64_int multi_return_f64_int; +typedef struct multi_return_f64_f64 multi_return_f64_f64; typedef struct multi_return_int_int_int multi_return_int_int_int; typedef struct multi_return_int_int_int_int_i64_bool multi_return_int_int_int_int_i64_bool; typedef struct multi_return_Array_string_int multi_return_Array_string_int; @@ -66,8 +67,6 @@ typedef struct multi_return_string_string_string_string multi_return_string_stri typedef struct multi_return_int_string_string_string multi_return_int_string_string_string; typedef struct multi_return_Array_string_Array_string_Array_bool multi_return_Array_string_Array_string_Array_bool; typedef struct multi_return_u64_string multi_return_u64_string; -typedef struct multi_return_i64_i64_i64 multi_return_i64_i64_i64; -typedef struct multi_return_f64_f64 multi_return_f64_f64; // END_multi_return_typedefs typedef struct strconv__BF_param strconv__BF_param; @@ -113,9 +112,15 @@ typedef struct v__token__KeywordsMatcher v__token__KeywordsMatcher; typedef struct v__token__WIndex v__token__WIndex; typedef struct v__token__Pos v__token__Pos; typedef struct v__token__Token v__token__Token; +typedef struct time__TimeParseError time__TimeParseError; +typedef struct time__StopWatchOptions time__StopWatchOptions; +typedef struct time__StopWatch time__StopWatch; +typedef struct time__Time time__Time; +typedef struct time__SystemTime time__SystemTime; typedef struct v__dotgraph__DotGraph v__dotgraph__DotGraph; typedef struct v__dotgraph__NewNodeConfig v__dotgraph__NewNodeConfig; typedef struct v__dotgraph__NewEdgeConfig v__dotgraph__NewEdgeConfig; +typedef struct rand__buffer__PRNGBuffer rand__buffer__PRNGBuffer; typedef struct flag__Flag flag__Flag; typedef struct flag__UnkownFlagError flag__UnkownFlagError; typedef struct flag__ArgsCountError flag__ArgsCountError; @@ -155,16 +160,9 @@ typedef struct v__depgraph__DepGraphNode v__depgraph__DepGraphNode; typedef struct v__depgraph__DepGraph v__depgraph__DepGraph; typedef struct v__depgraph__OrderedDepMap v__depgraph__OrderedDepMap; typedef struct v__depgraph__NodeNames v__depgraph__NodeNames; -typedef struct math__DigitParams math__DigitParams; -typedef struct math__ChebSeries math__ChebSeries; typedef struct v__vet__Error v__vet__Error; typedef struct term__Coord term__Coord; typedef struct v__vcache__CacheManager v__vcache__CacheManager; -typedef struct time__TimeParseError time__TimeParseError; -typedef struct time__StopWatchOptions time__StopWatchOptions; -typedef struct time__StopWatch time__StopWatch; -typedef struct time__Time time__Time; -typedef struct time__SystemTime time__SystemTime; typedef struct v__vmod__Manifest v__vmod__Manifest; typedef struct v__vmod__Scanner v__vmod__Scanner; typedef struct v__vmod__Parser v__vmod__Parser; @@ -172,13 +170,14 @@ typedef struct v__vmod__Token v__vmod__Token; typedef struct v__vmod__ModFileAndFolder v__vmod__ModFileAndFolder; typedef struct v__vmod__ModFileCacher v__vmod__ModFileCacher; typedef struct v__cflag__CFlag v__cflag__CFlag; +typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; +typedef struct rand__config__NormalConfigStruct rand__config__NormalConfigStruct; +typedef struct rand__config__ShuffleConfigStruct rand__config__ShuffleConfigStruct; +typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; typedef struct v__pkgconfig__Main v__pkgconfig__Main; typedef struct v__pkgconfig__MainOptions v__pkgconfig__MainOptions; typedef struct v__pkgconfig__Options v__pkgconfig__Options; typedef struct v__pkgconfig__PkgConfig v__pkgconfig__PkgConfig; -typedef struct rand__config__PRNGConfigStruct rand__config__PRNGConfigStruct; -typedef struct rand__wyrand__WyRandRNG rand__wyrand__WyRandRNG; -typedef struct rand__ShuffleConfigStruct rand__ShuffleConfigStruct; typedef struct v__pref__Preferences v__pref__Preferences; typedef struct sync__Subscription sync__Subscription; typedef struct sync__Channel sync__Channel; @@ -362,6 +361,9 @@ typedef struct _option_string _option_string; typedef struct _option_u8 _option_u8; typedef struct _option_voidptr _option_voidptr; typedef struct _option_v__token__Kind _option_v__token__Kind; +typedef struct _option_time__Time _option_time__Time; +typedef struct _option_multi_return_int_int_int _option_multi_return_int_int_int; +typedef struct _option_multi_return_int_int_int_int_i64_bool _option_multi_return_int_int_int_int_i64_bool; typedef struct _option_bool _option_bool; typedef struct _option_void _option_void; typedef struct _option_flag__Flag _option_flag__Flag; @@ -375,15 +377,13 @@ typedef struct _option_FILE_ptr _option_FILE_ptr; typedef struct _option_Array_u8 _option_Array_u8; typedef struct _option_os__SignalHandler _option_os__SignalHandler; typedef struct _option_term__Coord _option_term__Coord; -typedef struct _option_time__Time _option_time__Time; -typedef struct _option_multi_return_int_int_int _option_multi_return_int_int_int; -typedef struct _option_multi_return_int_int_int_int_i64_bool _option_multi_return_int_int_int_int_i64_bool; typedef struct _option_v__vmod__Manifest _option_v__vmod__Manifest; typedef struct _option_multi_return_Array_string_int _option_multi_return_Array_string_int; typedef struct _option_v__pkgconfig__PkgConfig_ptr _option_v__pkgconfig__PkgConfig_ptr; typedef struct _option_v__pkgconfig__Main_ptr _option_v__pkgconfig__Main_ptr; typedef struct _option_u32 _option_u32; typedef struct _option_f32 _option_f32; +typedef struct _option_multi_return_f64_f64 _option_multi_return_f64_f64; typedef struct _option_v__pref__OS _option_v__pref__OS; typedef struct _option_v__pref__Arch _option_v__pref__Arch; typedef struct _option_v__pref__Backend _option_v__pref__Backend; @@ -1037,6 +1037,42 @@ static inline uint64_t wy2u0k(uint64_t r, uint64_t k){ _wymum(&r,&k); return k; + + +// added by module `time`, file: time.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + + + +// added by module `time`, file: time_windows.c.v:6: + +#if defined(__has_include) + +#if __has_include() +#include +#else +#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. +#endif + +#else +#include +#endif + + + // inserted by module `sync.stdatomic`, file: 1.declarations.c.v:8: /* * This file is part of FFmpeg. @@ -1485,60 +1521,6 @@ static inline int atomic_compare_exchange_strong_u16(unsigned short* object, uns -// added by module `math`, file: math.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `math` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - -// added by module `time`, file: time_windows.c.v:6: - -#if defined(__has_include) - -#if __has_include() -#include -#else -#error VERROR_MESSAGE Header file , needed for module `time` was not found. Please install the corresponding development headers. -#endif - -#else -#include -#endif - - - - - // added by module `sync`, file: sync_windows.c.v:8: #if defined(__has_include) @@ -1792,6 +1774,38 @@ typedef enum { v__token__Precedence__index, // +10 } v__token__Precedence; +typedef enum { + time__FormatTime__hhmm12, // + time__FormatTime__hhmm24, // +1 + time__FormatTime__hhmmss12, // +2 + time__FormatTime__hhmmss24, // +3 + time__FormatTime__hhmmss24_milli, // +4 + time__FormatTime__hhmmss24_micro, // +5 + time__FormatTime__no_time, // +6 +} time__FormatTime; + +typedef enum { + time__FormatDate__ddmmyy, // + time__FormatDate__ddmmyyyy, // +1 + time__FormatDate__mmddyy, // +2 + time__FormatDate__mmddyyyy, // +3 + time__FormatDate__mmmd, // +4 + time__FormatDate__mmmdd, // +5 + time__FormatDate__mmmddyy, // +6 + time__FormatDate__mmmddyyyy, // +7 + time__FormatDate__no_date, // +8 + time__FormatDate__yyyymmdd, // +9 + time__FormatDate__yymmdd, // +10 +} time__FormatDate; + +typedef enum { + time__FormatDelimiter__dot, // + time__FormatDelimiter__hyphen, // +1 + time__FormatDelimiter__slash, // +2 + time__FormatDelimiter__space, // +3 + time__FormatDelimiter__no_delimiter, // +4 +} time__FormatDelimiter; + typedef enum { semver__Operator__gt, // semver__Operator__lt, // +1 @@ -1890,38 +1904,6 @@ typedef enum { v__vet__ErrorType__trailing_space, // +2 } v__vet__ErrorType; -typedef enum { - time__FormatTime__hhmm12, // - time__FormatTime__hhmm24, // +1 - time__FormatTime__hhmmss12, // +2 - time__FormatTime__hhmmss24, // +3 - time__FormatTime__hhmmss24_milli, // +4 - time__FormatTime__hhmmss24_micro, // +5 - time__FormatTime__no_time, // +6 -} time__FormatTime; - -typedef enum { - time__FormatDate__ddmmyy, // - time__FormatDate__ddmmyyyy, // +1 - time__FormatDate__mmddyy, // +2 - time__FormatDate__mmddyyyy, // +3 - time__FormatDate__mmmd, // +4 - time__FormatDate__mmmdd, // +5 - time__FormatDate__mmmddyy, // +6 - time__FormatDate__mmmddyyyy, // +7 - time__FormatDate__no_date, // +8 - time__FormatDate__yyyymmdd, // +9 - time__FormatDate__yymmdd, // +10 -} time__FormatDate; - -typedef enum { - time__FormatDelimiter__dot, // - time__FormatDelimiter__hyphen, // +1 - time__FormatDelimiter__slash, // +2 - time__FormatDelimiter__space, // +3 - time__FormatDelimiter__no_delimiter, // +4 -} time__FormatDelimiter; - typedef enum { v__vmod__TokenKind__module_keyword, // v__vmod__TokenKind__field_key, // +1 @@ -2178,28 +2160,6 @@ typedef enum { 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 - v__gen__c__StrIntpType__si_u8, // 0+2 - v__gen__c__StrIntpType__si_i8, // 0+3 - v__gen__c__StrIntpType__si_u16, // 0+4 - v__gen__c__StrIntpType__si_i16, // 0+5 - v__gen__c__StrIntpType__si_u32, // 0+6 - v__gen__c__StrIntpType__si_i32, // 0+7 - v__gen__c__StrIntpType__si_u64, // 0+8 - v__gen__c__StrIntpType__si_i64, // 0+9 - v__gen__c__StrIntpType__si_e32, // 0+10 - v__gen__c__StrIntpType__si_e64, // 0+11 - v__gen__c__StrIntpType__si_f32, // 0+12 - v__gen__c__StrIntpType__si_f64, // 0+13 - v__gen__c__StrIntpType__si_g32, // 0+14 - v__gen__c__StrIntpType__si_g64, // 0+15 - v__gen__c__StrIntpType__si_s, // 0+16 - v__gen__c__StrIntpType__si_p, // 0+17 - v__gen__c__StrIntpType__si_vp, // 0+18 -} v__gen__c__StrIntpType; - typedef enum { v__gen__c__SqlExprSide__left, // v__gen__c__SqlExprSide__right, // +1 @@ -2234,6 +2194,7 @@ struct IError { None__* _None__; Error* _Error; MessageError* _MessageError; + time__TimeParseError* _time__TimeParseError; flag__UnkownFlagError* _flag__UnkownFlagError; flag__ArgsCountError* _flag__ArgsCountError; semver__InvalidComparatorFormatError* _semver__InvalidComparatorFormatError; @@ -2242,7 +2203,6 @@ struct IError { os__FileNotOpenedError* _os__FileNotOpenedError; os__SizeOfTypeIs0Error* _os__SizeOfTypeIs0Error; os__ExecutableNotFoundError* _os__ExecutableNotFoundError; - time__TimeParseError* _time__TimeParseError; v__gen__c__UnsupportedAssertCtempTransform* _v__gen__c__UnsupportedAssertCtempTransform; }; int _typ; @@ -2432,12 +2392,12 @@ typedef map Map_int_bool; typedef array Array_v__gen__c__ProfileCounterMeta; typedef array Array_v__ast__InfixExpr; typedef array Array_v__ast__TypeSymbol; -typedef array Array_f64; typedef array Array_v__token__Token; typedef array Array_sync__Channel_ptr; typedef array Array_sync__Direction; typedef array Array_sync__Subscription; typedef array Array_flag__Flag; +typedef array Array_f64; typedef array Array_semver__Comparator; typedef array Array_semver__ComparatorSet; typedef u8 Array_fixed_u8_5 [5]; @@ -2644,9 +2604,9 @@ struct v__vmod__ModFileAndFolder { // Union sum type v__ast__TypeDecl = -// | 281 = v__ast__AliasTypeDecl -// | 282 = v__ast__FnTypeDecl -// | 283 = v__ast__SumTypeDecl +// | 283 = v__ast__AliasTypeDecl +// | 284 = v__ast__FnTypeDecl +// | 285 = v__ast__SumTypeDecl struct v__ast__TypeDecl { union { v__ast__AliasTypeDecl* _v__ast__AliasTypeDecl; @@ -2662,57 +2622,57 @@ struct v__ast__TypeDecl { // Union sum type v__ast__Expr = -// | 285 = v__ast__AnonFn -// | 286 = v__ast__ArrayDecompose -// | 287 = v__ast__ArrayInit -// | 288 = v__ast__AsCast -// | 289 = v__ast__Assoc -// | 290 = v__ast__AtExpr -// | 291 = v__ast__BoolLiteral -// | 292 = v__ast__CTempVar -// | 293 = v__ast__CallExpr -// | 294 = v__ast__CastExpr -// | 295 = v__ast__ChanInit -// | 296 = v__ast__CharLiteral -// | 297 = v__ast__Comment -// | 298 = v__ast__ComptimeCall -// | 299 = v__ast__ComptimeSelector -// | 300 = v__ast__ComptimeType -// | 301 = v__ast__ConcatExpr -// | 302 = v__ast__DumpExpr -// | 303 = v__ast__EmptyExpr -// | 304 = v__ast__EnumVal -// | 305 = v__ast__FloatLiteral -// | 306 = v__ast__GoExpr -// | 307 = v__ast__Ident -// | 308 = v__ast__IfExpr -// | 309 = v__ast__IfGuardExpr -// | 310 = v__ast__IndexExpr -// | 311 = v__ast__InfixExpr -// | 312 = v__ast__IntegerLiteral -// | 313 = v__ast__IsRefType -// | 314 = v__ast__Likely -// | 315 = v__ast__LockExpr -// | 316 = v__ast__MapInit -// | 317 = v__ast__MatchExpr -// | 318 = v__ast__NodeError -// | 319 = v__ast__None -// | 320 = v__ast__OffsetOf -// | 321 = v__ast__OrExpr -// | 322 = v__ast__ParExpr -// | 323 = v__ast__PostfixExpr -// | 324 = v__ast__PrefixExpr -// | 325 = v__ast__RangeExpr -// | 326 = v__ast__SelectExpr -// | 327 = v__ast__SelectorExpr -// | 328 = v__ast__SizeOf -// | 329 = v__ast__SqlExpr -// | 330 = v__ast__StringInterLiteral -// | 331 = v__ast__StringLiteral -// | 332 = v__ast__StructInit -// | 333 = v__ast__TypeNode -// | 334 = v__ast__TypeOf -// | 335 = v__ast__UnsafeExpr +// | 287 = v__ast__AnonFn +// | 288 = v__ast__ArrayDecompose +// | 289 = v__ast__ArrayInit +// | 290 = v__ast__AsCast +// | 291 = v__ast__Assoc +// | 292 = v__ast__AtExpr +// | 293 = v__ast__BoolLiteral +// | 294 = v__ast__CTempVar +// | 295 = v__ast__CallExpr +// | 296 = v__ast__CastExpr +// | 297 = v__ast__ChanInit +// | 298 = v__ast__CharLiteral +// | 299 = v__ast__Comment +// | 300 = v__ast__ComptimeCall +// | 301 = v__ast__ComptimeSelector +// | 302 = v__ast__ComptimeType +// | 303 = v__ast__ConcatExpr +// | 304 = v__ast__DumpExpr +// | 305 = v__ast__EmptyExpr +// | 306 = v__ast__EnumVal +// | 307 = v__ast__FloatLiteral +// | 308 = v__ast__GoExpr +// | 309 = v__ast__Ident +// | 310 = v__ast__IfExpr +// | 311 = v__ast__IfGuardExpr +// | 312 = v__ast__IndexExpr +// | 313 = v__ast__InfixExpr +// | 314 = v__ast__IntegerLiteral +// | 315 = v__ast__IsRefType +// | 316 = v__ast__Likely +// | 317 = v__ast__LockExpr +// | 318 = v__ast__MapInit +// | 319 = v__ast__MatchExpr +// | 320 = v__ast__NodeError +// | 321 = v__ast__None +// | 322 = v__ast__OffsetOf +// | 323 = v__ast__OrExpr +// | 324 = v__ast__ParExpr +// | 325 = v__ast__PostfixExpr +// | 326 = v__ast__PrefixExpr +// | 327 = v__ast__RangeExpr +// | 328 = v__ast__SelectExpr +// | 329 = v__ast__SelectorExpr +// | 330 = v__ast__SizeOf +// | 331 = v__ast__SqlExpr +// | 332 = v__ast__StringInterLiteral +// | 333 = v__ast__StringLiteral +// | 334 = v__ast__StructInit +// | 335 = v__ast__TypeNode +// | 336 = v__ast__TypeOf +// | 337 = v__ast__UnsafeExpr struct v__ast__Expr { union { v__ast__AnonFn* _v__ast__AnonFn; @@ -2772,33 +2732,33 @@ struct v__ast__Expr { // Union sum type v__ast__Stmt = -// | 337 = v__ast__AsmStmt -// | 338 = v__ast__AssertStmt -// | 339 = v__ast__AssignStmt -// | 340 = v__ast__Block -// | 341 = v__ast__BranchStmt -// | 342 = v__ast__ComptimeFor -// | 343 = v__ast__ConstDecl -// | 344 = v__ast__DeferStmt -// | 345 = v__ast__EmptyStmt -// | 346 = v__ast__EnumDecl -// | 347 = v__ast__ExprStmt +// | 339 = v__ast__AsmStmt +// | 340 = v__ast__AssertStmt +// | 341 = v__ast__AssignStmt +// | 342 = v__ast__Block +// | 343 = v__ast__BranchStmt +// | 344 = v__ast__ComptimeFor +// | 345 = v__ast__ConstDecl +// | 346 = v__ast__DeferStmt +// | 347 = v__ast__EmptyStmt +// | 348 = v__ast__EnumDecl +// | 349 = v__ast__ExprStmt // | 220 = v__ast__FnDecl -// | 348 = v__ast__ForCStmt -// | 349 = v__ast__ForInStmt -// | 350 = v__ast__ForStmt -// | 351 = v__ast__GlobalDecl -// | 352 = v__ast__GotoLabel -// | 353 = v__ast__GotoStmt -// | 354 = v__ast__HashStmt -// | 355 = v__ast__Import -// | 356 = v__ast__InterfaceDecl -// | 357 = v__ast__Module -// | 318 = v__ast__NodeError -// | 358 = v__ast__Return -// | 359 = v__ast__SqlStmt -// | 360 = v__ast__StructDecl -// | 284 = v__ast__TypeDecl +// | 350 = v__ast__ForCStmt +// | 351 = v__ast__ForInStmt +// | 352 = v__ast__ForStmt +// | 353 = v__ast__GlobalDecl +// | 354 = v__ast__GotoLabel +// | 355 = v__ast__GotoStmt +// | 356 = v__ast__HashStmt +// | 357 = v__ast__Import +// | 358 = v__ast__InterfaceDecl +// | 359 = v__ast__Module +// | 320 = v__ast__NodeError +// | 360 = v__ast__Return +// | 361 = v__ast__SqlStmt +// | 362 = v__ast__StructDecl +// | 286 = v__ast__TypeDecl struct v__ast__Stmt { union { v__ast__AsmStmt* _v__ast__AsmStmt; @@ -2835,10 +2795,10 @@ struct v__ast__Stmt { // Union sum type v__ast__ScopeObject = -// | 362 = v__ast__AsmRegister -// | 363 = v__ast__ConstField -// | 364 = v__ast__GlobalField -// | 365 = v__ast__Var +// | 364 = v__ast__AsmRegister +// | 365 = v__ast__ConstField +// | 366 = v__ast__GlobalField +// | 367 = v__ast__Var struct v__ast__ScopeObject { union { v__ast__AsmRegister* _v__ast__AsmRegister; @@ -2853,22 +2813,22 @@ struct v__ast__ScopeObject { // Union sum type v__ast__Node = -// | 367 = v__ast__CallArg -// | 363 = v__ast__ConstField -// | 368 = v__ast__EmptyNode -// | 369 = v__ast__EnumField -// | 336 = v__ast__Expr +// | 369 = v__ast__CallArg +// | 365 = v__ast__ConstField +// | 370 = v__ast__EmptyNode +// | 371 = v__ast__EnumField +// | 338 = v__ast__Expr // | 211 = v__ast__File -// | 364 = v__ast__GlobalField -// | 370 = v__ast__IfBranch -// | 371 = v__ast__MatchBranch -// | 318 = v__ast__NodeError -// | 372 = v__ast__Param -// | 366 = v__ast__ScopeObject -// | 373 = v__ast__SelectBranch -// | 361 = v__ast__Stmt -// | 374 = v__ast__StructField -// | 375 = v__ast__StructInitField +// | 366 = v__ast__GlobalField +// | 372 = v__ast__IfBranch +// | 373 = v__ast__MatchBranch +// | 320 = v__ast__NodeError +// | 374 = v__ast__Param +// | 368 = v__ast__ScopeObject +// | 375 = v__ast__SelectBranch +// | 363 = v__ast__Stmt +// | 376 = v__ast__StructField +// | 377 = v__ast__StructInitField struct v__ast__Node { union { v__ast__CallArg* _v__ast__CallArg; @@ -2893,7 +2853,7 @@ struct v__ast__Node { // Union sum type v__ast__ComptTimeConstValue = -// | 303 = v__ast__EmptyExpr +// | 305 = v__ast__EmptyExpr // | 15 = f32 // | 16 = f64 // | 6 = i16 @@ -2927,8 +2887,8 @@ struct v__ast__ComptTimeConstValue { // Union sum type v__ast__IdentInfo = -// | 416 = v__ast__IdentFn -// | 417 = v__ast__IdentVar +// | 418 = v__ast__IdentFn +// | 419 = v__ast__IdentVar struct v__ast__IdentInfo { union { v__ast__IdentFn* _v__ast__IdentFn; @@ -2939,14 +2899,14 @@ struct v__ast__IdentInfo { // Union sum type v__ast__AsmArg = -// | 437 = v__ast__AsmAddressing -// | 438 = v__ast__AsmAlias -// | 439 = v__ast__AsmDisp -// | 362 = v__ast__AsmRegister -// | 291 = v__ast__BoolLiteral -// | 296 = v__ast__CharLiteral -// | 305 = v__ast__FloatLiteral -// | 312 = v__ast__IntegerLiteral +// | 439 = v__ast__AsmAddressing +// | 440 = v__ast__AsmAlias +// | 441 = v__ast__AsmDisp +// | 364 = v__ast__AsmRegister +// | 293 = v__ast__BoolLiteral +// | 298 = v__ast__CharLiteral +// | 307 = v__ast__FloatLiteral +// | 314 = v__ast__IntegerLiteral // | 20 = string struct v__ast__AsmArg { union { @@ -2965,20 +2925,20 @@ struct v__ast__AsmArg { // Union sum type v__ast__TypeInfo = -// | 470 = v__ast__Aggregate -// | 472 = v__ast__Alias -// | 452 = v__ast__Array -// | 480 = v__ast__ArrayFixed -// | 481 = v__ast__Chan -// | 486 = v__ast__Enum -// | 484 = v__ast__FnType -// | 485 = v__ast__GenericInst -// | 475 = v__ast__Interface -// | 453 = v__ast__Map -// | 483 = v__ast__MultiReturn -// | 457 = v__ast__Struct -// | 476 = v__ast__SumType -// | 482 = v__ast__Thread +// | 472 = v__ast__Aggregate +// | 474 = v__ast__Alias +// | 454 = v__ast__Array +// | 482 = v__ast__ArrayFixed +// | 483 = v__ast__Chan +// | 488 = v__ast__Enum +// | 486 = v__ast__FnType +// | 487 = v__ast__GenericInst +// | 477 = v__ast__Interface +// | 455 = v__ast__Map +// | 485 = v__ast__MultiReturn +// | 459 = v__ast__Struct +// | 478 = v__ast__SumType +// | 484 = v__ast__Thread struct v__ast__TypeInfo { union { v__ast__Aggregate* _v__ast__Aggregate; @@ -3543,7 +3503,14 @@ struct strings__textscanner__TextScanner { -struct rand__ShuffleConfigStruct { +struct rand__config__NormalConfigStruct { + f64 mu; + f64 sigma; +}; + + + +struct rand__config__ShuffleConfigStruct { int start; int end; }; @@ -3556,14 +3523,6 @@ struct rand__config__PRNGConfigStruct { -struct rand__wyrand__WyRandRNG { - u64 state; - int bytes_left; - u64 buffer; -}; - - - struct v__token__WIndex { string word; int index; @@ -4043,18 +4002,9 @@ struct v__gen__c__GenSafeIntegerCfg { -struct math__DigitParams { - int base; - bool reverse; -}; - - - -struct math__ChebSeries { - Array_f64 c; - int order; - f64 a; - f64 b; +struct rand__buffer__PRNGBuffer { + int bytes_left; + u64 buffer; }; @@ -4313,6 +4263,8 @@ struct v__pref__Preferences { string test_runner; string profile_file; string dump_c_flags; + string dump_modules; + string dump_files; string cflags; string ccompiler; string third_party_option; @@ -4438,6 +4390,15 @@ struct v__errors__Error { +struct rand__wyrand__WyRandRNG { + rand__buffer__PRNGBuffer PRNGBuffer; + u64 state; + int bytes_left; + u64 buffer; +}; + + + struct v__token__KeywordsMatcher { int len_min; int len_max; @@ -6298,6 +6259,11 @@ struct multi_return_f64_int { int arg1; }; +struct multi_return_f64_f64 { + f64 arg0; + f64 arg1; +}; + struct multi_return_int_int_int { int arg0; int arg1; @@ -6423,17 +6389,6 @@ struct multi_return_u64_string { string arg1; }; -struct multi_return_i64_i64_i64 { - i64 arg0; - i64 arg1; - i64 arg2; -}; - -struct multi_return_f64_f64 { - f64 arg0; - f64 arg1; -}; - // END_multi_return_structs @@ -6521,6 +6476,24 @@ struct _option_v__token__Kind { byte data[sizeof(v__token__Kind) > 0 ? sizeof(v__token__Kind) : 1]; }; +struct _option_time__Time { + byte state; + IError err; + byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; +}; + +struct _option_multi_return_int_int_int { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; +}; + +struct _option_multi_return_int_int_int_int_i64_bool { + byte state; + IError err; + byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; +}; + struct _option_bool { byte state; IError err; @@ -6599,24 +6572,6 @@ struct _option_term__Coord { byte data[sizeof(term__Coord) > 0 ? sizeof(term__Coord) : 1]; }; -struct _option_time__Time { - byte state; - IError err; - byte data[sizeof(time__Time) > 0 ? sizeof(time__Time) : 1]; -}; - -struct _option_multi_return_int_int_int { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int) > 0 ? sizeof(multi_return_int_int_int) : 1]; -}; - -struct _option_multi_return_int_int_int_int_i64_bool { - byte state; - IError err; - byte data[sizeof(multi_return_int_int_int_int_i64_bool) > 0 ? sizeof(multi_return_int_int_int_int_i64_bool) : 1]; -}; - struct _option_v__vmod__Manifest { byte state; IError err; @@ -6653,6 +6608,12 @@ struct _option_f32 { byte data[sizeof(f32) > 0 ? sizeof(f32) : 1]; }; +struct _option_multi_return_f64_f64 { + byte state; + IError err; + byte data[sizeof(multi_return_f64_f64) > 0 ? sizeof(multi_return_f64_f64) : 1]; +}; + struct _option_v__pref__OS { byte state; IError err; @@ -7337,7 +7298,7 @@ IError _const_none__; // inited later VV_LOCAL_SYMBOL string None___str(None__ _d1); IError _v_error(string message); IError error_with_code(string message, int code); -VV_LOCAL_SYMBOL void opt_ok(voidptr data, Option* option, int size); +VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void opt_ok2(voidptr data, _option* option, int size); VV_LOCAL_SYMBOL void _result_ok(voidptr data, _result* res, int size); string none_str(none _d2); @@ -7545,18 +7506,6 @@ bool ArrayFlags_all(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_set(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_clear(ArrayFlags* e, ArrayFlags flag); void ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag); -#define _const_dl__version 1 -string _const_dl__dl_ext; // inited later -string dl__get_shared_library_extension(void); -string dl__get_libname(string libname); -_option_voidptr dl__open_opt(string filename, int flags); -_option_voidptr dl__sym_opt(voidptr shared_object_handle, string symbol); -#define _const_dl__rtld_now 0 -#define _const_dl__rtld_lazy 0 -voidptr dl__open(string filename, int flags); -bool dl__close(voidptr handle); -voidptr dl__sym(voidptr handle, string symbol); -string dl__dlerror(void); strings__textscanner__TextScanner strings__textscanner__new(string input); void strings__textscanner__TextScanner_free(strings__textscanner__TextScanner* ss); int strings__textscanner__TextScanner_remaining(strings__textscanner__TextScanner* ss); @@ -7572,6 +7521,18 @@ int strings__textscanner__TextScanner_peek_back_n(strings__textscanner__TextScan int strings__textscanner__TextScanner_current(strings__textscanner__TextScanner* ss); void strings__textscanner__TextScanner_reset(strings__textscanner__TextScanner* ss); void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanner* ss); +#define _const_dl__version 1 +string _const_dl__dl_ext; // inited later +string dl__get_shared_library_extension(void); +string dl__get_libname(string libname); +_option_voidptr dl__open_opt(string filename, int flags); +_option_voidptr dl__sym_opt(voidptr shared_object_handle, string symbol); +#define _const_dl__rtld_now 0 +#define _const_dl__rtld_lazy 0 +voidptr dl__open(string filename, int flags); +bool dl__close(voidptr handle); +voidptr dl__sym(voidptr handle, string symbol); +string dl__dlerror(void); Array_string os__cmdline__options(Array_string args, string param); string os__cmdline__option(Array_string args, string param, string def); Array_string os__cmdline__options_before(Array_string args, Array_string what); @@ -7621,6 +7582,125 @@ string v__token__kind_to_string(v__token__Kind k); _option_v__token__Kind v__token__kind_from_string(string s); int v__mathutil__min_T_int(int a, int b); int v__mathutil__max_T_int(int a, int b); +i64 time__portable_timegm(struct tm* t); +int time__days_from_civil(int oy, int m, int d); +string time__Time_format(time__Time t); +string time__Time_format_ss(time__Time t); +string time__Time_format_ss_milli(time__Time t); +string time__Time_format_ss_micro(time__Time t); +string time__Time_hhmm(time__Time t); +string time__Time_hhmmss(time__Time t); +string time__Time_hhmm12(time__Time t); +string time__Time_ymmdd(time__Time t); +string time__Time_ddmmy(time__Time t); +string time__Time_md(time__Time t); +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); +Array_string _const_time__tokens_2; // inited later +Array_string _const_time__tokens_3; // inited later +Array_string _const_time__tokens_4; // inited later +string time__Time_custom_format(time__Time t, string s); +string time__Time_clean(time__Time t); +string time__Time_clean12(time__Time t); +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); +string time__Time_utc_string(time__Time t); +VV_LOCAL_SYMBOL f64 time__mceil(f64 x); +bool time__Time__eq(time__Time t1, time__Time t2); +bool time__Time__lt(time__Time t1, time__Time t2); +time__Duration time__Time__minus(time__Time lhs, time__Time rhs); +_option_time__Time time__parse_rfc3339(string s); +_option_time__Time time__parse(string s); +_option_time__Time time__parse_iso8601(string s); +_option_time__Time time__parse_rfc2822(string s); +VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s); +VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); +string time__TimeParseError_msg(time__TimeParseError err); +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); +void time__StopWatch_start(time__StopWatch* t); +void time__StopWatch_restart(time__StopWatch* t); +void time__StopWatch_stop(time__StopWatch* t); +void time__StopWatch_pause(time__StopWatch* t); +time__Duration time__StopWatch_elapsed(time__StopWatch t); +time__Time time__now(void); +time__Time time__utc(void); +time__Time time__new_time(time__Time t); +i64 time__ticks(void); +string time__Time_str(time__Time t); +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); +string time__Time_strftime(time__Time t, string fmt); +string _const_time__days_string; // a string literal, inited later +Array_string _const_time__long_days; // inited later +Array_int _const_time__month_days; // inited later +string _const_time__months_string; // a string literal, inited later +Array_string _const_time__long_months; // inited later +i64 _const_time__absolute_zero_year; // inited later +#define _const_time__seconds_per_minute 60 +#define _const_time__seconds_per_hour 3600 +#define _const_time__seconds_per_day 86400 +#define _const_time__seconds_per_week 604800 +#define _const_time__days_per_400_years 146097 +#define _const_time__days_per_100_years 36524 +#define _const_time__days_per_4_years 1461 +#define _const_time__days_in_year 365 +Array_int _const_time__days_before; // inited later +string time__Time_smonth(time__Time* t); +i64 time__Time_unix_time(time__Time* t); +i64 time__Time_unix_time_milli(time__Time* t); +time__Time time__Time_add(time__Time* t, time__Duration d); +time__Time time__Time_add_seconds(time__Time* t, int seconds); +time__Time time__Time_add_days(time__Time* t, int days); +time__Duration time__since(time__Time t); +string time__Time_relative(time__Time* t); +string time__Time_relative_short(time__Time* t); +int time__day_of_week(int y, int m, int d); +int time__Time_day_of_week(time__Time* t); +string time__Time_weekday_str(time__Time* t); +string time__Time_long_weekday_str(time__Time* t); +bool time__is_leap_year(int year); +_option_int time__days_in_month(int month, int year); +string time__Time_debug(time__Time* t); +time__Duration _const_time__nanosecond; // inited later +time__Duration _const_time__microsecond; // inited later +time__Duration _const_time__millisecond; // inited later +time__Duration _const_time__second; // inited later +time__Duration _const_time__minute; // inited later +time__Duration _const_time__hour; // inited later +time__Duration _const_time__infinite; // inited later +i64 time__Duration_nanoseconds(time__Duration d); +i64 time__Duration_microseconds(time__Duration d); +i64 time__Duration_milliseconds(time__Duration d); +f64 time__Duration_seconds(time__Duration d); +f64 time__Duration_minutes(time__Duration d); +f64 time__Duration_hours(time__Duration d); +string time__Duration_str(time__Duration d); +int time__offset(void); +u64 _const_time__start_time; // inited later +u64 _const_time__freq_time; // inited later +i64 _const_time__start_local_time; // inited later +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); +VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void); +VV_LOCAL_SYMBOL u64 time__init_win_time_start(void); +u64 time__sys_mono_now(void); +VV_LOCAL_SYMBOL u64 time__vpc_now(void); +VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void); +time__Time time__Time_local(time__Time* t); +VV_LOCAL_SYMBOL time__Time time__win_now(void); +VV_LOCAL_SYMBOL time__Time time__win_utc(void); +i64 time__SystemTime_unix_time(time__SystemTime st); +time__Time time__darwin_now(void); +time__Time time__linux_now(void); +time__Time time__solaris_now(void); +time__Time time__darwin_utc(void); +time__Time time__linux_utc(void); +time__Time time__solaris_utc(void); +void time__sleep(time__Duration duration); +u32 time__Duration_sys_milliseconds(time__Duration d); +time__Time time__unix(i64 abs); +time__Time time__unix2(i64 abs, int microsecond); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); void v__dotgraph__start_digraph(void); VV_LOCAL_SYMBOL void anon_fn_6b9593b3d6ef610a__82(void); v__dotgraph__DotGraph* v__dotgraph__new(string name, string label, string color); @@ -7660,58 +7740,6 @@ u32 hash__fnv1a__sum32_bytes(u8* data, int data_len); u64 hash__fnv1a__sum64_string(string data); u64 hash__fnv1a__sum64(Array_u8 data); u64 hash__fnv1a__sum64_bytes(u8* data, int data_len); -f64 _const_math__internal__f64_epsilon = 2.220446049250313e-16; // precomputed -f64 _const_math__internal__sqrt_f64_epsilon = 3.725290298461914e-09; // precomputed -f64 _const_math__internal__root3_f64_epsilon = 6.055454452393343e-06; // precomputed -f64 _const_math__internal__root4_f64_epsilon = 0.0001220703125; // precomputed -f64 _const_math__internal__root5_f64_epsilon = 0.000740095979741405; // precomputed -f64 _const_math__internal__root6_f64_epsilon = 0.002460783300575925; // precomputed -f64 _const_math__internal__log_f64_epsilon = -36.04365338911715; // precomputed -f64 _const_math__internal__f64_min = 2.2250738585072014e-308; // precomputed -f64 _const_math__internal__sqrt_f64_min = 3.7291703656001034e-155; // precomputed -f64 _const_math__internal__root3_f64_min = 2.8126442852362996e-103; // precomputed -f64 _const_math__internal__root4_f64_min = 1.221338669755462e-77; // precomputed -f64 _const_math__internal__root5_f64_min = 2.9476022969691763e-62; // precomputed -f64 _const_math__internal__root6_f64_min = 5.303436890579822e-52; // precomputed -f64 _const_math__internal__log_f64_min = -708.3964185322641; // precomputed -f64 _const_math__internal__f64_max = 1.7976931348623157e+308; // precomputed -f64 _const_math__internal__sqrt_f64_max = 1.3407807929942596e+154; // precomputed -f64 _const_math__internal__root3_f64_max = 5.64380309412229e+102; // precomputed -f64 _const_math__internal__root4_f64_max = 1.157920892373162e+77; // precomputed -f64 _const_math__internal__root5_f64_max = 4.4765466227572707e+61; // precomputed -f64 _const_math__internal__root6_f64_max = 2.3756689782295612e+51; // precomputed -f64 _const_math__internal__log_f64_max = 709.782712893384; // precomputed -f64 _const_math__internal__f32_epsilon = 1.1920928955078125e-07; // precomputed -f64 _const_math__internal__sqrt_f32_epsilon = 0.00034526698300124393; // precomputed -f64 _const_math__internal__root3_f32_epsilon = 0.00492156660115185; // precomputed -f64 _const_math__internal__root4_f32_epsilon = 0.018581361171917516; // precomputed -f64 _const_math__internal__root5_f32_epsilon = 0.04123462221165294; // precomputed -f64 _const_math__internal__root6_f32_epsilon = 0.07015387801933583; // precomputed -f64 _const_math__internal__log_f32_epsilon = -15.942385152878742; // precomputed -f64 _const_math__internal__f32_min = 2.938735877055719e-39; // precomputed -f64 _const_math__internal__sqrt_f32_min = 2.710505431213761e-20; // precomputed -f64 _const_math__internal__root3_f32_min = 2.273736754432324e-13; // precomputed -f64 _const_math__internal__root4_f32_min = 3.2927225399135965e-10; // precomputed -f64 _const_math__internal__root5_f32_min = 2.5944428542140822e-08; // precomputed -f64 _const_math__internal__root6_f32_min = 4.768371582031254e-07; // precomputed -f64 _const_math__internal__log_f32_min = -87.3365447505531; // precomputed -f64 _const_math__internal__f32_max = 3.4028234663852886e+38; // precomputed -f64 _const_math__internal__sqrt_f32_max = 1.844674352395373e+19; // precomputed -f64 _const_math__internal__root3_f32_max = 6.981463519622324e+12; // precomputed -f64 _const_math__internal__root4_f32_max = 4.2949672319999986e+09; // precomputed -f64 _const_math__internal__root5_f32_max = 5.085900785596004e+07; // precomputed -f64 _const_math__internal__root6_f32_max = 2.642245923380775e+06; // precomputed -f64 _const_math__internal__log_f32_max = 88.72283905206835; // precomputed -f64 _const_math__internal__sflt_epsilon = 0.00048828125; // precomputed -f64 _const_math__internal__sqrt_sflt_epsilon = 0.02209708691207961; // precomputed -f64 _const_math__internal__root3_sflt_epsilon = 0.07874506561842959; // precomputed -f64 _const_math__internal__root4_sflt_epsilon = 0.14865088937534013; // precomputed -f64 _const_math__internal__root5_sflt_epsilon = 0.217637640824031; // precomputed -f64 _const_math__internal__root6_sflt_epsilon = 0.28061551207734325; // precomputed -f64 _const_math__internal__log_sflt_epsilon = -7.6246189861593985; // precomputed -#define _const_math__internal__max_int_fact_arg 170 -f64 _const_math__internal__max_f64_fact_arg = 171.; // precomputed -f64 _const_math__internal__max_long_f64_fact_arg = 1755.5; // precomputed VV_LOCAL_SYMBOL string flag__UnkownFlagError_msg(flag__UnkownFlagError err); VV_LOCAL_SYMBOL string flag__ArgsCountError_msg(flag__ArgsCountError err); VV_LOCAL_SYMBOL void flag__Flag_free(flag__Flag* f); @@ -7968,10 +7996,18 @@ _option_i64 os__File_tell(os__File* f); rune _const_os__fslash = '/'; // precomputed #define _const_os__bslash '\\' rune _const_os__dot = '.'; // precomputed +rune _const_os__qmark = '?'; // precomputed +string _const_os__dot_dot; // a string literal, inited later +string _const_os__empty_str; // a string literal, inited later +string _const_os__dot_str; // a string literal, inited later bool os__is_abs_path(string path); +string os__abs_path(string path); +string os__norm_path(string path); +VV_LOCAL_SYMBOL string os__clean_path(string path); VV_LOCAL_SYMBOL int os__win_volume_len(string path); +VV_LOCAL_SYMBOL string os__get_volume(string path); VV_LOCAL_SYMBOL bool os__is_slash(u8 b); -VV_LOCAL_SYMBOL bool os__is_device_path(string path); +VV_LOCAL_SYMBOL bool os__is_unc_path(string path); VV_LOCAL_SYMBOL bool os__has_drive_letter(string path); VV_LOCAL_SYMBOL bool os__starts_w_slash_slash(string path); VV_LOCAL_SYMBOL bool os__is_drive_rooted(string path); @@ -8186,262 +8222,10 @@ string v__depgraph__DepGraph_display(v__depgraph__DepGraph* graph); string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph); VV_LOCAL_SYMBOL multi_return_bool_Array_string v__depgraph__NodeNames_is_part_of_cycle(v__depgraph__NodeNames* nn, string name, Array_string already_seen); void v__depgraph__show(v__depgraph__DepGraph* graph, string path); -f64 math__fabs(f64 x); -u64 _const_math__uvnan = 9221120237041090561U; // precomputed -u64 _const_math__uvinf = 9218868437227405312U; // precomputed -u64 _const_math__uvneginf = 18442240474082181120U; // precomputed -u64 _const_math__uvone = 4607182418800017408U; // precomputed -#define _const_math__mask 2047 -#define _const_math__shift 52 -#define _const_math__bias 1023 -u64 _const_math__normalize_smallest_mask = 4503599627370496U; // precomputed -u64 _const_math__sign_mask = 9223372036854775808U; // precomputed -u64 _const_math__frac_mask = 4503599627370495U; // precomputed -f64 math__inf(int sign); -f64 math__nan(void); -bool math__is_nan(f64 f); -bool math__is_inf(f64 f, int sign); -bool math__is_finite(f64 f); -multi_return_f64_int math__normalize(f64 x); -f64 math__cbrt(f64 a); -f64 _const_math__e = 2.718281828459045; // precomputed -f64 _const_math__pi = 3.141592653589793; // precomputed -f64 _const_math__pi_2; // inited later -f64 _const_math__pi_4; // inited later -f64 _const_math__phi = 1.618033988749895; // precomputed -f64 _const_math__tau = 6.283185307179586; // precomputed -f64 _const_math__sqrt2 = 1.4142135623730951; // precomputed -f64 _const_math__sqrt_e = 1.6487212707001282; // precomputed -f64 _const_math__sqrt_pi = 1.772453850905516; // precomputed -f64 _const_math__sqrt_tau = 2.5066282746310007; // precomputed -f64 _const_math__sqrt_phi = 1.272019649514069; // precomputed -f64 _const_math__ln2 = 0.6931471805599453; // precomputed -f64 _const_math__log2_e; // inited later -f64 _const_math__ln10 = 2.302585092994046; // precomputed -f64 _const_math__log10_e; // inited later -f64 _const_math__max_f32 = 3.4028234663852886e+38; // precomputed -f64 _const_math__smallest_non_zero_f32 = 3.503246160812043e-46; // precomputed -f64 _const_math__max_f64 = 1.7976931348623157e+308; // precomputed -f64 _const_math__smallest_non_zero_f64 = 0; // precomputed -#define _const_math__max_i8 127 -#define _const_math__min_i8 -128 -#define _const_math__max_i16 32767 -#define _const_math__min_i16 -32768 -#define _const_math__max_i32 2147483647 -#define _const_math__min_i32 -2147483648 -i64 _const_math__min_i64; // inited later -i64 _const_math__max_i64; // inited later -#define _const_math__max_u8 255 -#define _const_math__max_u16 65535 -u32 _const_math__max_u32 = 4294967295; // precomputed -u64 _const_math__max_u64 = 18446744073709551615U; // precomputed -f64 math__mod(f64 x, f64 y); -f64 math__fmod(f64 x, f64 y); -i64 math__gcd(i64 a_, i64 b_); -multi_return_i64_i64_i64 math__egcd(i64 a, i64 b); -i64 math__lcm(i64 a, i64 b); -f64 _const_math__erx = 0.8450629115104675; // precomputed -f64 _const_math__efx = 0.1283791670955126; // precomputed -f64 _const_math__efx8 = 1.0270333367641007; // precomputed -f64 _const_math__pp0 = 0.12837916709551256; // precomputed -f64 _const_math__pp1 = -0.3250421072470015; // precomputed -f64 _const_math__pp2 = -0.02848174957559851; // precomputed -f64 _const_math__pp3 = -0.005770270296489442; // precomputed -f64 _const_math__pp4 = -2.3763016656650163e-05; // precomputed -f64 _const_math__qq1 = 0.39791722395915535; // precomputed -f64 _const_math__qq2 = 0.0650222499887673; // precomputed -f64 _const_math__qq3 = 0.005081306281875766; // precomputed -f64 _const_math__qq4 = 0.00013249473800432164; // precomputed -f64 _const_math__qq5 = -3.960228278775368e-06; // precomputed -f64 _const_math__pa0 = -0.0023621185607526594; // precomputed -f64 _const_math__pa1 = 0.41485611868374833; // precomputed -f64 _const_math__pa2 = -0.3722078760357013; // precomputed -f64 _const_math__pa3 = 0.31834661990116175; // precomputed -f64 _const_math__pa4 = -0.11089469428239668; // precomputed -f64 _const_math__pa5 = 0.035478304325618236; // precomputed -f64 _const_math__pa6 = -0.002166375594868791; // precomputed -f64 _const_math__qa1 = 0.10642088040084423; // precomputed -f64 _const_math__qa2 = 0.540397917702171; // precomputed -f64 _const_math__qa3 = 0.07182865441419627; // precomputed -f64 _const_math__qa4 = 0.12617121980876164; // precomputed -f64 _const_math__qa5 = 0.01363708391202905; // precomputed -f64 _const_math__qa6 = 0.011984499846799107; // precomputed -f64 _const_math__ra0 = -0.009864944034847148; // precomputed -f64 _const_math__ra1 = -0.6938585727071818; // precomputed -f64 _const_math__ra2 = -10.558626225323291; // precomputed -f64 _const_math__ra3 = -62.375332450326006; // precomputed -f64 _const_math__ra4 = -162.39666946257347; // precomputed -f64 _const_math__ra5 = -184.60509290671104; // precomputed -f64 _const_math__ra6 = -81.2874355063066; // precomputed -f64 _const_math__ra7 = -9.814329344169145; // precomputed -f64 _const_math__sa1 = 19.651271667439257; // precomputed -f64 _const_math__sa2 = 137.65775414351904; // precomputed -f64 _const_math__sa3 = 434.56587747522923; // precomputed -f64 _const_math__sa4 = 645.3872717332679; // precomputed -f64 _const_math__sa5 = 429.00814002756783; // precomputed -f64 _const_math__sa6 = 108.63500554177944; // precomputed -f64 _const_math__sa7 = 6.570249770319282; // precomputed -f64 _const_math__sa8 = -0.0604244152148581; // precomputed -f64 _const_math__rb0 = -0.0098649429247001; // precomputed -f64 _const_math__rb1 = -0.799283237680523; // precomputed -f64 _const_math__rb2 = -17.757954917754752; // precomputed -f64 _const_math__rb3 = -160.63638485582192; // precomputed -f64 _const_math__rb4 = -637.5664433683896; // precomputed -f64 _const_math__rb5 = -1025.0951316110772; // precomputed -f64 _const_math__rb6 = -483.5191916086514; // precomputed -f64 _const_math__sb1 = 30.33806074348246; // precomputed -f64 _const_math__sb2 = 325.7925129965739; // precomputed -f64 _const_math__sb3 = 1536.729586084437; // precomputed -f64 _const_math__sb4 = 3199.8582195085955; // precomputed -f64 _const_math__sb5 = 2553.0504064331644; // precomputed -f64 _const_math__sb6 = 474.52854120695537; // precomputed -f64 _const_math__sb7 = -22.44095244658582; // precomputed -f64 math__erf(f64 a); -f64 math__erfc(f64 a); -f64 _const_math__f64_max_exp = 1024.; // precomputed -f64 _const_math__f64_min_exp = -1021.; // precomputed -f64 _const_math__threshold = 709.782712893384; // precomputed -f64 _const_math__ln2_x56 = 38.816242111356935; // precomputed -f64 _const_math__ln2_halfx3 = 1.0397207708399179; // precomputed -f64 _const_math__ln2_half = 0.34657359027997264; // precomputed -f64 _const_math__ln2hi = 0.6931471803691238; // precomputed -f64 _const_math__ln2lo = 1.9082149292705877e-10; // precomputed -f64 _const_math__inv_ln2 = 1.4426950408889634; // precomputed -f64 _const_math__expm1_q1 = -0.03333333333333313; // precomputed -f64 _const_math__expm1_q2 = 0.0015873015872548146; // precomputed -f64 _const_math__expm1_q3 = -7.93650757867488e-05; // precomputed -f64 _const_math__expm1_q4 = 4.008217827329362e-06; // precomputed -f64 _const_math__expm1_q5 = -2.0109921818362437e-07; // precomputed -f64 math__exp(f64 x); -f64 math__exp2(f64 x); -f64 math__ldexp(f64 frac, int exp); -multi_return_f64_int math__frexp(f64 x); -f64 math__expm1(f64 x); -VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k); -f64 math__factorial(f64 n); -f64 math__log_factorial(f64 n); -VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n); -i64 math__factoriali(int n); -f64 _const_math__log_sqrt_2pi = 0.9189385332046728; // precomputed -Array_f64 _const_math__bernoulli; // inited later -Array_f64 _const_math__factorials_table; // inited later -Array_f64 _const_math__log_factorials_table; // inited later -f64 math__floor(f64 x); -f64 math__ceil(f64 x); -f64 math__trunc(f64 x); -f64 math__round(f64 x); -f64 math__round_to_even(f64 x); -VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x); -f64 math__gamma(f64 a); -f64 math__log_gamma(f64 x); -multi_return_f64_int math__log_gamma_sign(f64 a); -VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_); -Array_f64 _const_math__gamma_p; // inited later -Array_f64 _const_math__gamma_q; // inited later -Array_f64 _const_math__gamma_s; // inited later -Array_f64 _const_math__lgamma_a; // inited later -Array_f64 _const_math__lgamma_r; // inited later -Array_f64 _const_math__lgamma_s; // inited later -Array_f64 _const_math__lgamma_t; // inited later -Array_f64 _const_math__lgamma_u; // inited later -Array_f64 _const_math__lgamma_v; // inited later -Array_f64 _const_math__lgamma_w; // inited later -f64 math__hypot(f64 x, f64 y); -f64 math__acosh(f64 x); -f64 math__asinh(f64 x); -f64 math__atanh(f64 x); -f64 _const_math__morebits = 6.123233995736766e-17; // precomputed -f64 _const_math__tan3pio8 = 2.414213562373095; // precomputed -VV_LOCAL_SYMBOL f64 math__xatan(f64 x); -VV_LOCAL_SYMBOL f64 math__satan(f64 x); -f64 math__atan(f64 x); -f64 math__atan2(f64 y, f64 x); -f64 math__asin(f64 x_); -f64 math__acos(f64 x); -f64 math__log_n(f64 x, f64 b); -f64 math__log10(f64 x); -f64 math__log2(f64 x); -f64 math__log1p(f64 x); -f64 math__log_b(f64 x); -int math__ilog_b(f64 x); -VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_); -f64 math__log(f64 a); -f64 math__aprox_sin(f64 a); -f64 math__aprox_cos(f64 a); -f64 math__copysign(f64 x, f64 y); -f64 math__degrees(f64 radians); -Array_int math__digits(i64 num, math__DigitParams params); -int math__count_digits(i64 number); -multi_return_f64_f64 math__minmax(f64 a, f64 b); -f64 math__clamp(f64 x, f64 a, f64 b); -f64 math__sign(f64 n); -int math__signi(f64 n); -f64 math__radians(f64 degrees); -bool math__signbit(f64 x); -bool math__tolerance(f64 a, f64 b, f64 tol); -bool math__close(f64 a, f64 b); -bool math__veryclose(f64 a, f64 b); -bool math__alike(f64 a, f64 b); -VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x); -VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x); -int math__min_T_int(int a, int b); -f64 math__abs_T_f64(f64 a); -f64 _const_math__modf_maxpowtwo = 4.503599627370496e+15; // precomputed -multi_return_f64_f64 math__modf(f64 f); -f32 math__nextafter32(f32 x, f32 y); -f64 math__nextafter(f64 x, f64 y); -VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x); -VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x); -VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x); -f32 math__powf(f32 a, f32 b); -Array_f64 _const_math__pow10tab; // inited later -Array_f64 _const_math__pow10postab32; // inited later -Array_f64 _const_math__pow10negtab32; // inited later -f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b); -f64 math__pow10(int n); -i64 math__powi(i64 a, i64 b); -f64 math__pow(f64 x, f64 y); -f64 math__q_rsqrt(f64 x); -f64 math__scalbn(f64 x, int n_); -f32 math__cosf(f32 a); -f32 math__sinf(f32 a); -Array_f64 _const_math__sin_data; // inited later -math__ChebSeries _const_math__sin_cs; // inited later -Array_f64 _const_math__cos_data; // inited later -math__ChebSeries _const_math__cos_cs; // inited later -f64 math__sin(f64 x); -f64 math__cos(f64 x); -f32 math__pure_v_but_overriden_by_c_cosf(f32 a); -f32 math__pure_v_but_overriden_by_c_sinf(f32 a); -multi_return_f64_f64 math__sincos(f64 x); -f64 math__sinh(f64 x_); -f64 math__cosh(f64 x); -f32 math__sqrtf(f32 a); -f64 math__sqrt(f64 a); -f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a); -i64 math__sqrti(i64 a); -f32 math__tanf(f32 a); -Array_f64 _const_math__tan_p; // inited later -Array_f64 _const_math__tan_q; // inited later -f64 _const_math__tan_dp1 = 0.7853981554508209; // precomputed -f64 _const_math__tan_dp2 = 7.946627356147928e-09; // precomputed -f64 _const_math__tan_dp3 = 3.061616997868383e-17; // precomputed -f64 _const_math__tan_lossth = 1.073741824e+09; // precomputed -f64 math__tan(f64 a); -f32 math__pure_v_but_overriden_by_c_tanf(f32 a); -f64 math__cot(f64 a); -Array_f64 _const_math__tanh_p; // inited later -Array_f64 _const_math__tanh_q; // inited later -f64 math__tanh(f64 x); -u32 math__f32_bits(f32 f); -f32 math__f32_from_bits(u32 b); -u64 math__f64_bits(f64 f); -f64 math__f64_from_bits(u64 b); -f64 math__with_set_low_word(f64 f, u32 lo); -f64 math__with_set_high_word(f64 f, u32 hi); -u32 math__get_high_word(f64 f); +VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); +Array_u32 rand__seed__time_seed_array(int count); +u32 rand__seed__time_seed_32(void); +u64 rand__seed__time_seed_64(void); string term__format(string msg, string open, string close); string term__format_rgb(int r, int g, int b, string msg, string open, string close); string term__rgb(int r, int g, int b, string msg); @@ -8541,124 +8325,10 @@ _option_string v__vcache__CacheManager_exists(v__vcache__CacheManager* cm, strin _option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string postfix, string key, string content); _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string postfix, string key); VV_LOCAL_SYMBOL int v__vcache__mypid(void); -i64 time__portable_timegm(struct tm* t); -int time__days_from_civil(int oy, int m, int d); -string time__Time_format(time__Time t); -string time__Time_format_ss(time__Time t); -string time__Time_format_ss_milli(time__Time t); -string time__Time_format_ss_micro(time__Time t); -string time__Time_hhmm(time__Time t); -string time__Time_hhmmss(time__Time t); -string time__Time_hhmm12(time__Time t); -string time__Time_ymmdd(time__Time t); -string time__Time_ddmmy(time__Time t); -string time__Time_md(time__Time t); -VV_LOCAL_SYMBOL string time__ordinal_suffix(int n); -Array_string _const_time__tokens_2; // inited later -Array_string _const_time__tokens_3; // inited later -Array_string _const_time__tokens_4; // inited later -string time__Time_custom_format(time__Time t, string s); -string time__Time_clean(time__Time t); -string time__Time_clean12(time__Time t); -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time); -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date); -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date); -string time__Time_utc_string(time__Time t); -bool time__Time__eq(time__Time t1, time__Time t2); -bool time__Time__lt(time__Time t1, time__Time t2); -time__Duration time__Time__minus(time__Time lhs, time__Time rhs); -_option_time__Time time__parse_rfc3339(string s); -_option_time__Time time__parse(string s); -_option_time__Time time__parse_iso8601(string s); -_option_time__Time time__parse_rfc2822(string s); -VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s); -VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s); -string time__TimeParseError_msg(time__TimeParseError err); -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code); -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts); -void time__StopWatch_start(time__StopWatch* t); -void time__StopWatch_restart(time__StopWatch* t); -void time__StopWatch_stop(time__StopWatch* t); -void time__StopWatch_pause(time__StopWatch* t); -time__Duration time__StopWatch_elapsed(time__StopWatch t); -time__Time time__now(void); -time__Time time__utc(void); -time__Time time__new_time(time__Time t); -i64 time__ticks(void); -string time__Time_str(time__Time t); -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond); -string time__Time_strftime(time__Time t, string fmt); -string _const_time__days_string; // a string literal, inited later -Array_string _const_time__long_days; // inited later -Array_int _const_time__month_days; // inited later -string _const_time__months_string; // a string literal, inited later -Array_string _const_time__long_months; // inited later -i64 _const_time__absolute_zero_year; // inited later -#define _const_time__seconds_per_minute 60 -#define _const_time__seconds_per_hour 3600 -#define _const_time__seconds_per_day 86400 -#define _const_time__seconds_per_week 604800 -#define _const_time__days_per_400_years 146097 -#define _const_time__days_per_100_years 36524 -#define _const_time__days_per_4_years 1461 -#define _const_time__days_in_year 365 -Array_int _const_time__days_before; // inited later -string time__Time_smonth(time__Time* t); -i64 time__Time_unix_time(time__Time* t); -i64 time__Time_unix_time_milli(time__Time* t); -time__Time time__Time_add(time__Time* t, time__Duration d); -time__Time time__Time_add_seconds(time__Time* t, int seconds); -time__Time time__Time_add_days(time__Time* t, int days); -time__Duration time__since(time__Time t); -string time__Time_relative(time__Time* t); -string time__Time_relative_short(time__Time* t); -int time__day_of_week(int y, int m, int d); -int time__Time_day_of_week(time__Time* t); -string time__Time_weekday_str(time__Time* t); -string time__Time_long_weekday_str(time__Time* t); -bool time__is_leap_year(int year); -_option_int time__days_in_month(int month, int year); -string time__Time_debug(time__Time* t); -time__Duration _const_time__nanosecond; // inited later -time__Duration _const_time__microsecond; // inited later -time__Duration _const_time__millisecond; // inited later -time__Duration _const_time__second; // inited later -time__Duration _const_time__minute; // inited later -time__Duration _const_time__hour; // inited later -time__Duration _const_time__infinite; // inited later -i64 time__Duration_nanoseconds(time__Duration d); -i64 time__Duration_microseconds(time__Duration d); -i64 time__Duration_milliseconds(time__Duration d); -f64 time__Duration_seconds(time__Duration d); -f64 time__Duration_minutes(time__Duration d); -f64 time__Duration_hours(time__Duration d); -string time__Duration_str(time__Duration d); -int time__offset(void); -u64 _const_time__start_time; // inited later -u64 _const_time__freq_time; // inited later -i64 _const_time__start_local_time; // inited later -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t); -VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void); -VV_LOCAL_SYMBOL u64 time__init_win_time_start(void); -u64 time__sys_mono_now(void); -VV_LOCAL_SYMBOL u64 time__vpc_now(void); -VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void); -time__Time time__Time_local(time__Time* t); -VV_LOCAL_SYMBOL time__Time time__win_now(void); -VV_LOCAL_SYMBOL time__Time time__win_utc(void); -i64 time__SystemTime_unix_time(time__SystemTime st); -time__Time time__darwin_now(void); -time__Time time__linux_now(void); -time__Time time__solaris_now(void); -time__Time time__darwin_utc(void); -time__Time time__linux_utc(void); -time__Time time__solaris_utc(void); -void time__sleep(time__Duration duration); -u32 time__Duration_sys_milliseconds(time__Duration d); -time__Time time__unix(i64 abs); -time__Time time__unix2(i64 abs, int microsecond); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_); -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_); +_option_string v__util__diff__find_working_diff_command(void); +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); string _const_v__vmod__err_label; // a string literal, inited later _option_v__vmod__Manifest v__vmod__from_file(string vmod_path); _option_v__vmod__Manifest v__vmod__decode(string contents); @@ -8697,6 +8367,16 @@ Array_string Array_v__cflag__CFlag_c_options_after_target(Array_v__cflag__CFlag Array_string Array_v__cflag__CFlag_c_options_without_object_files(Array_v__cflag__CFlag cflags); Array_string Array_v__cflag__CFlag_c_options_only_object_files(Array_v__cflag__CFlag cflags); multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_defines_others_libs(Array_v__cflag__CFlag cflags); +u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed +u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed +#define _const_rand__wyrand__seed_len 2 +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); +u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); +u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); +u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); +u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); +int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod); _option_v__pkgconfig__Main_ptr v__pkgconfig__main(Array_string args); VV_LOCAL_SYMBOL int compare_10129308118656229290_string(string* a, string* b) { @@ -8730,24 +8410,13 @@ bool runtime__is_64bit(void); bool runtime__is_little_endian(void); bool runtime__is_big_endian(void); int runtime__nr_cpus(void); -_option_string v__util__diff__find_working_diff_command(void); -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void); -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2); -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found); -VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev); -Array_u32 rand__seed__time_seed_array(int count); -u32 rand__seed__time_seed_32(void); -u64 rand__seed__time_seed_64(void); -u64 _const_rand__wyrand__wyp0 = 11562461410679940143U; // precomputed -u64 _const_rand__wyrand__wyp1 = 16646288086500911323U; // precomputed -#define _const_rand__wyrand__seed_len 2 -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data); -u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng); -u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng); -u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng); -u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng); -int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng); -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng); +f64 _const_rand__sqrt2 = 1.4142135623730951; // precomputed +VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a); +VV_LOCAL_SYMBOL f64 rand__mlog(f64 a); +VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x); +VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_); +VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b); +VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f); Array_rune _const_rand__clock_seq_hi_and_reserved_valid_values; // inited later string rand__uuid_v4(void); VV_LOCAL_SYMBOL string rand__internal_uuid_v4(rand__PRNG* rng); @@ -8787,6 +8456,11 @@ string rand__PRNG_string_from_set(rand__PRNG* rng, string charset, int len); string rand__PRNG_string(rand__PRNG* rng, int len); string rand__PRNG_hex(rand__PRNG* rng, int len); string rand__PRNG_ascii(rand__PRNG* rng, int len); +_option_bool rand__PRNG_bernoulli(rand__PRNG* rng, f64 p); +_option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct conf); +_option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf); +_option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p); +f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda); rand__PRNG* default_rng; // global4 rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config); rand__PRNG* rand__get_current_rng(void); @@ -8825,6 +8499,11 @@ string rand__string_from_set(string charset, int len); string rand__string(int len); string rand__hex(int len); string rand__ascii(int len); +_option_bool rand__bernoulli(f64 p); +_option_f64 rand__normal(rand__config__NormalConfigStruct conf); +_option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf); +_option_int rand__binomial(int n, f64 p); +f64 rand__exponential(f64 lambda); string _const_v__pref__default_module_path; // inited later v__pref__Preferences* v__pref__new_preferences(void); VV_LOCAL_SYMBOL void v__pref__Preferences_expand_lookup_paths(v__pref__Preferences* p); @@ -9343,6 +9022,7 @@ Array_v__ast__Type _const_v__ast__cptr_types; // inited later Array_v__ast__Type v__ast__merge_types(Array_Array_v__ast__Type params); v__ast__Type v__ast__mktyp(v__ast__Type typ); v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ); +bool v__ast__Table_type_is_for_pointer_arithmetic(v__ast__Table* t, v__ast__Type typ); string v__ast__TypeSymbol_str(v__ast__TypeSymbol* t); VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymbol* t, string fname); v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t); @@ -9510,6 +9190,7 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExpr* node, bool* continue_check); v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__CallExpr* node); VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node); +VV_LOCAL_SYMBOL void v__checker__Checker_set_node_expected_arg_types(v__checker__Checker* c, v__ast__CallExpr* node, v__ast__Fn* func); VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* c, string kind, string name, v__ast__Fn the_fn, v__ast__CallExpr node); VV_LOCAL_SYMBOL void v__checker__Checker_deprecate(v__checker__Checker* c, string kind, string name, string deprecation_message, time__Time now, time__Time after_time, v__token__Pos pos); VV_LOCAL_SYMBOL string v__checker__semicolonize(string main, string details); @@ -9646,10 +9327,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_struct(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string fn_name); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_free_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string fn_name); VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp); -string v__gen__c__type_to_str(StrIntpType x); -string v__gen__c__data_str(StrIntpType x); string _const_v__gen__c__si_s_code; // a string literal, inited later -VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name); VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__StrType typ); @@ -9671,7 +9349,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string str_fn_name); VV_LOCAL_SYMBOL StrIntpType v__gen__c__Gen_type_to_fmt(v__gen__c__Gen* g, v__ast__Type typ); VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_struct(v__gen__c__Gen* g, v__ast__Struct info, string styp, string str_fn_name); -VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); +VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr); +VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x); +VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind); Array_string _const_v__gen__c__c_reserved; // inited later Map_string_bool _const_v__gen__c__c_reserved_map; // inited later Array_string _const_v__gen__c__cmp_str; // inited later @@ -9830,6 +9510,7 @@ void v__gen__c__Gen_gen_c_android_sokol_main(v__gen__c__Gen* g); void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g); void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name); void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name); +void v__gen__c__Gen_gen_c_main_profile_hook(v__gen__c__Gen* g); void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g); Array_string v__gen__c__Gen_filter_only_matching_fn_names(v__gen__c__Gen* g, Array_string fnames); VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast__ComptimeSelector node); @@ -10211,7 +9892,6 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_ccompiler_options(v__builder__Bui VV_LOCAL_SYMBOL Array_string v__builder__Builder_all_args(v__builder__Builder* v, v__builder__CcompilerOptions ccoptions); VV_LOCAL_SYMBOL Array_string v__builder__Builder_thirdparty_object_args(v__builder__Builder* v, v__builder__CcompilerOptions ccoptions, Array_string middle); VV_LOCAL_SYMBOL void v__builder__Builder_setup_output_name(v__builder__Builder* v); -VV_LOCAL_SYMBOL void v__builder__Builder_dump_c_options(v__builder__Builder* v, Array_string all_args); void v__builder__Builder_cc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_ensure_linuxroot_exists(v__builder__Builder* b, string sysroot); VV_LOCAL_SYMBOL void v__builder__Builder_cc_linux_cross(v__builder__Builder* b); @@ -10233,6 +9913,10 @@ VV_LOCAL_SYMBOL void v__builder__Builder_cleanup_run_executable_after_exit(v__bu void v__builder__Builder_set_module_lookup_paths(v__builder__Builder* v); Array_string v__builder__Builder_get_builtin_files(v__builder__Builder* v); Array_string v__builder__Builder_get_user_files(v__builder__Builder* v); +void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all_args); +void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods); +void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files); +VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list); v__builder__RegKey _const_v__builder__hkey_local_machine; // inited later #define _const_v__builder__key_query_value 1 #define _const_v__builder__key_wow64_32key 512 @@ -10249,6 +9933,8 @@ VV_LOCAL_SYMBOL _option_v__builder__MsvcResult v__builder__find_msvc(bool m64_ta void v__builder__Builder_cc_msvc(v__builder__Builder* v); VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__builder__Builder* v, string path, Array_v__cflag__CFlag moduleflags); v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag cflags); +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r); +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r); void v__builder__Builder_rebuild_modules(v__builder__Builder* b); VV_LOCAL_SYMBOL void v__builder__Builder_v_build_module(v__builder__Builder* b, string vexe, string imp_path); VV_LOCAL_SYMBOL string v__builder__Builder_rebuild_cached_module(v__builder__Builder* b, string vexe, string imp_path); @@ -10367,24 +10053,24 @@ static IError I_Error_to_Interface_IError(Error* x); const int _IError_Error_index = 1; static IError I_MessageError_to_Interface_IError(MessageError* x); const int _IError_MessageError_index = 2; -static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); -const int _IError_flag__UnkownFlagError_index = 3; -static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); -const int _IError_flag__ArgsCountError_index = 4; -static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); -const int _IError_semver__InvalidComparatorFormatError_index = 5; -static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); -const int _IError_semver__EmptyInputError_index = 6; -static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); -const int _IError_semver__InvalidVersionFormatError_index = 7; -static IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x); -const int _IError_os__FileNotOpenedError_index = 8; -static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x); -const int _IError_os__SizeOfTypeIs0Error_index = 9; -static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); -const int _IError_os__ExecutableNotFoundError_index = 10; static IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x); -const int _IError_time__TimeParseError_index = 11; +const int _IError_time__TimeParseError_index = 3; +static IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x); +const int _IError_flag__UnkownFlagError_index = 4; +static IError I_flag__ArgsCountError_to_Interface_IError(flag__ArgsCountError* x); +const int _IError_flag__ArgsCountError_index = 5; +static IError I_semver__InvalidComparatorFormatError_to_Interface_IError(semver__InvalidComparatorFormatError* x); +const int _IError_semver__InvalidComparatorFormatError_index = 6; +static IError I_semver__EmptyInputError_to_Interface_IError(semver__EmptyInputError* x); +const int _IError_semver__EmptyInputError_index = 7; +static IError I_semver__InvalidVersionFormatError_to_Interface_IError(semver__InvalidVersionFormatError* x); +const int _IError_semver__InvalidVersionFormatError_index = 8; +static IError I_os__FileNotOpenedError_to_Interface_IError(os__FileNotOpenedError* x); +const int _IError_os__FileNotOpenedError_index = 9; +static IError I_os__SizeOfTypeIs0Error_to_Interface_IError(os__SizeOfTypeIs0Error* x); +const int _IError_os__SizeOfTypeIs0Error_index = 10; +static IError I_os__ExecutableNotFoundError_to_Interface_IError(os__ExecutableNotFoundError* x); +const int _IError_os__ExecutableNotFoundError_index = 11; static IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x); const int _IError_v__gen__c__UnsupportedAssertCtempTransform_index = 12; // ^^^ number of types for interface IError: 13 @@ -10408,6 +10094,12 @@ static inline string MessageError_msg_Interface_IError_method_wrapper(MessageErr static inline int MessageError_code_Interface_IError_method_wrapper(MessageError* err) { return MessageError_code(*err); } +static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { + return time__TimeParseError_msg(*err); +} +static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { + return Error_code(err->Error); +} static inline string flag__UnkownFlagError_msg_Interface_IError_method_wrapper(flag__UnkownFlagError* err) { return flag__UnkownFlagError_msg(*err); } @@ -10456,12 +10148,6 @@ static inline string os__ExecutableNotFoundError_msg_Interface_IError_method_wra static inline int os__ExecutableNotFoundError_code_Interface_IError_method_wrapper(os__ExecutableNotFoundError* err) { return Error_code(err->Error); } -static inline string time__TimeParseError_msg_Interface_IError_method_wrapper(time__TimeParseError* err) { - return time__TimeParseError_msg(*err); -} -static inline int time__TimeParseError_code_Interface_IError_method_wrapper(time__TimeParseError* err) { - return Error_code(err->Error); -} static inline string v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper(v__gen__c__UnsupportedAssertCtempTransform* err) { return Error_msg(err->Error); } @@ -10487,6 +10173,10 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) MessageError_msg_Interface_IError_method_wrapper, ._method_code = (void*) MessageError_code_Interface_IError_method_wrapper, }, + { + ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, + ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, + }, { ._method_msg = (void*) flag__UnkownFlagError_msg_Interface_IError_method_wrapper, ._method_code = (void*) flag__UnkownFlagError_code_Interface_IError_method_wrapper, @@ -10519,10 +10209,6 @@ struct _IError_interface_methods IError_name_table[13] = { ._method_msg = (void*) os__ExecutableNotFoundError_msg_Interface_IError_method_wrapper, ._method_code = (void*) os__ExecutableNotFoundError_code_Interface_IError_method_wrapper, }, - { - ._method_msg = (void*) time__TimeParseError_msg_Interface_IError_method_wrapper, - ._method_code = (void*) time__TimeParseError_code_Interface_IError_method_wrapper, - }, { ._method_msg = (void*) v__gen__c__UnsupportedAssertCtempTransform_msg_Interface_IError_method_wrapper, ._method_code = (void*) v__gen__c__UnsupportedAssertCtempTransform_code_Interface_IError_method_wrapper, @@ -10560,6 +10246,16 @@ static inline IError I_MessageError_to_Interface_IError(MessageError* x) { }; } +// Casting functions for converting "time__TimeParseError" to interface "IError" +static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { + return (IError) { + ._time__TimeParseError = x, + ._typ = _IError_time__TimeParseError_index, + .msg = (string*)((char*)x), + .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), + }; +} + // Casting functions for converting "flag__UnkownFlagError" to interface "IError" static inline IError I_flag__UnkownFlagError_to_Interface_IError(flag__UnkownFlagError* x) { return (IError) { @@ -10640,16 +10336,6 @@ static inline IError I_os__ExecutableNotFoundError_to_Interface_IError(os__Execu }; } -// Casting functions for converting "time__TimeParseError" to interface "IError" -static inline IError I_time__TimeParseError_to_Interface_IError(time__TimeParseError* x) { - return (IError) { - ._time__TimeParseError = x, - ._typ = _IError_time__TimeParseError_index, - .msg = (string*)((char*)x), - .code = (int*)((char*)x + __offsetof_ptr(x, time__TimeParseError, code)), - }; -} - // Casting functions for converting "v__gen__c__UnsupportedAssertCtempTransform" to interface "IError" static inline IError I_v__gen__c__UnsupportedAssertCtempTransform_to_Interface_IError(v__gen__c__UnsupportedAssertCtempTransform* x) { return (IError) { @@ -10841,17 +10527,20 @@ void vinit_string_literals(void){ _const_si_s_code = _SLIT("0xfe10"); _const_si_g32_code = _SLIT("0xfe0e"); _const_si_g64_code = _SLIT("0xfe0f"); + _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); + _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_flag__space = _SLIT(" "); _const_flag__underline = _SLIT("-----------------------------------------------"); _const_semver__comparator_sep = _SLIT(" "); _const_semver__comparator_set_sep = _SLIT(" || "); _const_semver__hyphen_range_sep = _SLIT(" - "); _const_semver__x_range_symbols = _SLIT("Xx*"); + _const_os__dot_dot = _SLIT(".."); + _const_os__empty_str = _SLIT(""); + _const_os__dot_str = _SLIT("."); _const_os__path_separator = _SLIT("\\"); _const_os__path_delimiter = _SLIT(";"); _const_v__util__version__v_version = _SLIT("0.2.4"); - _const_time__days_string = _SLIT("MonTueWedThuFriSatSun"); - _const_time__months_string = _SLIT("JanFebMarAprMayJunJulAugSepOctNovDec"); _const_v__vmod__err_label = _SLIT("vmod:"); _const_v__cflag__fexisting_literal = _SLIT("$first_existing"); _const_v__pkgconfig__version = _SLIT("0.3.2"); @@ -11302,59 +10991,59 @@ static string indent_v__ast__CallExpr_str(v__ast__CallExpr it, int indent_count) static string indent_v__ast__TypeInfo_str(v__ast__TypeInfo x, int indent_count) { switch(x._typ) { - case 470: return str_intp(2, _MOV((StrIntpData[]){ + case 472: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Aggregate_str(*(v__ast__Aggregate*)x._v__ast__Aggregate, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 472: return str_intp(2, _MOV((StrIntpData[]){ + case 474: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Alias_str(*(v__ast__Alias*)x._v__ast__Alias, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 452: return str_intp(2, _MOV((StrIntpData[]){ + case 454: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Array_str(*(v__ast__Array*)x._v__ast__Array, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 480: return str_intp(2, _MOV((StrIntpData[]){ + case 482: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__ArrayFixed_str(*(v__ast__ArrayFixed*)x._v__ast__ArrayFixed, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 481: return str_intp(2, _MOV((StrIntpData[]){ + case 483: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Chan_str(*(v__ast__Chan*)x._v__ast__Chan, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 486: return str_intp(2, _MOV((StrIntpData[]){ + case 488: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Enum_str(*(v__ast__Enum*)x._v__ast__Enum, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 484: return str_intp(2, _MOV((StrIntpData[]){ + case 486: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__FnType_str(*(v__ast__FnType*)x._v__ast__FnType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 485: return str_intp(2, _MOV((StrIntpData[]){ + case 487: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__GenericInst_str(*(v__ast__GenericInst*)x._v__ast__GenericInst, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 475: return str_intp(2, _MOV((StrIntpData[]){ + case 477: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Interface_str(*(v__ast__Interface*)x._v__ast__Interface, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 453: return str_intp(2, _MOV((StrIntpData[]){ + case 455: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Map_str(*(v__ast__Map*)x._v__ast__Map, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 483: return str_intp(2, _MOV((StrIntpData[]){ + case 485: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__MultiReturn_str(*(v__ast__MultiReturn*)x._v__ast__MultiReturn, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 457: return str_intp(2, _MOV((StrIntpData[]){ + case 459: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Struct_str(*(v__ast__Struct*)x._v__ast__Struct, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 476: return str_intp(2, _MOV((StrIntpData[]){ + case 478: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__SumType_str(*(v__ast__SumType*)x._v__ast__SumType, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); - case 482: return str_intp(2, _MOV((StrIntpData[]){ + case 484: return str_intp(2, _MOV((StrIntpData[]){ {_SLIT("v.ast.TypeInfo("), 0xfe10, {.d_s = indent_v__ast__Thread_str(*(v__ast__Thread*)x._v__ast__Thread, indent_count)}}, {_SLIT(")"), 0, {.d_c = 0 }} })); @@ -11815,32 +11504,32 @@ static string indent_v__ast__StructField_str(v__ast__StructField it, int indent_ static inline v__ast__Expr v__ast__EmptyExpr_to_sumtype_v__ast__Expr(v__ast__EmptyExpr* x) { v__ast__EmptyExpr* ptr = memdup(x, sizeof(v__ast__EmptyExpr)); - return (v__ast__Expr){ ._v__ast__EmptyExpr = ptr, ._typ = 303}; + return (v__ast__Expr){ ._v__ast__EmptyExpr = ptr, ._typ = 305}; } static inline v__ast__Stmt v__ast__EmptyStmt_to_sumtype_v__ast__Stmt(v__ast__EmptyStmt* x) { v__ast__EmptyStmt* ptr = memdup(x, sizeof(v__ast__EmptyStmt)); - return (v__ast__Stmt){ ._v__ast__EmptyStmt = ptr, ._typ = 345, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EmptyStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__EmptyStmt = ptr, ._typ = 347, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EmptyStmt, pos))}; } static inline v__ast__Node v__ast__EmptyNode_to_sumtype_v__ast__Node(v__ast__EmptyNode* x) { v__ast__EmptyNode* ptr = memdup(x, sizeof(v__ast__EmptyNode)); - return (v__ast__Node){ ._v__ast__EmptyNode = ptr, ._typ = 368}; + return (v__ast__Node){ ._v__ast__EmptyNode = ptr, ._typ = 370}; } static inline v__ast__Node v__ast__Expr_to_sumtype_v__ast__Node(v__ast__Expr* x) { v__ast__Expr* ptr = memdup(x, sizeof(v__ast__Expr)); - return (v__ast__Node){ ._v__ast__Expr = ptr, ._typ = 336}; + return (v__ast__Node){ ._v__ast__Expr = ptr, ._typ = 338}; } static inline v__ast__Node v__ast__Stmt_to_sumtype_v__ast__Node(v__ast__Stmt* x) { v__ast__Stmt* ptr = memdup(x, sizeof(v__ast__Stmt)); - return (v__ast__Node){ ._v__ast__Stmt = ptr, ._typ = 361}; + return (v__ast__Node){ ._v__ast__Stmt = ptr, ._typ = 363}; } static inline v__ast__Node v__ast__StructInitField_to_sumtype_v__ast__Node(v__ast__StructInitField* x) { v__ast__StructInitField* ptr = memdup(x, sizeof(v__ast__StructInitField)); - return (v__ast__Node){ ._v__ast__StructInitField = ptr, ._typ = 375}; + return (v__ast__Node){ ._v__ast__StructInitField = ptr, ._typ = 377}; } static inline v__ast__Stmt v__ast__FnDecl_to_sumtype_v__ast__Stmt(v__ast__FnDecl* x) { @@ -11850,177 +11539,177 @@ static inline v__ast__Stmt v__ast__FnDecl_to_sumtype_v__ast__Stmt(v__ast__FnDecl static inline v__ast__Node v__ast__CallArg_to_sumtype_v__ast__Node(v__ast__CallArg* x) { v__ast__CallArg* ptr = memdup(x, sizeof(v__ast__CallArg)); - return (v__ast__Node){ ._v__ast__CallArg = ptr, ._typ = 367}; + return (v__ast__Node){ ._v__ast__CallArg = ptr, ._typ = 369}; } static inline v__ast__Expr v__ast__OrExpr_to_sumtype_v__ast__Expr(v__ast__OrExpr* x) { v__ast__OrExpr* ptr = memdup(x, sizeof(v__ast__OrExpr)); - return (v__ast__Expr){ ._v__ast__OrExpr = ptr, ._typ = 321}; + return (v__ast__Expr){ ._v__ast__OrExpr = ptr, ._typ = 323}; } static inline v__ast__Node v__ast__IfBranch_to_sumtype_v__ast__Node(v__ast__IfBranch* x) { v__ast__IfBranch* ptr = memdup(x, sizeof(v__ast__IfBranch)); - return (v__ast__Node){ ._v__ast__IfBranch = ptr, ._typ = 370}; + return (v__ast__Node){ ._v__ast__IfBranch = ptr, ._typ = 372}; } static inline v__ast__Node v__ast__MatchBranch_to_sumtype_v__ast__Node(v__ast__MatchBranch* x) { v__ast__MatchBranch* ptr = memdup(x, sizeof(v__ast__MatchBranch)); - return (v__ast__Node){ ._v__ast__MatchBranch = ptr, ._typ = 371}; + return (v__ast__Node){ ._v__ast__MatchBranch = ptr, ._typ = 373}; } static inline v__ast__Node v__ast__SelectBranch_to_sumtype_v__ast__Node(v__ast__SelectBranch* x) { v__ast__SelectBranch* ptr = memdup(x, sizeof(v__ast__SelectBranch)); - return (v__ast__Node){ ._v__ast__SelectBranch = ptr, ._typ = 373}; + return (v__ast__Node){ ._v__ast__SelectBranch = ptr, ._typ = 375}; } static inline v__ast__Node v__ast__StructField_to_sumtype_v__ast__Node(v__ast__StructField* x) { v__ast__StructField* ptr = memdup(x, sizeof(v__ast__StructField)); - return (v__ast__Node){ ._v__ast__StructField = ptr, ._typ = 374}; + return (v__ast__Node){ ._v__ast__StructField = ptr, ._typ = 376}; } static inline v__ast__Node v__ast__GlobalField_to_sumtype_v__ast__Node(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); - return (v__ast__Node){ ._v__ast__GlobalField = ptr, ._typ = 364}; + return (v__ast__Node){ ._v__ast__GlobalField = ptr, ._typ = 366}; } static inline v__ast__Node v__ast__ConstField_to_sumtype_v__ast__Node(v__ast__ConstField* x) { v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__Node){ ._v__ast__ConstField = ptr, ._typ = 363}; + return (v__ast__Node){ ._v__ast__ConstField = ptr, ._typ = 365}; } static inline v__ast__Node v__ast__EnumField_to_sumtype_v__ast__Node(v__ast__EnumField* x) { v__ast__EnumField* ptr = memdup(x, sizeof(v__ast__EnumField)); - return (v__ast__Node){ ._v__ast__EnumField = ptr, ._typ = 369}; + return (v__ast__Node){ ._v__ast__EnumField = ptr, ._typ = 371}; } static inline v__ast__Node v__ast__Param_to_sumtype_v__ast__Node(v__ast__Param* x) { v__ast__Param* ptr = memdup(x, sizeof(v__ast__Param)); - return (v__ast__Node){ ._v__ast__Param = ptr, ._typ = 372}; + return (v__ast__Node){ ._v__ast__Param = ptr, ._typ = 374}; } static inline v__ast__Expr v__ast__TypeNode_to_sumtype_v__ast__Expr(v__ast__TypeNode* x) { v__ast__TypeNode* ptr = memdup(x, sizeof(v__ast__TypeNode)); - return (v__ast__Expr){ ._v__ast__TypeNode = ptr, ._typ = 333}; + return (v__ast__Expr){ ._v__ast__TypeNode = ptr, ._typ = 335}; } static inline v__ast__ScopeObject v__ast__AsmRegister_to_sumtype_v__ast__ScopeObject(v__ast__AsmRegister* x) { v__ast__AsmRegister* ptr = memdup(x, sizeof(v__ast__AsmRegister)); - return (v__ast__ScopeObject){ ._v__ast__AsmRegister = ptr, ._typ = 362, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, typ))}; + return (v__ast__ScopeObject){ ._v__ast__AsmRegister = ptr, ._typ = 364, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmRegister, typ))}; } static inline v__ast__ComptTimeConstValue v__ast__EmptyExpr_to_sumtype_v__ast__ComptTimeConstValue(v__ast__EmptyExpr* x) { v__ast__EmptyExpr* ptr = memdup(x, sizeof(v__ast__EmptyExpr)); - return (v__ast__ComptTimeConstValue){ ._v__ast__EmptyExpr = ptr, ._typ = 303}; + return (v__ast__ComptTimeConstValue){ ._v__ast__EmptyExpr = ptr, ._typ = 305}; } static inline v__ast__Expr v__ast__ArrayInit_to_sumtype_v__ast__Expr(v__ast__ArrayInit* x) { v__ast__ArrayInit* ptr = memdup(x, sizeof(v__ast__ArrayInit)); - return (v__ast__Expr){ ._v__ast__ArrayInit = ptr, ._typ = 287}; + return (v__ast__Expr){ ._v__ast__ArrayInit = ptr, ._typ = 289}; } static inline v__ast__Expr v__ast__StringLiteral_to_sumtype_v__ast__Expr(v__ast__StringLiteral* x) { v__ast__StringLiteral* ptr = memdup(x, sizeof(v__ast__StringLiteral)); - return (v__ast__Expr){ ._v__ast__StringLiteral = ptr, ._typ = 331}; + return (v__ast__Expr){ ._v__ast__StringLiteral = ptr, ._typ = 333}; } static inline v__ast__Expr v__ast__MapInit_to_sumtype_v__ast__Expr(v__ast__MapInit* x) { v__ast__MapInit* ptr = memdup(x, sizeof(v__ast__MapInit)); - return (v__ast__Expr){ ._v__ast__MapInit = ptr, ._typ = 316}; + return (v__ast__Expr){ ._v__ast__MapInit = ptr, ._typ = 318}; } static inline v__ast__Expr v__ast__StructInit_to_sumtype_v__ast__Expr(v__ast__StructInit* x) { v__ast__StructInit* ptr = memdup(x, sizeof(v__ast__StructInit)); - return (v__ast__Expr){ ._v__ast__StructInit = ptr, ._typ = 332}; + return (v__ast__Expr){ ._v__ast__StructInit = ptr, ._typ = 334}; } static inline v__ast__TypeInfo v__ast__SumType_to_sumtype_v__ast__TypeInfo(v__ast__SumType* x) { v__ast__SumType* ptr = memdup(x, sizeof(v__ast__SumType)); - return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 476}; + return (v__ast__TypeInfo){ ._v__ast__SumType = ptr, ._typ = 478}; } static inline v__ast__TypeInfo v__ast__Chan_to_sumtype_v__ast__TypeInfo(v__ast__Chan* x) { v__ast__Chan* ptr = memdup(x, sizeof(v__ast__Chan)); - return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 481}; + return (v__ast__TypeInfo){ ._v__ast__Chan = ptr, ._typ = 483}; } static inline v__ast__TypeInfo v__ast__Map_to_sumtype_v__ast__TypeInfo(v__ast__Map* x) { v__ast__Map* ptr = memdup(x, sizeof(v__ast__Map)); - return (v__ast__TypeInfo){ ._v__ast__Map = ptr, ._typ = 453}; + return (v__ast__TypeInfo){ ._v__ast__Map = ptr, ._typ = 455}; } static inline v__ast__TypeInfo v__ast__Thread_to_sumtype_v__ast__TypeInfo(v__ast__Thread* x) { v__ast__Thread* ptr = memdup(x, sizeof(v__ast__Thread)); - return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 482}; + return (v__ast__TypeInfo){ ._v__ast__Thread = ptr, ._typ = 484}; } static inline v__ast__TypeInfo v__ast__Struct_to_sumtype_v__ast__TypeInfo(v__ast__Struct* x) { v__ast__Struct* ptr = memdup(x, sizeof(v__ast__Struct)); - return (v__ast__TypeInfo){ ._v__ast__Struct = ptr, ._typ = 457}; + return (v__ast__TypeInfo){ ._v__ast__Struct = ptr, ._typ = 459}; } static inline v__ast__TypeInfo v__ast__Array_to_sumtype_v__ast__TypeInfo(v__ast__Array* x) { v__ast__Array* ptr = memdup(x, sizeof(v__ast__Array)); - return (v__ast__TypeInfo){ ._v__ast__Array = ptr, ._typ = 452}; + return (v__ast__TypeInfo){ ._v__ast__Array = ptr, ._typ = 454}; } static inline v__ast__TypeInfo v__ast__ArrayFixed_to_sumtype_v__ast__TypeInfo(v__ast__ArrayFixed* x) { v__ast__ArrayFixed* ptr = memdup(x, sizeof(v__ast__ArrayFixed)); - return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 480}; + return (v__ast__TypeInfo){ ._v__ast__ArrayFixed = ptr, ._typ = 482}; } static inline v__ast__TypeInfo v__ast__MultiReturn_to_sumtype_v__ast__TypeInfo(v__ast__MultiReturn* x) { v__ast__MultiReturn* ptr = memdup(x, sizeof(v__ast__MultiReturn)); - return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 483}; + return (v__ast__TypeInfo){ ._v__ast__MultiReturn = ptr, ._typ = 485}; } static inline v__ast__TypeInfo v__ast__FnType_to_sumtype_v__ast__TypeInfo(v__ast__FnType* x) { v__ast__FnType* ptr = memdup(x, sizeof(v__ast__FnType)); - return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 484}; + return (v__ast__TypeInfo){ ._v__ast__FnType = ptr, ._typ = 486}; } static inline v__ast__Expr v__ast__None_to_sumtype_v__ast__Expr(v__ast__None* x) { v__ast__None* ptr = memdup(x, sizeof(v__ast__None)); - return (v__ast__Expr){ ._v__ast__None = ptr, ._typ = 319}; + return (v__ast__Expr){ ._v__ast__None = ptr, ._typ = 321}; } static inline v__ast__TypeInfo v__ast__Interface_to_sumtype_v__ast__TypeInfo(v__ast__Interface* x) { v__ast__Interface* ptr = memdup(x, sizeof(v__ast__Interface)); - return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 475}; + return (v__ast__TypeInfo){ ._v__ast__Interface = ptr, ._typ = 477}; } static inline v__ast__IdentInfo v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(v__ast__IdentVar* x) { v__ast__IdentVar* ptr = memdup(x, sizeof(v__ast__IdentVar)); - return (v__ast__IdentInfo){ ._v__ast__IdentVar = ptr, ._typ = 417}; + return (v__ast__IdentInfo){ ._v__ast__IdentVar = ptr, ._typ = 419}; } static inline v__ast__Expr v__ast__InfixExpr_to_sumtype_v__ast__Expr(v__ast__InfixExpr* x) { v__ast__InfixExpr* ptr = memdup(x, sizeof(v__ast__InfixExpr)); - return (v__ast__Expr){ ._v__ast__InfixExpr = ptr, ._typ = 311}; + return (v__ast__Expr){ ._v__ast__InfixExpr = ptr, ._typ = 313}; } static inline v__ast__Expr v__ast__CastExpr_to_sumtype_v__ast__Expr(v__ast__CastExpr* x) { v__ast__CastExpr* ptr = memdup(x, sizeof(v__ast__CastExpr)); - return (v__ast__Expr){ ._v__ast__CastExpr = ptr, ._typ = 294}; + return (v__ast__Expr){ ._v__ast__CastExpr = ptr, ._typ = 296}; } static inline v__ast__AsmArg v__ast__AsmRegister_to_sumtype_v__ast__AsmArg(v__ast__AsmRegister* x) { v__ast__AsmRegister* ptr = memdup(x, sizeof(v__ast__AsmRegister)); - return (v__ast__AsmArg){ ._v__ast__AsmRegister = ptr, ._typ = 362}; + return (v__ast__AsmArg){ ._v__ast__AsmRegister = ptr, ._typ = 364}; } static inline v__ast__ScopeObject v__ast__Var_to_sumtype_v__ast__ScopeObject(v__ast__Var* x) { v__ast__Var* ptr = memdup(x, sizeof(v__ast__Var)); - return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 365, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; + return (v__ast__ScopeObject){ ._v__ast__Var = ptr, ._typ = 367, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Var, typ))}; } static inline v__ast__IdentInfo v__ast__IdentFn_to_sumtype_v__ast__IdentInfo(v__ast__IdentFn* x) { v__ast__IdentFn* ptr = memdup(x, sizeof(v__ast__IdentFn)); - return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 416}; + return (v__ast__IdentInfo){ ._v__ast__IdentFn = ptr, ._typ = 418}; } static inline v__ast__Expr v__ast__IndexExpr_to_sumtype_v__ast__Expr(v__ast__IndexExpr* x) { v__ast__IndexExpr* ptr = memdup(x, sizeof(v__ast__IndexExpr)); - return (v__ast__Expr){ ._v__ast__IndexExpr = ptr, ._typ = 310}; + return (v__ast__Expr){ ._v__ast__IndexExpr = ptr, ._typ = 312}; } static inline v__ast__ComptTimeConstValue int_to_sumtype_v__ast__ComptTimeConstValue(int* x) { @@ -12085,397 +11774,397 @@ static inline v__ast__ComptTimeConstValue f32_to_sumtype_v__ast__ComptTimeConstV static inline v__ast__Stmt v__ast__Return_to_sumtype_v__ast__Stmt(v__ast__Return* x) { v__ast__Return* ptr = memdup(x, sizeof(v__ast__Return)); - return (v__ast__Stmt){ ._v__ast__Return = ptr, ._typ = 358, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Return, pos))}; + return (v__ast__Stmt){ ._v__ast__Return = ptr, ._typ = 360, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Return, pos))}; } static inline v__ast__TypeInfo v__ast__Aggregate_to_sumtype_v__ast__TypeInfo(v__ast__Aggregate* x) { v__ast__Aggregate* ptr = memdup(x, sizeof(v__ast__Aggregate)); - return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 470}; + return (v__ast__TypeInfo){ ._v__ast__Aggregate = ptr, ._typ = 472}; } static inline v__ast__Expr v__ast__Ident_to_sumtype_v__ast__Expr(v__ast__Ident* x) { v__ast__Ident* ptr = memdup(x, sizeof(v__ast__Ident)); - return (v__ast__Expr){ ._v__ast__Ident = ptr, ._typ = 307}; + return (v__ast__Expr){ ._v__ast__Ident = ptr, ._typ = 309}; } static inline v__ast__Stmt v__ast__AssertStmt_to_sumtype_v__ast__Stmt(v__ast__AssertStmt* x) { v__ast__AssertStmt* ptr = memdup(x, sizeof(v__ast__AssertStmt)); - return (v__ast__Stmt){ ._v__ast__AssertStmt = ptr, ._typ = 338, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssertStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AssertStmt = ptr, ._typ = 340, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssertStmt, pos))}; } static inline v__ast__Expr v__ast__IfExpr_to_sumtype_v__ast__Expr(v__ast__IfExpr* x) { v__ast__IfExpr* ptr = memdup(x, sizeof(v__ast__IfExpr)); - return (v__ast__Expr){ ._v__ast__IfExpr = ptr, ._typ = 308}; + return (v__ast__Expr){ ._v__ast__IfExpr = ptr, ._typ = 310}; } static inline v__ast__Expr v__ast__BoolLiteral_to_sumtype_v__ast__Expr(v__ast__BoolLiteral* x) { v__ast__BoolLiteral* ptr = memdup(x, sizeof(v__ast__BoolLiteral)); - return (v__ast__Expr){ ._v__ast__BoolLiteral = ptr, ._typ = 291}; + return (v__ast__Expr){ ._v__ast__BoolLiteral = ptr, ._typ = 293}; } static inline v__ast__Expr v__ast__MatchExpr_to_sumtype_v__ast__Expr(v__ast__MatchExpr* x) { v__ast__MatchExpr* ptr = memdup(x, sizeof(v__ast__MatchExpr)); - return (v__ast__Expr){ ._v__ast__MatchExpr = ptr, ._typ = 317}; + return (v__ast__Expr){ ._v__ast__MatchExpr = ptr, ._typ = 319}; } static inline v__ast__Stmt v__ast__ForCStmt_to_sumtype_v__ast__Stmt(v__ast__ForCStmt* x) { v__ast__ForCStmt* ptr = memdup(x, sizeof(v__ast__ForCStmt)); - return (v__ast__Stmt){ ._v__ast__ForCStmt = ptr, ._typ = 348, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForCStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForCStmt = ptr, ._typ = 350, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForCStmt, pos))}; } static inline v__ast__Stmt v__ast__ForStmt_to_sumtype_v__ast__Stmt(v__ast__ForStmt* x) { v__ast__ForStmt* ptr = memdup(x, sizeof(v__ast__ForStmt)); - return (v__ast__Stmt){ ._v__ast__ForStmt = ptr, ._typ = 350, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForStmt = ptr, ._typ = 352, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForStmt, pos))}; } static inline v__ast__Stmt v__ast__InterfaceDecl_to_sumtype_v__ast__Stmt(v__ast__InterfaceDecl* x) { v__ast__InterfaceDecl* ptr = memdup(x, sizeof(v__ast__InterfaceDecl)); - return (v__ast__Stmt){ ._v__ast__InterfaceDecl = ptr, ._typ = 356, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__InterfaceDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__InterfaceDecl = ptr, ._typ = 358, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__InterfaceDecl, pos))}; } static inline v__ast__Expr v__ast__CallExpr_to_sumtype_v__ast__Expr(v__ast__CallExpr* x) { v__ast__CallExpr* ptr = memdup(x, sizeof(v__ast__CallExpr)); - return (v__ast__Expr){ ._v__ast__CallExpr = ptr, ._typ = 293}; + return (v__ast__Expr){ ._v__ast__CallExpr = ptr, ._typ = 295}; } static inline v__ast__Expr v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(v__ast__IntegerLiteral* x) { v__ast__IntegerLiteral* ptr = memdup(x, sizeof(v__ast__IntegerLiteral)); - return (v__ast__Expr){ ._v__ast__IntegerLiteral = ptr, ._typ = 312}; + return (v__ast__Expr){ ._v__ast__IntegerLiteral = ptr, ._typ = 314}; } static inline v__ast__Expr v__ast__FloatLiteral_to_sumtype_v__ast__Expr(v__ast__FloatLiteral* x) { v__ast__FloatLiteral* ptr = memdup(x, sizeof(v__ast__FloatLiteral)); - return (v__ast__Expr){ ._v__ast__FloatLiteral = ptr, ._typ = 305}; + return (v__ast__Expr){ ._v__ast__FloatLiteral = ptr, ._typ = 307}; } static inline v__ast__Expr v__ast__SqlExpr_to_sumtype_v__ast__Expr(v__ast__SqlExpr* x) { v__ast__SqlExpr* ptr = memdup(x, sizeof(v__ast__SqlExpr)); - return (v__ast__Expr){ ._v__ast__SqlExpr = ptr, ._typ = 329}; + return (v__ast__Expr){ ._v__ast__SqlExpr = ptr, ._typ = 331}; } static inline v__ast__Expr v__ast__CTempVar_to_sumtype_v__ast__Expr(v__ast__CTempVar* x) { v__ast__CTempVar* ptr = memdup(x, sizeof(v__ast__CTempVar)); - return (v__ast__Expr){ ._v__ast__CTempVar = ptr, ._typ = 292}; + return (v__ast__Expr){ ._v__ast__CTempVar = ptr, ._typ = 294}; } static inline v__ast__Expr v__ast__SelectorExpr_to_sumtype_v__ast__Expr(v__ast__SelectorExpr* x) { v__ast__SelectorExpr* ptr = memdup(x, sizeof(v__ast__SelectorExpr)); - return (v__ast__Expr){ ._v__ast__SelectorExpr = ptr, ._typ = 327}; + return (v__ast__Expr){ ._v__ast__SelectorExpr = ptr, ._typ = 329}; } static inline v__ast__Stmt v__ast__ForInStmt_to_sumtype_v__ast__Stmt(v__ast__ForInStmt* x) { v__ast__ForInStmt* ptr = memdup(x, sizeof(v__ast__ForInStmt)); - return (v__ast__Stmt){ ._v__ast__ForInStmt = ptr, ._typ = 349, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForInStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ForInStmt = ptr, ._typ = 351, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ForInStmt, pos))}; } static inline v__ast__Stmt v__ast__ExprStmt_to_sumtype_v__ast__Stmt(v__ast__ExprStmt* x) { v__ast__ExprStmt* ptr = memdup(x, sizeof(v__ast__ExprStmt)); - return (v__ast__Stmt){ ._v__ast__ExprStmt = ptr, ._typ = 347, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ExprStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__ExprStmt = ptr, ._typ = 349, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ExprStmt, pos))}; } static inline v__ast__Stmt v__ast__NodeError_to_sumtype_v__ast__Stmt(v__ast__NodeError* x) { v__ast__NodeError* ptr = memdup(x, sizeof(v__ast__NodeError)); - return (v__ast__Stmt){ ._v__ast__NodeError = ptr, ._typ = 318, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__NodeError, pos))}; + return (v__ast__Stmt){ ._v__ast__NodeError = ptr, ._typ = 320, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__NodeError, pos))}; } static inline v__ast__Stmt v__ast__AssignStmt_to_sumtype_v__ast__Stmt(v__ast__AssignStmt* x) { v__ast__AssignStmt* ptr = memdup(x, sizeof(v__ast__AssignStmt)); - return (v__ast__Stmt){ ._v__ast__AssignStmt = ptr, ._typ = 339, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssignStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AssignStmt = ptr, ._typ = 341, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AssignStmt, pos))}; } static inline v__ast__Expr v__ast__ComptimeCall_to_sumtype_v__ast__Expr(v__ast__ComptimeCall* x) { v__ast__ComptimeCall* ptr = memdup(x, sizeof(v__ast__ComptimeCall)); - return (v__ast__Expr){ ._v__ast__ComptimeCall = ptr, ._typ = 298}; + return (v__ast__Expr){ ._v__ast__ComptimeCall = ptr, ._typ = 300}; } static inline v__ast__Expr v__ast__ComptimeSelector_to_sumtype_v__ast__Expr(v__ast__ComptimeSelector* x) { v__ast__ComptimeSelector* ptr = memdup(x, sizeof(v__ast__ComptimeSelector)); - return (v__ast__Expr){ ._v__ast__ComptimeSelector = ptr, ._typ = 299}; + return (v__ast__Expr){ ._v__ast__ComptimeSelector = ptr, ._typ = 301}; } static inline v__ast__Expr v__ast__NodeError_to_sumtype_v__ast__Expr(v__ast__NodeError* x) { v__ast__NodeError* ptr = memdup(x, sizeof(v__ast__NodeError)); - return (v__ast__Expr){ ._v__ast__NodeError = ptr, ._typ = 318}; + return (v__ast__Expr){ ._v__ast__NodeError = ptr, ._typ = 320}; } static inline v__ast__Expr v__ast__Comment_to_sumtype_v__ast__Expr(v__ast__Comment* x) { v__ast__Comment* ptr = memdup(x, sizeof(v__ast__Comment)); - return (v__ast__Expr){ ._v__ast__Comment = ptr, ._typ = 297}; + return (v__ast__Expr){ ._v__ast__Comment = ptr, ._typ = 299}; } static inline v__ast__Expr v__ast__EnumVal_to_sumtype_v__ast__Expr(v__ast__EnumVal* x) { v__ast__EnumVal* ptr = memdup(x, sizeof(v__ast__EnumVal)); - return (v__ast__Expr){ ._v__ast__EnumVal = ptr, ._typ = 304}; + return (v__ast__Expr){ ._v__ast__EnumVal = ptr, ._typ = 306}; } static inline v__ast__Expr v__ast__AtExpr_to_sumtype_v__ast__Expr(v__ast__AtExpr* x) { v__ast__AtExpr* ptr = memdup(x, sizeof(v__ast__AtExpr)); - return (v__ast__Expr){ ._v__ast__AtExpr = ptr, ._typ = 290}; + return (v__ast__Expr){ ._v__ast__AtExpr = ptr, ._typ = 292}; } static inline v__ast__Expr v__ast__ComptimeType_to_sumtype_v__ast__Expr(v__ast__ComptimeType* x) { v__ast__ComptimeType* ptr = memdup(x, sizeof(v__ast__ComptimeType)); - return (v__ast__Expr){ ._v__ast__ComptimeType = ptr, ._typ = 300}; + return (v__ast__Expr){ ._v__ast__ComptimeType = ptr, ._typ = 302}; } static inline v__ast__Expr v__ast__CharLiteral_to_sumtype_v__ast__Expr(v__ast__CharLiteral* x) { v__ast__CharLiteral* ptr = memdup(x, sizeof(v__ast__CharLiteral)); - return (v__ast__Expr){ ._v__ast__CharLiteral = ptr, ._typ = 296}; + return (v__ast__Expr){ ._v__ast__CharLiteral = ptr, ._typ = 298}; } static inline v__ast__Expr v__ast__GoExpr_to_sumtype_v__ast__Expr(v__ast__GoExpr* x) { v__ast__GoExpr* ptr = memdup(x, sizeof(v__ast__GoExpr)); - return (v__ast__Expr){ ._v__ast__GoExpr = ptr, ._typ = 306}; + return (v__ast__Expr){ ._v__ast__GoExpr = ptr, ._typ = 308}; } static inline v__ast__Expr v__ast__SelectExpr_to_sumtype_v__ast__Expr(v__ast__SelectExpr* x) { v__ast__SelectExpr* ptr = memdup(x, sizeof(v__ast__SelectExpr)); - return (v__ast__Expr){ ._v__ast__SelectExpr = ptr, ._typ = 326}; + return (v__ast__Expr){ ._v__ast__SelectExpr = ptr, ._typ = 328}; } static inline v__ast__Expr v__ast__ParExpr_to_sumtype_v__ast__Expr(v__ast__ParExpr* x) { v__ast__ParExpr* ptr = memdup(x, sizeof(v__ast__ParExpr)); - return (v__ast__Expr){ ._v__ast__ParExpr = ptr, ._typ = 322}; + return (v__ast__Expr){ ._v__ast__ParExpr = ptr, ._typ = 324}; } static inline v__ast__Expr v__ast__UnsafeExpr_to_sumtype_v__ast__Expr(v__ast__UnsafeExpr* x) { v__ast__UnsafeExpr* ptr = memdup(x, sizeof(v__ast__UnsafeExpr)); - return (v__ast__Expr){ ._v__ast__UnsafeExpr = ptr, ._typ = 335}; + return (v__ast__Expr){ ._v__ast__UnsafeExpr = ptr, ._typ = 337}; } static inline v__ast__Expr v__ast__LockExpr_to_sumtype_v__ast__Expr(v__ast__LockExpr* x) { v__ast__LockExpr* ptr = memdup(x, sizeof(v__ast__LockExpr)); - return (v__ast__Expr){ ._v__ast__LockExpr = ptr, ._typ = 315}; + return (v__ast__Expr){ ._v__ast__LockExpr = ptr, ._typ = 317}; } static inline v__ast__Expr v__ast__IsRefType_to_sumtype_v__ast__Expr(v__ast__IsRefType* x) { v__ast__IsRefType* ptr = memdup(x, sizeof(v__ast__IsRefType)); - return (v__ast__Expr){ ._v__ast__IsRefType = ptr, ._typ = 313}; + return (v__ast__Expr){ ._v__ast__IsRefType = ptr, ._typ = 315}; } static inline v__ast__Expr v__ast__SizeOf_to_sumtype_v__ast__Expr(v__ast__SizeOf* x) { v__ast__SizeOf* ptr = memdup(x, sizeof(v__ast__SizeOf)); - return (v__ast__Expr){ ._v__ast__SizeOf = ptr, ._typ = 328}; + return (v__ast__Expr){ ._v__ast__SizeOf = ptr, ._typ = 330}; } static inline v__ast__Expr v__ast__TypeOf_to_sumtype_v__ast__Expr(v__ast__TypeOf* x) { v__ast__TypeOf* ptr = memdup(x, sizeof(v__ast__TypeOf)); - return (v__ast__Expr){ ._v__ast__TypeOf = ptr, ._typ = 334}; + return (v__ast__Expr){ ._v__ast__TypeOf = ptr, ._typ = 336}; } static inline v__ast__Expr v__ast__DumpExpr_to_sumtype_v__ast__Expr(v__ast__DumpExpr* x) { v__ast__DumpExpr* ptr = memdup(x, sizeof(v__ast__DumpExpr)); - return (v__ast__Expr){ ._v__ast__DumpExpr = ptr, ._typ = 302}; + return (v__ast__Expr){ ._v__ast__DumpExpr = ptr, ._typ = 304}; } static inline v__ast__Expr v__ast__OffsetOf_to_sumtype_v__ast__Expr(v__ast__OffsetOf* x) { v__ast__OffsetOf* ptr = memdup(x, sizeof(v__ast__OffsetOf)); - return (v__ast__Expr){ ._v__ast__OffsetOf = ptr, ._typ = 320}; + return (v__ast__Expr){ ._v__ast__OffsetOf = ptr, ._typ = 322}; } static inline v__ast__Expr v__ast__Likely_to_sumtype_v__ast__Expr(v__ast__Likely* x) { v__ast__Likely* ptr = memdup(x, sizeof(v__ast__Likely)); - return (v__ast__Expr){ ._v__ast__Likely = ptr, ._typ = 314}; + return (v__ast__Expr){ ._v__ast__Likely = ptr, ._typ = 316}; } static inline v__ast__Expr v__ast__AnonFn_to_sumtype_v__ast__Expr(v__ast__AnonFn* x) { v__ast__AnonFn* ptr = memdup(x, sizeof(v__ast__AnonFn)); - return (v__ast__Expr){ ._v__ast__AnonFn = ptr, ._typ = 285}; + return (v__ast__Expr){ ._v__ast__AnonFn = ptr, ._typ = 287}; } static inline v__ast__Expr v__ast__AsCast_to_sumtype_v__ast__Expr(v__ast__AsCast* x) { v__ast__AsCast* ptr = memdup(x, sizeof(v__ast__AsCast)); - return (v__ast__Expr){ ._v__ast__AsCast = ptr, ._typ = 288}; + return (v__ast__Expr){ ._v__ast__AsCast = ptr, ._typ = 290}; } static inline v__ast__Expr v__ast__PostfixExpr_to_sumtype_v__ast__Expr(v__ast__PostfixExpr* x) { v__ast__PostfixExpr* ptr = memdup(x, sizeof(v__ast__PostfixExpr)); - return (v__ast__Expr){ ._v__ast__PostfixExpr = ptr, ._typ = 323}; + return (v__ast__Expr){ ._v__ast__PostfixExpr = ptr, ._typ = 325}; } static inline v__ast__Expr v__ast__PrefixExpr_to_sumtype_v__ast__Expr(v__ast__PrefixExpr* x) { v__ast__PrefixExpr* ptr = memdup(x, sizeof(v__ast__PrefixExpr)); - return (v__ast__Expr){ ._v__ast__PrefixExpr = ptr, ._typ = 324}; + return (v__ast__Expr){ ._v__ast__PrefixExpr = ptr, ._typ = 326}; } static inline v__ast__Expr v__ast__ArrayDecompose_to_sumtype_v__ast__Expr(v__ast__ArrayDecompose* x) { v__ast__ArrayDecompose* ptr = memdup(x, sizeof(v__ast__ArrayDecompose)); - return (v__ast__Expr){ ._v__ast__ArrayDecompose = ptr, ._typ = 286}; + return (v__ast__Expr){ ._v__ast__ArrayDecompose = ptr, ._typ = 288}; } static inline v__ast__Expr v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(v__ast__IfGuardExpr* x) { v__ast__IfGuardExpr* ptr = memdup(x, sizeof(v__ast__IfGuardExpr)); - return (v__ast__Expr){ ._v__ast__IfGuardExpr = ptr, ._typ = 309}; + return (v__ast__Expr){ ._v__ast__IfGuardExpr = ptr, ._typ = 311}; } static inline v__ast__Expr v__ast__RangeExpr_to_sumtype_v__ast__Expr(v__ast__RangeExpr* x) { v__ast__RangeExpr* ptr = memdup(x, sizeof(v__ast__RangeExpr)); - return (v__ast__Expr){ ._v__ast__RangeExpr = ptr, ._typ = 325}; + return (v__ast__Expr){ ._v__ast__RangeExpr = ptr, ._typ = 327}; } static inline v__ast__TypeInfo v__ast__GenericInst_to_sumtype_v__ast__TypeInfo(v__ast__GenericInst* x) { v__ast__GenericInst* ptr = memdup(x, sizeof(v__ast__GenericInst)); - return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 485}; + return (v__ast__TypeInfo){ ._v__ast__GenericInst = ptr, ._typ = 487}; } static inline v__ast__Stmt v__ast__Module_to_sumtype_v__ast__Stmt(v__ast__Module* x) { v__ast__Module* ptr = memdup(x, sizeof(v__ast__Module)); - return (v__ast__Stmt){ ._v__ast__Module = ptr, ._typ = 357, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Module, pos))}; + return (v__ast__Stmt){ ._v__ast__Module = ptr, ._typ = 359, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Module, pos))}; } static inline v__ast__Stmt v__ast__Import_to_sumtype_v__ast__Stmt(v__ast__Import* x) { v__ast__Import* ptr = memdup(x, sizeof(v__ast__Import)); - return (v__ast__Stmt){ ._v__ast__Import = ptr, ._typ = 355, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Import, pos))}; + return (v__ast__Stmt){ ._v__ast__Import = ptr, ._typ = 357, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Import, pos))}; } static inline v__ast__Stmt v__ast__ConstDecl_to_sumtype_v__ast__Stmt(v__ast__ConstDecl* x) { v__ast__ConstDecl* ptr = memdup(x, sizeof(v__ast__ConstDecl)); - return (v__ast__Stmt){ ._v__ast__ConstDecl = ptr, ._typ = 343, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__ConstDecl = ptr, ._typ = 345, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstDecl, pos))}; } static inline v__ast__Stmt v__ast__StructDecl_to_sumtype_v__ast__Stmt(v__ast__StructDecl* x) { v__ast__StructDecl* ptr = memdup(x, sizeof(v__ast__StructDecl)); - return (v__ast__Stmt){ ._v__ast__StructDecl = ptr, ._typ = 360, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__StructDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__StructDecl = ptr, ._typ = 362, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__StructDecl, pos))}; } static inline v__ast__Stmt v__ast__EnumDecl_to_sumtype_v__ast__Stmt(v__ast__EnumDecl* x) { v__ast__EnumDecl* ptr = memdup(x, sizeof(v__ast__EnumDecl)); - return (v__ast__Stmt){ ._v__ast__EnumDecl = ptr, ._typ = 346, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EnumDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__EnumDecl = ptr, ._typ = 348, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__EnumDecl, pos))}; } static inline v__ast__Stmt v__ast__TypeDecl_to_sumtype_v__ast__Stmt(v__ast__TypeDecl* x) { v__ast__TypeDecl* ptr = memdup(x, sizeof(v__ast__TypeDecl)); - return (v__ast__Stmt){ ._v__ast__TypeDecl = ptr, ._typ = 284, .pos = ptr->pos}; + return (v__ast__Stmt){ ._v__ast__TypeDecl = ptr, ._typ = 286, .pos = ptr->pos}; } static inline v__ast__Stmt v__ast__AsmStmt_to_sumtype_v__ast__Stmt(v__ast__AsmStmt* x) { v__ast__AsmStmt* ptr = memdup(x, sizeof(v__ast__AsmStmt)); - return (v__ast__Stmt){ ._v__ast__AsmStmt = ptr, ._typ = 337, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__AsmStmt = ptr, ._typ = 339, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AsmStmt, pos))}; } static inline v__ast__Stmt v__ast__GlobalDecl_to_sumtype_v__ast__Stmt(v__ast__GlobalDecl* x) { v__ast__GlobalDecl* ptr = memdup(x, sizeof(v__ast__GlobalDecl)); - return (v__ast__Stmt){ ._v__ast__GlobalDecl = ptr, ._typ = 351, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalDecl, pos))}; + return (v__ast__Stmt){ ._v__ast__GlobalDecl = ptr, ._typ = 353, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalDecl, pos))}; } static inline v__ast__Stmt v__ast__HashStmt_to_sumtype_v__ast__Stmt(v__ast__HashStmt* x) { v__ast__HashStmt* ptr = memdup(x, sizeof(v__ast__HashStmt)); - return (v__ast__Stmt){ ._v__ast__HashStmt = ptr, ._typ = 354, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__HashStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__HashStmt = ptr, ._typ = 356, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__HashStmt, pos))}; } static inline v__ast__Stmt v__ast__Block_to_sumtype_v__ast__Stmt(v__ast__Block* x) { v__ast__Block* ptr = memdup(x, sizeof(v__ast__Block)); - return (v__ast__Stmt){ ._v__ast__Block = ptr, ._typ = 340, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Block, pos))}; + return (v__ast__Stmt){ ._v__ast__Block = ptr, ._typ = 342, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__Block, pos))}; } static inline v__ast__Stmt v__ast__SqlStmt_to_sumtype_v__ast__Stmt(v__ast__SqlStmt* x) { v__ast__SqlStmt* ptr = memdup(x, sizeof(v__ast__SqlStmt)); - return (v__ast__Stmt){ ._v__ast__SqlStmt = ptr, ._typ = 359, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SqlStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__SqlStmt = ptr, ._typ = 361, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SqlStmt, pos))}; } static inline v__ast__Stmt v__ast__GotoLabel_to_sumtype_v__ast__Stmt(v__ast__GotoLabel* x) { v__ast__GotoLabel* ptr = memdup(x, sizeof(v__ast__GotoLabel)); - return (v__ast__Stmt){ ._v__ast__GotoLabel = ptr, ._typ = 352, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoLabel, pos))}; + return (v__ast__Stmt){ ._v__ast__GotoLabel = ptr, ._typ = 354, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoLabel, pos))}; } static inline v__ast__Stmt v__ast__ComptimeFor_to_sumtype_v__ast__Stmt(v__ast__ComptimeFor* x) { v__ast__ComptimeFor* ptr = memdup(x, sizeof(v__ast__ComptimeFor)); - return (v__ast__Stmt){ ._v__ast__ComptimeFor = ptr, ._typ = 342, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ComptimeFor, pos))}; + return (v__ast__Stmt){ ._v__ast__ComptimeFor = ptr, ._typ = 344, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ComptimeFor, pos))}; } static inline v__ast__Stmt v__ast__BranchStmt_to_sumtype_v__ast__Stmt(v__ast__BranchStmt* x) { v__ast__BranchStmt* ptr = memdup(x, sizeof(v__ast__BranchStmt)); - return (v__ast__Stmt){ ._v__ast__BranchStmt = ptr, ._typ = 341, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__BranchStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__BranchStmt = ptr, ._typ = 343, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__BranchStmt, pos))}; } static inline v__ast__Stmt v__ast__DeferStmt_to_sumtype_v__ast__Stmt(v__ast__DeferStmt* x) { v__ast__DeferStmt* ptr = memdup(x, sizeof(v__ast__DeferStmt)); - return (v__ast__Stmt){ ._v__ast__DeferStmt = ptr, ._typ = 344, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__DeferStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__DeferStmt = ptr, ._typ = 346, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__DeferStmt, pos))}; } static inline v__ast__Stmt v__ast__GotoStmt_to_sumtype_v__ast__Stmt(v__ast__GotoStmt* x) { v__ast__GotoStmt* ptr = memdup(x, sizeof(v__ast__GotoStmt)); - return (v__ast__Stmt){ ._v__ast__GotoStmt = ptr, ._typ = 353, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoStmt, pos))}; + return (v__ast__Stmt){ ._v__ast__GotoStmt = ptr, ._typ = 355, .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GotoStmt, pos))}; } static inline v__ast__AsmArg v__ast__FloatLiteral_to_sumtype_v__ast__AsmArg(v__ast__FloatLiteral* x) { v__ast__FloatLiteral* ptr = memdup(x, sizeof(v__ast__FloatLiteral)); - return (v__ast__AsmArg){ ._v__ast__FloatLiteral = ptr, ._typ = 305}; + return (v__ast__AsmArg){ ._v__ast__FloatLiteral = ptr, ._typ = 307}; } static inline v__ast__AsmArg v__ast__AsmDisp_to_sumtype_v__ast__AsmArg(v__ast__AsmDisp* x) { v__ast__AsmDisp* ptr = memdup(x, sizeof(v__ast__AsmDisp)); - return (v__ast__AsmArg){ ._v__ast__AsmDisp = ptr, ._typ = 439}; + return (v__ast__AsmArg){ ._v__ast__AsmDisp = ptr, ._typ = 441}; } static inline v__ast__AsmArg v__ast__IntegerLiteral_to_sumtype_v__ast__AsmArg(v__ast__IntegerLiteral* x) { v__ast__IntegerLiteral* ptr = memdup(x, sizeof(v__ast__IntegerLiteral)); - return (v__ast__AsmArg){ ._v__ast__IntegerLiteral = ptr, ._typ = 312}; + return (v__ast__AsmArg){ ._v__ast__IntegerLiteral = ptr, ._typ = 314}; } static inline v__ast__AsmArg v__ast__CharLiteral_to_sumtype_v__ast__AsmArg(v__ast__CharLiteral* x) { v__ast__CharLiteral* ptr = memdup(x, sizeof(v__ast__CharLiteral)); - return (v__ast__AsmArg){ ._v__ast__CharLiteral = ptr, ._typ = 296}; + return (v__ast__AsmArg){ ._v__ast__CharLiteral = ptr, ._typ = 298}; } static inline v__ast__AsmArg v__ast__AsmAddressing_to_sumtype_v__ast__AsmArg(v__ast__AsmAddressing* x) { v__ast__AsmAddressing* ptr = memdup(x, sizeof(v__ast__AsmAddressing)); - return (v__ast__AsmArg){ ._v__ast__AsmAddressing = ptr, ._typ = 437}; + return (v__ast__AsmArg){ ._v__ast__AsmAddressing = ptr, ._typ = 439}; } static inline v__ast__AsmArg v__ast__AsmAlias_to_sumtype_v__ast__AsmArg(v__ast__AsmAlias* x) { v__ast__AsmAlias* ptr = memdup(x, sizeof(v__ast__AsmAlias)); - return (v__ast__AsmArg){ ._v__ast__AsmAlias = ptr, ._typ = 438}; + return (v__ast__AsmArg){ ._v__ast__AsmAlias = ptr, ._typ = 440}; } static inline v__ast__Expr v__ast__ConcatExpr_to_sumtype_v__ast__Expr(v__ast__ConcatExpr* x) { v__ast__ConcatExpr* ptr = memdup(x, sizeof(v__ast__ConcatExpr)); - return (v__ast__Expr){ ._v__ast__ConcatExpr = ptr, ._typ = 301}; + return (v__ast__Expr){ ._v__ast__ConcatExpr = ptr, ._typ = 303}; } static inline v__ast__Expr v__ast__ChanInit_to_sumtype_v__ast__Expr(v__ast__ChanInit* x) { v__ast__ChanInit* ptr = memdup(x, sizeof(v__ast__ChanInit)); - return (v__ast__Expr){ ._v__ast__ChanInit = ptr, ._typ = 295}; + return (v__ast__Expr){ ._v__ast__ChanInit = ptr, ._typ = 297}; } static inline v__ast__Expr v__ast__StringInterLiteral_to_sumtype_v__ast__Expr(v__ast__StringInterLiteral* x) { v__ast__StringInterLiteral* ptr = memdup(x, sizeof(v__ast__StringInterLiteral)); - return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 330}; + return (v__ast__Expr){ ._v__ast__StringInterLiteral = ptr, ._typ = 332}; } static inline v__ast__ScopeObject v__ast__ConstField_to_sumtype_v__ast__ScopeObject(v__ast__ConstField* x) { v__ast__ConstField* ptr = memdup(x, sizeof(v__ast__ConstField)); - return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 363, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; + return (v__ast__ScopeObject){ ._v__ast__ConstField = ptr, ._typ = 365, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__ConstField, typ))}; } static inline v__ast__ScopeObject v__ast__GlobalField_to_sumtype_v__ast__ScopeObject(v__ast__GlobalField* x) { v__ast__GlobalField* ptr = memdup(x, sizeof(v__ast__GlobalField)); - return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 364, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; + return (v__ast__ScopeObject){ ._v__ast__GlobalField = ptr, ._typ = 366, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, name)), .typ = (v__ast__Type*)((char*)ptr + __offsetof_ptr(ptr, v__ast__GlobalField, typ))}; } static inline v__ast__TypeInfo v__ast__Enum_to_sumtype_v__ast__TypeInfo(v__ast__Enum* x) { v__ast__Enum* ptr = memdup(x, sizeof(v__ast__Enum)); - return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 486}; + return (v__ast__TypeInfo){ ._v__ast__Enum = ptr, ._typ = 488}; } static inline v__ast__TypeDecl v__ast__SumTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__SumTypeDecl* x) { v__ast__SumTypeDecl* ptr = memdup(x, sizeof(v__ast__SumTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__SumTypeDecl = ptr, ._typ = 283, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__SumTypeDecl = ptr, ._typ = 285, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__SumTypeDecl, comments))}; } static inline v__ast__TypeDecl v__ast__FnTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__FnTypeDecl* x) { v__ast__FnTypeDecl* ptr = memdup(x, sizeof(v__ast__FnTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__FnTypeDecl = ptr, ._typ = 282, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__FnTypeDecl = ptr, ._typ = 284, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__FnTypeDecl, comments))}; } static inline v__ast__TypeDecl v__ast__AliasTypeDecl_to_sumtype_v__ast__TypeDecl(v__ast__AliasTypeDecl* x) { v__ast__AliasTypeDecl* ptr = memdup(x, sizeof(v__ast__AliasTypeDecl)); - return (v__ast__TypeDecl){ ._v__ast__AliasTypeDecl = ptr, ._typ = 281, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, comments))}; + return (v__ast__TypeDecl){ ._v__ast__AliasTypeDecl = ptr, ._typ = 283, .name = (string*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, name)), .is_pub = (bool*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, is_pub)), .pos = (v__token__Pos*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, pos)), .comments = (Array_v__ast__Comment*)((char*)ptr + __offsetof_ptr(ptr, v__ast__AliasTypeDecl, comments))}; } static inline v__ast__TypeInfo v__ast__Alias_to_sumtype_v__ast__TypeInfo(v__ast__Alias* x) { v__ast__Alias* ptr = memdup(x, sizeof(v__ast__Alias)); - return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 472}; + return (v__ast__TypeInfo){ ._v__ast__Alias = ptr, ._typ = 474}; } static inline v__ast__Node v__ast__File_to_sumtype_v__ast__Node(v__ast__File* x) { @@ -12747,6 +12436,7 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_None___index) return "None__"; if (sidx == _IError_Error_index) return "Error"; if (sidx == _IError_MessageError_index) return "MessageError"; + if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_flag__UnkownFlagError_index) return "flag.UnkownFlagError"; if (sidx == _IError_flag__ArgsCountError_index) return "flag.ArgsCountError"; if (sidx == _IError_semver__InvalidComparatorFormatError_index) return "semver.InvalidComparatorFormatError"; @@ -12755,7 +12445,6 @@ static char * v_typeof_interface_IError(int sidx) { /* IError */ if (sidx == _IError_os__FileNotOpenedError_index) return "os.FileNotOpenedError"; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return "os.SizeOfTypeIs0Error"; if (sidx == _IError_os__ExecutableNotFoundError_index) return "os.ExecutableNotFoundError"; - if (sidx == _IError_time__TimeParseError_index) return "time.TimeParseError"; if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return "v.gen.c.UnsupportedAssertCtempTransform"; return "unknown IError"; } @@ -12764,16 +12453,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 66136; - if (sidx == _IError_flag__ArgsCountError_index) return 66137; - if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66147; - if (sidx == _IError_semver__EmptyInputError_index) return 66149; - if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66150; + if (sidx == _IError_time__TimeParseError_index) return 259; + if (sidx == _IError_flag__UnkownFlagError_index) return 66133; + if (sidx == _IError_flag__ArgsCountError_index) return 66134; + if (sidx == _IError_semver__InvalidComparatorFormatError_index) return 66145; + if (sidx == _IError_semver__EmptyInputError_index) return 66147; + if (sidx == _IError_semver__InvalidVersionFormatError_index) return 66148; if (sidx == _IError_os__FileNotOpenedError_index) return 65659; if (sidx == _IError_os__SizeOfTypeIs0Error_index) return 65660; if (sidx == _IError_os__ExecutableNotFoundError_index) return 65674; - if (sidx == _IError_time__TimeParseError_index) return 257; - if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 540; + if (sidx == _IError_v__gen__c__UnsupportedAssertCtempTransform_index) return 542; return 29; } static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ @@ -12782,91 +12471,89 @@ static char * v_typeof_interface_rand__PRNG(int sidx) { /* rand.PRNG */ } static int v_typeof_interface_idx_rand__PRNG(int sidx) { /* rand.PRNG */ - if (sidx == _rand__PRNG_rand__wyrand__WyRandRNG_index) return 65773; + if (sidx == _rand__PRNG_rand__wyrand__WyRandRNG_index) return 65775; return 233; } static char * v_typeof_sumtype_v__ast__TypeDecl(int sidx) { /* v.ast.TypeDecl */ switch(sidx) { - case 284: return "v.ast.TypeDecl"; - case 281: return "v.ast.AliasTypeDecl"; - case 282: return "v.ast.FnTypeDecl"; - case 283: return "v.ast.SumTypeDecl"; + case 286: return "v.ast.TypeDecl"; + case 283: return "v.ast.AliasTypeDecl"; + case 284: return "v.ast.FnTypeDecl"; + case 285: return "v.ast.SumTypeDecl"; default: return "unknown v.ast.TypeDecl"; } } static int v_typeof_sumtype_idx_v__ast__TypeDecl(int sidx) { /* v.ast.TypeDecl */ switch(sidx) { - case 284: return 284; - case 281: return 281; - case 282: return 282; + case 286: return 286; case 283: return 283; - default: return 284; + case 284: return 284; + case 285: return 285; + default: return 286; } } static char * v_typeof_sumtype_v__ast__Expr(int sidx) { /* v.ast.Expr */ switch(sidx) { - case 336: return "v.ast.Expr"; - case 285: return "v.ast.AnonFn"; - case 286: return "v.ast.ArrayDecompose"; - case 287: return "v.ast.ArrayInit"; - case 288: return "v.ast.AsCast"; - case 289: return "v.ast.Assoc"; - case 290: return "v.ast.AtExpr"; - case 291: return "v.ast.BoolLiteral"; - case 292: return "v.ast.CTempVar"; - case 293: return "v.ast.CallExpr"; - case 294: return "v.ast.CastExpr"; - case 295: return "v.ast.ChanInit"; - case 296: return "v.ast.CharLiteral"; - case 297: return "v.ast.Comment"; - case 298: return "v.ast.ComptimeCall"; - case 299: return "v.ast.ComptimeSelector"; - case 300: return "v.ast.ComptimeType"; - case 301: return "v.ast.ConcatExpr"; - case 302: return "v.ast.DumpExpr"; - case 303: return "v.ast.EmptyExpr"; - case 304: return "v.ast.EnumVal"; - case 305: return "v.ast.FloatLiteral"; - case 306: return "v.ast.GoExpr"; - case 307: return "v.ast.Ident"; - case 308: return "v.ast.IfExpr"; - case 309: return "v.ast.IfGuardExpr"; - case 310: return "v.ast.IndexExpr"; - case 311: return "v.ast.InfixExpr"; - case 312: return "v.ast.IntegerLiteral"; - case 313: return "v.ast.IsRefType"; - case 314: return "v.ast.Likely"; - case 315: return "v.ast.LockExpr"; - case 316: return "v.ast.MapInit"; - case 317: return "v.ast.MatchExpr"; - case 318: return "v.ast.NodeError"; - case 319: return "v.ast.None"; - case 320: return "v.ast.OffsetOf"; - case 321: return "v.ast.OrExpr"; - case 322: return "v.ast.ParExpr"; - case 323: return "v.ast.PostfixExpr"; - case 324: return "v.ast.PrefixExpr"; - case 325: return "v.ast.RangeExpr"; - case 326: return "v.ast.SelectExpr"; - case 327: return "v.ast.SelectorExpr"; - case 328: return "v.ast.SizeOf"; - case 329: return "v.ast.SqlExpr"; - case 330: return "v.ast.StringInterLiteral"; - case 331: return "v.ast.StringLiteral"; - case 332: return "v.ast.StructInit"; - case 333: return "v.ast.TypeNode"; - case 334: return "v.ast.TypeOf"; - case 335: return "v.ast.UnsafeExpr"; + case 338: return "v.ast.Expr"; + case 287: return "v.ast.AnonFn"; + case 288: return "v.ast.ArrayDecompose"; + case 289: return "v.ast.ArrayInit"; + case 290: return "v.ast.AsCast"; + case 291: return "v.ast.Assoc"; + case 292: return "v.ast.AtExpr"; + case 293: return "v.ast.BoolLiteral"; + case 294: return "v.ast.CTempVar"; + case 295: return "v.ast.CallExpr"; + case 296: return "v.ast.CastExpr"; + case 297: return "v.ast.ChanInit"; + case 298: return "v.ast.CharLiteral"; + case 299: return "v.ast.Comment"; + case 300: return "v.ast.ComptimeCall"; + case 301: return "v.ast.ComptimeSelector"; + case 302: return "v.ast.ComptimeType"; + case 303: return "v.ast.ConcatExpr"; + case 304: return "v.ast.DumpExpr"; + case 305: return "v.ast.EmptyExpr"; + case 306: return "v.ast.EnumVal"; + case 307: return "v.ast.FloatLiteral"; + case 308: return "v.ast.GoExpr"; + case 309: return "v.ast.Ident"; + case 310: return "v.ast.IfExpr"; + case 311: return "v.ast.IfGuardExpr"; + case 312: return "v.ast.IndexExpr"; + case 313: return "v.ast.InfixExpr"; + case 314: return "v.ast.IntegerLiteral"; + case 315: return "v.ast.IsRefType"; + case 316: return "v.ast.Likely"; + case 317: return "v.ast.LockExpr"; + case 318: return "v.ast.MapInit"; + case 319: return "v.ast.MatchExpr"; + case 320: return "v.ast.NodeError"; + case 321: return "v.ast.None"; + case 322: return "v.ast.OffsetOf"; + case 323: return "v.ast.OrExpr"; + case 324: return "v.ast.ParExpr"; + case 325: return "v.ast.PostfixExpr"; + case 326: return "v.ast.PrefixExpr"; + case 327: return "v.ast.RangeExpr"; + case 328: return "v.ast.SelectExpr"; + case 329: return "v.ast.SelectorExpr"; + case 330: return "v.ast.SizeOf"; + case 331: return "v.ast.SqlExpr"; + case 332: return "v.ast.StringInterLiteral"; + case 333: return "v.ast.StringLiteral"; + case 334: return "v.ast.StructInit"; + case 335: return "v.ast.TypeNode"; + case 336: return "v.ast.TypeOf"; + case 337: return "v.ast.UnsafeExpr"; default: return "unknown v.ast.Expr"; } } static int v_typeof_sumtype_idx_v__ast__Expr(int sidx) { /* v.ast.Expr */ switch(sidx) { - case 336: return 336; - case 285: return 285; - case 286: return 286; + case 338: return 338; case 287: return 287; case 288: return 288; case 289: return 289; @@ -12916,48 +12603,48 @@ static int v_typeof_sumtype_idx_v__ast__Expr(int sidx) { /* v.ast.Expr */ case 333: return 333; case 334: return 334; case 335: return 335; - default: return 336; + case 336: return 336; + case 337: return 337; + default: return 338; } } static char * v_typeof_sumtype_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ switch(sidx) { - case 361: return "v.ast.Stmt"; - case 337: return "v.ast.AsmStmt"; - case 338: return "v.ast.AssertStmt"; - case 339: return "v.ast.AssignStmt"; - case 340: return "v.ast.Block"; - case 341: return "v.ast.BranchStmt"; - case 342: return "v.ast.ComptimeFor"; - case 343: return "v.ast.ConstDecl"; - case 344: return "v.ast.DeferStmt"; - case 345: return "v.ast.EmptyStmt"; - case 346: return "v.ast.EnumDecl"; - case 347: return "v.ast.ExprStmt"; + case 363: return "v.ast.Stmt"; + case 339: return "v.ast.AsmStmt"; + case 340: return "v.ast.AssertStmt"; + case 341: return "v.ast.AssignStmt"; + case 342: return "v.ast.Block"; + case 343: return "v.ast.BranchStmt"; + case 344: return "v.ast.ComptimeFor"; + case 345: return "v.ast.ConstDecl"; + case 346: return "v.ast.DeferStmt"; + case 347: return "v.ast.EmptyStmt"; + case 348: return "v.ast.EnumDecl"; + case 349: return "v.ast.ExprStmt"; case 220: return "v.ast.FnDecl"; - case 348: return "v.ast.ForCStmt"; - case 349: return "v.ast.ForInStmt"; - case 350: return "v.ast.ForStmt"; - case 351: return "v.ast.GlobalDecl"; - case 352: return "v.ast.GotoLabel"; - case 353: return "v.ast.GotoStmt"; - case 354: return "v.ast.HashStmt"; - case 355: return "v.ast.Import"; - case 356: return "v.ast.InterfaceDecl"; - case 357: return "v.ast.Module"; - case 318: return "v.ast.NodeError"; - case 358: return "v.ast.Return"; - case 359: return "v.ast.SqlStmt"; - case 360: return "v.ast.StructDecl"; - case 284: return "v.ast.TypeDecl"; + case 350: return "v.ast.ForCStmt"; + case 351: return "v.ast.ForInStmt"; + case 352: return "v.ast.ForStmt"; + case 353: return "v.ast.GlobalDecl"; + case 354: return "v.ast.GotoLabel"; + case 355: return "v.ast.GotoStmt"; + case 356: return "v.ast.HashStmt"; + case 357: return "v.ast.Import"; + case 358: return "v.ast.InterfaceDecl"; + case 359: return "v.ast.Module"; + case 320: return "v.ast.NodeError"; + case 360: return "v.ast.Return"; + case 361: return "v.ast.SqlStmt"; + case 362: return "v.ast.StructDecl"; + case 286: return "v.ast.TypeDecl"; default: return "unknown v.ast.Stmt"; } } static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ switch(sidx) { - case 361: return 361; - case 337: return 337; - case 338: return 338; + case 363: return 363; case 339: return 339; case 340: return 340; case 341: return 341; @@ -12967,9 +12654,9 @@ static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ case 345: return 345; case 346: return 346; case 347: return 347; - case 220: return 220; case 348: return 348; case 349: return 349; + case 220: return 220; case 350: return 350; case 351: return 351; case 352: return 352; @@ -12978,84 +12665,86 @@ static int v_typeof_sumtype_idx_v__ast__Stmt(int sidx) { /* v.ast.Stmt */ case 355: return 355; case 356: return 356; case 357: return 357; - case 318: return 318; case 358: return 358; case 359: return 359; + case 320: return 320; case 360: return 360; - case 284: return 284; - default: return 361; + case 361: return 361; + case 362: return 362; + case 286: return 286; + default: return 363; } } static char * v_typeof_sumtype_v__ast__ScopeObject(int sidx) { /* v.ast.ScopeObject */ switch(sidx) { - case 366: return "v.ast.ScopeObject"; - case 362: return "v.ast.AsmRegister"; - case 363: return "v.ast.ConstField"; - case 364: return "v.ast.GlobalField"; - case 365: return "v.ast.Var"; + case 368: return "v.ast.ScopeObject"; + case 364: return "v.ast.AsmRegister"; + case 365: return "v.ast.ConstField"; + case 366: return "v.ast.GlobalField"; + case 367: return "v.ast.Var"; default: return "unknown v.ast.ScopeObject"; } } static int v_typeof_sumtype_idx_v__ast__ScopeObject(int sidx) { /* v.ast.ScopeObject */ switch(sidx) { - case 366: return 366; - case 362: return 362; - case 363: return 363; + case 368: return 368; case 364: return 364; case 365: return 365; - default: return 366; + case 366: return 366; + case 367: return 367; + default: return 368; } } static char * v_typeof_sumtype_v__ast__Node(int sidx) { /* v.ast.Node */ switch(sidx) { - case 376: return "v.ast.Node"; - case 367: return "v.ast.CallArg"; - case 363: return "v.ast.ConstField"; - case 368: return "v.ast.EmptyNode"; - case 369: return "v.ast.EnumField"; - case 336: return "v.ast.Expr"; + case 378: return "v.ast.Node"; + case 369: return "v.ast.CallArg"; + case 365: return "v.ast.ConstField"; + case 370: return "v.ast.EmptyNode"; + case 371: return "v.ast.EnumField"; + case 338: return "v.ast.Expr"; case 211: return "v.ast.File"; - case 364: return "v.ast.GlobalField"; - case 370: return "v.ast.IfBranch"; - case 371: return "v.ast.MatchBranch"; - case 318: return "v.ast.NodeError"; - case 372: return "v.ast.Param"; - case 366: return "v.ast.ScopeObject"; - case 373: return "v.ast.SelectBranch"; - case 361: return "v.ast.Stmt"; - case 374: return "v.ast.StructField"; - case 375: return "v.ast.StructInitField"; + case 366: return "v.ast.GlobalField"; + case 372: return "v.ast.IfBranch"; + case 373: return "v.ast.MatchBranch"; + case 320: return "v.ast.NodeError"; + case 374: return "v.ast.Param"; + case 368: return "v.ast.ScopeObject"; + case 375: return "v.ast.SelectBranch"; + case 363: return "v.ast.Stmt"; + case 376: return "v.ast.StructField"; + case 377: return "v.ast.StructInitField"; default: return "unknown v.ast.Node"; } } static int v_typeof_sumtype_idx_v__ast__Node(int sidx) { /* v.ast.Node */ switch(sidx) { - case 376: return 376; - case 367: return 367; - case 363: return 363; - case 368: return 368; + case 378: return 378; case 369: return 369; - case 336: return 336; - case 211: return 211; - case 364: return 364; + case 365: return 365; case 370: return 370; case 371: return 371; - case 318: return 318; - case 372: return 372; + case 338: return 338; + case 211: return 211; case 366: return 366; + case 372: return 372; case 373: return 373; - case 361: return 361; + case 320: return 320; case 374: return 374; + case 368: return 368; case 375: return 375; - default: return 376; + case 363: return 363; + case 376: return 376; + case 377: return 377; + default: return 378; } } static char * v_typeof_sumtype_v__ast__ComptTimeConstValue(int sidx) { /* v.ast.ComptTimeConstValue */ switch(sidx) { - case 390: return "v.ast.ComptTimeConstValue"; - case 303: return "v.ast.EmptyExpr"; + case 392: return "v.ast.ComptTimeConstValue"; + case 305: return "v.ast.EmptyExpr"; case 15: return "f32"; case 16: return "f64"; case 6: return "i16"; @@ -13074,8 +12763,8 @@ static char * v_typeof_sumtype_v__ast__ComptTimeConstValue(int sidx) { /* v.ast. static int v_typeof_sumtype_idx_v__ast__ComptTimeConstValue(int sidx) { /* v.ast.ComptTimeConstValue */ switch(sidx) { - case 390: return 390; - case 303: return 303; + case 392: return 392; + case 305: return 305; case 15: return 15; case 16: return 16; case 6: return 6; @@ -13088,37 +12777,37 @@ static int v_typeof_sumtype_idx_v__ast__ComptTimeConstValue(int sidx) { /* v.ast case 12: return 12; case 13: return 13; case 10: return 10; - default: return 390; + default: return 392; } } static char * v_typeof_sumtype_v__ast__IdentInfo(int sidx) { /* v.ast.IdentInfo */ switch(sidx) { - case 418: return "v.ast.IdentInfo"; - case 416: return "v.ast.IdentFn"; - case 417: return "v.ast.IdentVar"; + case 420: return "v.ast.IdentInfo"; + case 418: return "v.ast.IdentFn"; + case 419: return "v.ast.IdentVar"; default: return "unknown v.ast.IdentInfo"; } } static int v_typeof_sumtype_idx_v__ast__IdentInfo(int sidx) { /* v.ast.IdentInfo */ switch(sidx) { + case 420: return 420; case 418: return 418; - case 416: return 416; - case 417: return 417; - default: return 418; + case 419: return 419; + default: return 420; } } static char * v_typeof_sumtype_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ switch(sidx) { - case 435: return "v.ast.AsmArg"; - case 437: return "v.ast.AsmAddressing"; - case 438: return "v.ast.AsmAlias"; - case 439: return "v.ast.AsmDisp"; - case 362: return "v.ast.AsmRegister"; - case 291: return "v.ast.BoolLiteral"; - case 296: return "v.ast.CharLiteral"; - case 305: return "v.ast.FloatLiteral"; - case 312: return "v.ast.IntegerLiteral"; + case 437: return "v.ast.AsmArg"; + case 439: return "v.ast.AsmAddressing"; + case 440: return "v.ast.AsmAlias"; + case 441: return "v.ast.AsmDisp"; + case 364: return "v.ast.AsmRegister"; + case 293: return "v.ast.BoolLiteral"; + case 298: return "v.ast.CharLiteral"; + case 307: return "v.ast.FloatLiteral"; + case 314: return "v.ast.IntegerLiteral"; case 20: return "string"; default: return "unknown v.ast.AsmArg"; } @@ -13126,58 +12815,58 @@ static char * v_typeof_sumtype_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ static int v_typeof_sumtype_idx_v__ast__AsmArg(int sidx) { /* v.ast.AsmArg */ switch(sidx) { - case 435: return 435; case 437: return 437; - case 438: return 438; case 439: return 439; - case 362: return 362; - case 291: return 291; - case 296: return 296; - case 305: return 305; - case 312: return 312; + case 440: return 440; + case 441: return 441; + case 364: return 364; + case 293: return 293; + case 298: return 298; + case 307: return 307; + case 314: return 314; case 20: return 20; - default: return 435; + default: return 437; } } static char * v_typeof_sumtype_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 487: return "v.ast.TypeInfo"; - case 470: return "v.ast.Aggregate"; - case 472: return "v.ast.Alias"; - case 452: return "v.ast.Array"; - case 480: return "v.ast.ArrayFixed"; - case 481: return "v.ast.Chan"; - case 486: return "v.ast.Enum"; - case 484: return "v.ast.FnType"; - case 485: return "v.ast.GenericInst"; - case 475: return "v.ast.Interface"; - case 453: return "v.ast.Map"; - case 483: return "v.ast.MultiReturn"; - case 457: return "v.ast.Struct"; - case 476: return "v.ast.SumType"; - case 482: return "v.ast.Thread"; + case 489: return "v.ast.TypeInfo"; + case 472: return "v.ast.Aggregate"; + case 474: return "v.ast.Alias"; + case 454: return "v.ast.Array"; + case 482: return "v.ast.ArrayFixed"; + case 483: return "v.ast.Chan"; + case 488: return "v.ast.Enum"; + case 486: return "v.ast.FnType"; + case 487: return "v.ast.GenericInst"; + case 477: return "v.ast.Interface"; + case 455: return "v.ast.Map"; + case 485: return "v.ast.MultiReturn"; + case 459: return "v.ast.Struct"; + case 478: return "v.ast.SumType"; + case 484: return "v.ast.Thread"; default: return "unknown v.ast.TypeInfo"; } } static int v_typeof_sumtype_idx_v__ast__TypeInfo(int sidx) { /* v.ast.TypeInfo */ switch(sidx) { - case 487: return 487; - case 470: return 470; + case 489: return 489; case 472: return 472; - case 452: return 452; - case 480: return 480; - case 481: return 481; - case 486: return 486; - case 484: return 484; - case 485: return 485; - case 475: return 475; - case 453: return 453; - case 483: return 483; - case 457: return 457; - case 476: return 476; + case 474: return 474; + case 454: return 454; case 482: return 482; - default: return 487; + case 483: return 483; + case 488: return 488; + case 486: return 486; + case 487: return 487; + case 477: return 477; + case 455: return 455; + case 485: return 485; + case 459: return 459; + case 478: return 478; + case 484: return 484; + default: return 489; } } static char * v_typeof_interface_hash__Hasher(int sidx) { /* hash.Hasher */ @@ -13185,21 +12874,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 535; + return 537; } 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 536; + return 538; } 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 537; + return 539; } 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"; @@ -13208,9 +12897,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 575; - if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66064; - return 573; + if (sidx == _v__ast__walker__Visitor_v__ast__walker__Inspector_index) return 572; + if (sidx == _v__ast__walker__Visitor_v__callgraph__Mapper_index) return 66066; + return 570; } // << typeof() support for sum types @@ -13441,7 +13130,8 @@ f32 strings__dice_coefficient(string s1, string s2) { } string a = (s1.len > s2.len ? (s1) : (s2)); string b = (string__eq(a, s1) ? (s2) : (s1)); - Map_string_int first_bigrams = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int first_bigrams = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < a.len - 1; ++i) { string bigram = string_substr(a, i, i + 2); int q = (_IN_MAP(ADDR(string, bigram), ADDR(map, first_bigrams)) ? ((*(int*)map_get(ADDR(map, first_bigrams), &(string[]){bigram}, &(int[]){ 0 })) + 1) : (1)); @@ -14481,7 +14171,7 @@ _option_i64 strconv__common_parse_int(string _s, int base, int _bit_size, bool e _option_u64 _t2 = strconv__common_parse_uint(s, base, bit_size, error_on_non_digit, error_on_high_digit); if (_t2.state != 0) { /*or block*/ _option_i64 _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -14549,7 +14239,7 @@ _option_int strconv__atoi(string s) { _option_i64 _t6 = strconv__parse_int(s, 10, 0); if (_t6.state != 0) { /*or block*/ _option_int _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -18911,7 +18601,7 @@ _option_rune Array_u8_byterune(Array_u8 b) { _option_rune _t1 = Array_u8_utf8_to_utf32(b); if (_t1.state != 0) { /*or block*/ _option_rune _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -19672,9 +19362,9 @@ inline IError error_with_code(string message, int code) { return /*&IError*/I_MessageError_to_Interface_IError(((MessageError*)memdup(&(MessageError){.msg = message,.code = code,}, sizeof(MessageError)))); } -VV_LOCAL_SYMBOL void opt_ok(voidptr data, Option* option, int size) { +VV_LOCAL_SYMBOL void _option_ok(voidptr data, _option* option, int size) { { // Unsafe block - *option = ((Option){.state = 0,.err = _const_none__,}); + *option = ((_option){.state = 0,.err = _const_none__,}); vmemcpy(((u8*)(&option->err)) + sizeof(IError), data, size); } } @@ -21903,105 +21593,105 @@ string charptr_vstring_literal_with_len(charptr cp, int len) { } string StrIntpType_str(StrIntpType x) { + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; switch (x) { case StrIntpType__si_no_str: { - return _SLIT("no_str"); + _t2 = _SLIT("no_str"); break; } case StrIntpType__si_c: { - return _SLIT("c"); + _t2 = _SLIT("c"); break; } case StrIntpType__si_u8: { - return _SLIT("u8"); + _t2 = _SLIT("u8"); break; } case StrIntpType__si_i8: { - return _SLIT("i8"); + _t2 = _SLIT("i8"); break; } case StrIntpType__si_u16: { - return _SLIT("u16"); + _t2 = _SLIT("u16"); break; } case StrIntpType__si_i16: { - return _SLIT("i16"); + _t2 = _SLIT("i16"); break; } case StrIntpType__si_u32: { - return _SLIT("u32"); + _t2 = _SLIT("u32"); break; } case StrIntpType__si_i32: { - return _SLIT("i32"); + _t2 = _SLIT("i32"); break; } case StrIntpType__si_u64: { - return _SLIT("u64"); + _t2 = _SLIT("u64"); break; } case StrIntpType__si_i64: { - return _SLIT("i64"); + _t2 = _SLIT("i64"); break; } case StrIntpType__si_f32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_f64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_g32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_g64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_e32: { - return _SLIT("f32"); + _t2 = _SLIT("f32"); break; } case StrIntpType__si_e64: { - return _SLIT("f64"); + _t2 = _SLIT("f64"); break; } case StrIntpType__si_s: { - return _SLIT("s"); + _t2 = _SLIT("s"); break; } case StrIntpType__si_p: { - return _SLIT("p"); + _t2 = _SLIT("p"); break; } case StrIntpType__si_vp: { - return _SLIT("vp"); + _t2 = _SLIT("vp"); break; } } - ; - return (string){.str=(byteptr)"", .is_lit=1}; + return _t2; } // Attr: [inline] @@ -22886,67 +22576,6 @@ inline void ArrayFlags_toggle(ArrayFlags* e, ArrayFlags flag) { } } -// Attr: [inline] -inline string dl__get_shared_library_extension(void) { - #if defined(_WIN32) - string _t1 = _SLIT(".dll"); - #elif defined(__APPLE__) - #else - #endif - ; - return _t1; -} - -// Attr: [inline] -inline string dl__get_libname(string libname) { - string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = libname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_dl__dl_ext}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -_option_voidptr dl__open_opt(string filename, int flags) { - voidptr shared_object_handle = dl__open(filename, flags); - if (shared_object_handle == 0) { - string e = dl__dlerror(); - return (_option_voidptr){ .state=2, .err=_v_error(e), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_voidptr _t2; - opt_ok2(&(voidptr[]) { shared_object_handle }, (_option*)(&_t2), sizeof(voidptr)); - return _t2; -} - -_option_voidptr dl__sym_opt(voidptr shared_object_handle, string symbol) { - voidptr sym_handle = dl__sym(shared_object_handle, symbol); - if (sym_handle == 0) { - string e = dl__dlerror(); - return (_option_voidptr){ .state=2, .err=_v_error(e), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_voidptr _t2; - opt_ok2(&(voidptr[]) { sym_handle }, (_option*)(&_t2), sizeof(voidptr)); - return _t2; -} - -voidptr dl__open(string filename, int flags) { - voidptr res = LoadLibrary(string_to_wide(filename)); - voidptr _t1 = res; - return _t1; -} - -bool dl__close(voidptr handle) { - bool _t1 = FreeLibrary(handle); - return _t1; -} - -voidptr dl__sym(voidptr handle, string symbol) { - voidptr _t1 = GetProcAddress(handle, symbol.str); - return _t1; -} - -string dl__dlerror(void) { - int cerr = ((int)(GetLastError())); - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("error code "), /*100 &int*/0xfe07, {.d_i32 = cerr}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - strings__textscanner__TextScanner strings__textscanner__new(string input) { strings__textscanner__TextScanner _t1 = ((strings__textscanner__TextScanner){.input = input,.ilen = input.len,.pos = 0,}); return _t1; @@ -23068,6 +22697,67 @@ void strings__textscanner__TextScanner_goto_end(strings__textscanner__TextScanne ss->pos = ss->ilen; } +// Attr: [inline] +inline string dl__get_shared_library_extension(void) { + #if defined(_WIN32) + string _t1 = _SLIT(".dll"); + #elif defined(__APPLE__) + #else + #endif + ; + return _t1; +} + +// Attr: [inline] +inline string dl__get_libname(string libname) { + string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = libname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_dl__dl_ext}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +_option_voidptr dl__open_opt(string filename, int flags) { + voidptr shared_object_handle = dl__open(filename, flags); + if (shared_object_handle == 0) { + string e = dl__dlerror(); + return (_option_voidptr){ .state=2, .err=_v_error(e), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_voidptr _t2; + opt_ok2(&(voidptr[]) { shared_object_handle }, (_option*)(&_t2), sizeof(voidptr)); + return _t2; +} + +_option_voidptr dl__sym_opt(voidptr shared_object_handle, string symbol) { + voidptr sym_handle = dl__sym(shared_object_handle, symbol); + if (sym_handle == 0) { + string e = dl__dlerror(); + return (_option_voidptr){ .state=2, .err=_v_error(e), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_voidptr _t2; + opt_ok2(&(voidptr[]) { sym_handle }, (_option*)(&_t2), sizeof(voidptr)); + return _t2; +} + +voidptr dl__open(string filename, int flags) { + voidptr res = LoadLibrary(string_to_wide(filename)); + voidptr _t1 = res; + return _t1; +} + +bool dl__close(voidptr handle) { + bool _t1 = FreeLibrary(handle); + return _t1; +} + +voidptr dl__sym(voidptr handle, string symbol) { + voidptr _t1 = GetProcAddress(handle, symbol.str); + return _t1; +} + +string dl__dlerror(void) { + int cerr = ((int)(GetLastError())); + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("error code "), /*100 &int*/0xfe07, {.d_i32 = cerr}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + Array_string os__cmdline__options(Array_string args, string param) { Array_string flags = __new_array_with_default(0, 0, sizeof(string), 0); for (int i = 0; i < args.len; ++i) { @@ -23294,7 +22984,8 @@ inline v__token__Pos v__token__Token_pos(v__token__Token* tok) { } VV_LOCAL_SYMBOL Map_string_v__token__Kind v__token__build_keys(void) { - Map_string_v__token__Kind res = new_map(sizeof(string), sizeof(v__token__Kind), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__token__Kind res = new_map(sizeof(string), sizeof(v__token__Kind), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int t = ((int)(v__token__Kind__keyword_beg)) + 1; t < ((int)(v__token__Kind__keyword_end)); ++t) { string key = (*(string*)/*ee elem_sym */array_get(_const_v__token__token_str, t)); map_set(&res, &(string[]){key}, &(v__token__Kind[]) { ((v__token__Kind)(t)) }); @@ -24519,6 +24210,1531 @@ inline int v__mathutil__max_T_int(int a, int b) { return _t1; } +i64 time__portable_timegm(struct tm* t) { + int year = t->tm_year + 1900; + int month = t->tm_mon; + if (month > 11) { + year += month / 12; + month %= 12; + } else if (month < 0) { + int years_diff = (11 - month) / 12; + year -= years_diff; + month += 12 * years_diff; + } + i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); + i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; + return _t1; +} + +int time__days_from_civil(int oy, int m, int d) { + int y = (m <= 2 ? (oy - 1) : (oy)); + int era = y / 400; + int yoe = y - era * 400; + int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; + int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; + int _t1 = era * 146097 + doe - 719468; + return _t1; +} + +string time__Time_format(time__Time t) { + string _t1 = str_intp(6, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss(time__Time t) { + string _t1 = str_intp(7, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss_milli(time__Time t) { + string _t1 = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_format_ss_micro(time__Time t) { + string _t1 = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmm(time__Time t) { + string _t1 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmmss(time__Time t) { + string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +string time__Time_hhmm12(time__Time t) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; +} + +string time__Time_ymmdd(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); + return _t1; +} + +string time__Time_ddmmy(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); + return _t1; +} + +string time__Time_md(time__Time t) { + string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); + return _t1; +} + +VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { + if (n > 3 && n < 21) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t1; + } + int _t2 = n % 10; + + if (_t2 == (1)) { + string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); + return _t3; + } + else if (_t2 == (2)) { + string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); + return _t4; + } + else if (_t2 == (3)) { + string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); + return _t5; + } + else { + string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); + return _t6; + }; + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_custom_format(time__Time t, string s) { + Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); + for (int i = 0; i < s.len; ) { + for (int j = 4; j > 0; j--) { + if (i > s.len - j) { + continue; + } + if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { + array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); + i += (j - 1); + break; + } + } + i++; + } + strings__Builder sb = strings__new_builder(128); + for (int _t2 = 0; _t2 < tokens.len; ++_t2) { + string token = ((string*)tokens.data)[_t2]; + + if (string__eq(token, _SLIT("M"))) { + strings__Builder_write_string(&sb, int_str(t.month)); + } + else if (string__eq(token, _SLIT("MM"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Mo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); + } + else if (string__eq(token, _SLIT("MMM"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("MMMM"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); + } + else if (string__eq(token, _SLIT("D"))) { + strings__Builder_write_string(&sb, int_str(t.day)); + } + else if (string__eq(token, _SLIT("DD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Do"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); + } + else if (string__eq(token, _SLIT("DDD"))) { + strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); + } + else if (string__eq(token, _SLIT("DDDD"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("DDDo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); + } + else if (string__eq(token, _SLIT("d"))) { + strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); + } + else if (string__eq(token, _SLIT("dd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); + } + else if (string__eq(token, _SLIT("ddd"))) { + strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); + } + else if (string__eq(token, _SLIT("dddd"))) { + strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); + } + else if (string__eq(token, _SLIT("YY"))) { + strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); + } + else if (string__eq(token, _SLIT("YYYY"))) { + strings__Builder_write_string(&sb, int_str(t.year)); + } + else if (string__eq(token, _SLIT("H"))) { + strings__Builder_write_string(&sb, int_str(t.hour)); + } + else if (string__eq(token, _SLIT("HH"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("h"))) { + strings__Builder_write_string(&sb, int_str((t.hour % 12))); + } + else if (string__eq(token, _SLIT("hh"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("m"))) { + strings__Builder_write_string(&sb, int_str(t.minute)); + } + else if (string__eq(token, _SLIT("mm"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("s"))) { + strings__Builder_write_string(&sb, int_str(t.second)); + } + else if (string__eq(token, _SLIT("ss"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("k"))) { + strings__Builder_write_string(&sb, int_str((t.hour + 1))); + } + else if (string__eq(token, _SLIT("kk"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("w"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1000f, {.d_f64 = time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("ww"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x8005002f, {.d_f64 = time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("wo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(time__mceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); + } + else if (string__eq(token, _SLIT("Q"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("QQ"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("Qo"))) { + strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); + } + else if (string__eq(token, _SLIT("c"))) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + else if (string__eq(token, _SLIT("N"))) { + strings__Builder_write_string(&sb, _SLIT("AD")); + } + else if (string__eq(token, _SLIT("NN"))) { + strings__Builder_write_string(&sb, _SLIT("Anno Domini")); + } + else if (string__eq(token, _SLIT("Z"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("ZZZ"))) { + int hours = time__offset() / _const_time__seconds_per_hour; + if (hours >= 0) { + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } else { + hours = -hours; + strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); + } + } + else if (string__eq(token, _SLIT("a"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("pm")); + } else { + strings__Builder_write_string(&sb, _SLIT("am")); + } + } + else if (string__eq(token, _SLIT("A"))) { + if (t.hour > 12) { + strings__Builder_write_string(&sb, _SLIT("PM")); + } else { + strings__Builder_write_string(&sb, _SLIT("AM")); + } + } + else { + strings__Builder_write_string(&sb, token); + }; + } + string _t3 = strings__Builder_str(&sb); + return _t3; +} + +string time__Time_clean(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_clean12(time__Time t) { + time__Time znow = time__now(); + if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { + string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); + return _t1; + } + if (t.year == znow.year) { + string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); + return _t2; + } + string _t3 = time__Time_format(t); + return _t3; +} + +string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } + string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); + int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); + string _t3 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_time) { + case time__FormatTime__hhmm12: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmm24: + { + _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss12: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24: + { + _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_milli: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__hhmmss24_micro: + { + _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatTime__no_time: + default: + { + _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatTime*/0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string _t2 = _t3; + return _t2; +} + +string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + string _t1 = _SLIT(""); + return _t1; + } + string month = time__Time_smonth(&t); + string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (fmt_date) { + case time__FormatDate__ddmmyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__ddmmyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmdd: + { + _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__mmmddyyyy: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yyyymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__yymmdd: + { + _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + case time__FormatDate__no_date: + default: + { + _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatDate*/0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); + break; + } + } + string res = _t2; + string del = ((fmt_dlmtr == (time__FormatDelimiter__dot))? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen))? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash))? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space))? (_SLIT(" ")) : (_SLIT(""))); + res = string_replace(res, _SLIT("|"), del); + string _t3 = res; + return _t3; +} + +string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { + if (fmt_date == time__FormatDate__no_date) { + if (fmt_time == time__FormatTime__no_time) { + string _t1 = _SLIT(""); + return _t1; + } else { + string _t2 = time__Time_get_fmt_time_str(t, fmt_time); + return _t2; + } + } else { + if (fmt_time != time__FormatTime__no_time) { + string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + string tstr = time__Time_get_fmt_time_str(t, fmt_time); + string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dstr}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } else { + string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); + return _t4; + } + } + return (string){.str=(byteptr)"", .is_lit=1}; +} + +string time__Time_utc_string(time__Time t) { + string day_str = time__Time_weekday_str(&t); + string month_str = time__Time_smonth(&t); + string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = day_str}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = month_str}}, {_SLIT(" "), /*100 &int*/0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); + string _t1 = utc_string; + return _t1; +} + +VV_LOCAL_SYMBOL f64 time__mceil(f64 x) { + if (x > 0) { + f64 _t1 = 1 + ((int)(x)); + return _t1; + } + if (x < 0) { + f64 _t2 = -((int)(-x)); + return _t2; + } + f64 _t3 = 0; + return _t3; +} + +// Attr: [inline] +inline bool time__Time__eq(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; + return _t1; +} + +// Attr: [inline] +inline bool time__Time__lt(time__Time t1, time__Time t2) { + bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); + return _t1; +} + +// Attr: [inline] +inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { + i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; + i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; + time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; + return _t1; +} + +_option_time__Time time__parse_rfc3339(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); + _option_time__Time _t2 = time__parse_iso8601(sn); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + } + + time__Time t = (*(time__Time*)_t2.data); + if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { + _option_time__Time _t3; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t3), sizeof(time__Time)); + return _t3; + } + _option_int _t4 = string_index(sn, _SLIT("T")); + if (_t4.state != 0) { /*or block*/ + IError err = _t4.err; + *(int*) _t4.data = -1; + } + + int t_i = (*(int*)_t4.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); + if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { + _option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); + if (_t5.state != 0) { /*or block*/ + _option_time__Time _t6; + memcpy(&_t6, &_t5, sizeof(_option)); + return _t6; + } + + multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); + int year = mr_1001.arg0; + int month = mr_1001.arg1; + int day = mr_1001.arg2; + t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); + _option_time__Time _t7; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t7), sizeof(time__Time)); + return _t7; + } + if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + _option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t8.state != 0) { /*or block*/ + _option_time__Time _t9; + memcpy(&_t9, &_t8, sizeof(_option)); + return _t9; + } + + multi_return_int_int_int_int_i64_bool mr_1383 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); + hour_ = mr_1383.arg0; + minute_ = mr_1383.arg1; + second_ = mr_1383.arg2; + microsecond_ = mr_1383.arg3; + unix_offset = mr_1383.arg4; + is_local_time = mr_1383.arg5; + t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); + if (is_local_time) { + _option_time__Time _t10; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t10), sizeof(time__Time)); + return _t10; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + _option_time__Time _t11; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t11), sizeof(time__Time)); + return _t11; + } + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +_option_time__Time time__parse(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t2 = string_index(s, _SLIT(" ")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t2.data); + string symd = string_substr(s, 0, pos); + Array_string ymd = string_split(symd, _SLIT("-")); + if (ymd.len != 3) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + string shms = string_substr(s, pos, (s).len); + Array_string hms = string_split(shms, _SLIT(":")); + string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); + string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); + string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); + int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); + int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); + int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); + int ihour = string_int(hour_); + int iminute = string_int(minute_); + int isecond = string_int(second_); + if (iyear > 9999 || iyear < -9999) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (imonth > 12 || imonth < 1) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iday > 31 || iday < 1) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (ihour > 23 || ihour < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (iminute > 59 || iminute < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (isecond > 59 || isecond < 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + time__Time res = time__new_time(((time__Time){ + .year = iyear, + .month = imonth, + .day = iday, + .hour = ihour, + .minute = iminute, + .second = isecond, + .microsecond = 0, + ._v_unix = 0, + .is_local = 0, + })); + _option_time__Time _t11; + opt_ok2(&(time__Time[]) { res }, (_option*)(&_t11), sizeof(time__Time)); + return _t11; +} + +_option_time__Time time__parse_iso8601(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t2 = string_index(s, _SLIT("T")); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(int*) _t2.data = -1; + } + + int t_i = (*(int*)_t2.data); + Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); + if (!(parts.len == 1 || parts.len == 2)) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); + if (_t4.state != 0) { /*or block*/ + _option_time__Time _t5; + memcpy(&_t5, &_t4, sizeof(_option)); + return _t5; + } + + multi_return_int_int_int mr_3644 = (*(multi_return_int_int_int*)_t4.data); + int year = mr_3644.arg0; + int month = mr_3644.arg1; + int day = mr_3644.arg2; + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + i64 unix_offset = ((i64)(0)); + bool is_local_time = true; + if (parts.len == 2) { + _option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); + if (_t6.state != 0) { /*or block*/ + _option_time__Time _t7; + memcpy(&_t7, &_t6, sizeof(_option)); + return _t7; + } + + multi_return_int_int_int_int_i64_bool mr_3885 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); + hour_ = mr_3885.arg0; + minute_ = mr_3885.arg1; + second_ = mr_3885.arg2; + microsecond_ = mr_3885.arg3; + unix_offset = mr_3885.arg4; + is_local_time = mr_3885.arg5; + } + time__Time t = time__new_time(((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hour_, + .minute = minute_, + .second = second_, + .microsecond = microsecond_, + ._v_unix = 0, + .is_local = 0, + })); + if (is_local_time) { + _option_time__Time _t8; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t8), sizeof(time__Time)); + return _t8; + } + i64 unix_time = t._v_unix; + if (unix_offset < 0) { + unix_time -= (-unix_offset); + } else if (unix_offset > 0) { + unix_time += unix_offset; + } + t = time__unix2(((i64)(unix_time)), t.microsecond); + _option_time__Time _t9; + opt_ok2(&(time__Time[]) { t }, (_option*)(&_t9), sizeof(time__Time)); + return _t9; +} + +_option_time__Time time__parse_rfc2822(string s) { + if ((s).len == 0) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + Array_string fields = string_split(s, _SLIT(" ")); + if (fields.len < 5) { + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + + int pos = (*(int*)_t3.data); + int mm = pos / 3 + 1; + { // Unsafe block + u8* tmstr = malloc_noscan(s.len * 2); + int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); + _option_time__Time _t5 = time__parse(tos(tmstr, count)); + return _t5; + } + return (_option_time__Time){0}; +} + +VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s) { + int year = 0; + int month = 0; + int day = 0; + u8 dummy = ((u8)(0)); + int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); + if (count != 3) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (year > 9999) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (month > 12) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (day > 31) { + return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_multi_return_int_int_int _t5; + opt_ok2(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (_option*)(&_t5), sizeof(multi_return_int_int_int)); + return _t5; +} + +VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { + int hour_ = 0; + int minute_ = 0; + int second_ = 0; + int microsecond_ = 0; + int nanosecond_ = 0; + rune plus_min_z = 'a'; + int offset_hour = 0; + int offset_minute = 0; + int count = 0; + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%9d%c", &hour_, &minute_, &second_, &nanosecond_, ((char*)(&plus_min_z))); + if (count == 5 && plus_min_z == 'Z') { + int ndigits = 0; + _option_int _t1; + if (_t1 = string_index(s, _SLIT(".")), _t1.state == 0) { + int pos = *(int*)_t1.data; + pos++; + for (; pos < s.len && u8_is_digit(string_at(s, pos)); pos++) { + ndigits++; + } + } + for (;;) { + if (!(ndigits < 9)) break; + nanosecond_ *= 10; + ndigits++; + } + microsecond_ = nanosecond_ / 1000; + } else { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + if (count < 4) { + count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); + count++; + } + if (count < 4) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + } + bool is_local_time = plus_min_z == 'a' && count == 4; + bool is_utc = plus_min_z == 'Z' && count == 5; + if (!(count == 7 || is_local_time || is_utc)) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { + return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int unix_offset = 0; + if (offset_hour > 0) { + unix_offset += 3600 * offset_hour; + } + if (offset_minute > 0) { + unix_offset += 60 * offset_minute; + } + if (plus_min_z == '+') { + unix_offset *= -1; + } + _option_multi_return_int_int_int_int_i64_bool _t5; + opt_ok2(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (_option*)(&_t5), sizeof(multi_return_int_int_int_int_i64_bool)); + return _t5; +} + +string time__TimeParseError_msg(time__TimeParseError err) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), /*100 &int*/0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t1; +} + +VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { + IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); + return _t1; +} + +time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { + u64 initial = ((u64)(0U)); + if (opts.auto_start) { + initial = time__sys_mono_now(); + } + time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); + return _t1; +} + +void time__StopWatch_start(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; +} + +void time__StopWatch_restart(time__StopWatch* t) { + t->start = time__sys_mono_now(); + t->end = 0U; + t->elapsed = 0U; +} + +void time__StopWatch_stop(time__StopWatch* t) { + t->end = time__sys_mono_now(); +} + +void time__StopWatch_pause(time__StopWatch* t) { + if (t->start > 0U) { + if (t->end == 0U) { + t->elapsed += time__sys_mono_now() - t->start; + } else { + t->elapsed += t->end - t->start; + } + } + t->start = 0U; +} + +time__Duration time__StopWatch_elapsed(time__StopWatch t) { + if (t.start > 0U) { + if (t.end == 0U) { + time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); + return _t1; + } else { + time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); + return _t2; + } + } + time__Duration _t3 = ((((i64)(t.elapsed)))); + return _t3; +} + +time__Time time__now(void) { + time__Time _t1 = time__win_now(); + return _t1; + time_t t = time(0); + struct tm* now = localtime(&t); + time__Time _t2 = time__convert_ctime(*now, 0); + return _t2; +} + +time__Time time__utc(void) { + time__Time _t1 = time__win_utc(); + return _t1; + time_t t = time(0); + time(&t); + time__Time _t2 = time__unix2(((i64)(t)), 0); + return _t2; +} + +time__Time time__new_time(time__Time t) { + if (t._v_unix != 0) { + time__Time _t1 = t; + return _t1; + } + struct tm tt = ((struct tm){ + .tm_year = t.year - 1900, + .tm_mon = t.month - 1, + .tm_mday = t.day, + .tm_hour = t.hour, + .tm_min = t.minute, + .tm_sec = t.second, + }); + i64 utime = time__make_unix_time(tt); + time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); + return _t2; +} + +i64 time__ticks(void) { + #if defined(_WIN32) + { + i64 _t1 = GetTickCount(); + return _t1; + } + #else + { + } + #endif + return 0; +} + +string time__Time_str(time__Time t) { + string _t1 = time__Time_format_ss(t); + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { + time__Time _t1 = ((time__Time){ + .year = t.tm_year + 1900, + .month = t.tm_mon + 1, + .day = t.tm_mday, + .hour = t.tm_hour, + .minute = t.tm_min, + .second = t.tm_sec, + .microsecond = microsecond, + ._v_unix = time__make_unix_time(t), + .is_local = true, + }); + return _t1; +} + +string time__Time_strftime(time__Time t, string fmt) { + struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_year = 0,.tm_mon = 0,.tm_mday = 0,.tm_hour = 0,.tm_min = 0,.tm_sec = 0,}, sizeof(struct tm))); + #if defined(_WIN32) + { + tm = gmtime(((voidptr)(&t._v_unix))); + } + #else + { + } + #endif + Array_fixed_C__char_1024 buf = {0}; + char* fmt_c = ((char*)(fmt.str)); + strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); + string _t1 = cstring_to_vstring(((char*)(&buf[0]))); + return _t1; +} + +string time__Time_smonth(time__Time* t) { + if (t->month <= 0 || t->month > 12) { + string _t1 = _SLIT("---"); + return _t1; + } + int i = t->month - 1; + string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); + return _t2; +} + +// Attr: [inline] +inline i64 time__Time_unix_time(time__Time* t) { + i64 _t1 = t->_v_unix; + return _t1; +} + +// Attr: [inline] +inline i64 time__Time_unix_time_milli(time__Time* t) { + i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); + return _t1; +} + +time__Time time__Time_add(time__Time* t, time__Duration d) { + i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); + i64 _v_unix = microseconds / 1000000; + i64 micro = microseconds % 1000000; + time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); + return _t1; +} + +time__Time time__Time_add_seconds(time__Time* t, int seconds) { + time__Time _t1 = time__Time_add(t, seconds * _const_time__second); + return _t1; +} + +time__Time time__Time_add_days(time__Time* t, int days) { + time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); + return _t1; +} + +time__Duration time__since(time__Time t) { + time__Duration _t1 = time__Time__minus(time__now(), t); + return _t1; +} + +string time__Time_relative(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + string prefix = _SLIT(""); + string suffix = _SLIT(""); + if (secs < 0) { + secs *= -1; + prefix = _SLIT("in "); + } else { + suffix = _SLIT(" ago"); + } + if (secs < _const_time__seconds_per_minute / 2) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < _const_time__seconds_per_hour) { + i64 m = secs / _const_time__seconds_per_minute; + if (m == 1) { + string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (secs < _const_time__seconds_per_hour * 24) { + i64 h = secs / _const_time__seconds_per_hour; + if (h == 1) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t4; + } + string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t5; + } + if (secs < _const_time__seconds_per_hour * 24 * 7) { + i64 d = secs / _const_time__seconds_per_hour / 24; + if (d == 1) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t7; + } + if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { + if (string__eq(prefix, _SLIT("in "))) { + string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t8; + } + string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t9; + } + i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; + if (y == 1) { + string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t10; + } + string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t11; +} + +string time__Time_relative_short(time__Time* t) { + time__Time znow = time__now(); + i64 secs = znow._v_unix - t->_v_unix; + string prefix = _SLIT(""); + string suffix = _SLIT(""); + if (secs < 0) { + secs *= -1; + prefix = _SLIT("in "); + } else { + suffix = _SLIT(" ago"); + } + if (secs < _const_time__seconds_per_minute / 2) { + string _t1 = _SLIT("now"); + return _t1; + } + if (secs < _const_time__seconds_per_hour) { + i64 m = secs / _const_time__seconds_per_minute; + if (m == 1) { + string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (secs < _const_time__seconds_per_hour * 24) { + i64 h = secs / _const_time__seconds_per_hour; + if (h == 1) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t4; + } + string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t5; + } + if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { + i64 d = secs / _const_time__seconds_per_hour / 24; + if (d == 1) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t7; + } + i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; + if (y == 1) { + string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t8; + } + string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t9; +} + +int time__day_of_week(int y, int m, int d) { + Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ + 0, 3, 2, 5, 0, 3, 5, 1, 4, + 6, 2, 4})); + int sy = y; + if (m < 3) { + sy = sy - 1; + } + int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; + return _t1; +} + +int time__Time_day_of_week(time__Time* t) { + int _t1 = time__day_of_week(t->year, t->month, t->day); + return _t1; +} + +string time__Time_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); + return _t1; +} + +string time__Time_long_weekday_str(time__Time* t) { + int i = time__Time_day_of_week(t) - 1; + string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); + return _t1; +} + +bool time__is_leap_year(int year) { + bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); + return _t1; +} + +_option_int time__days_in_month(int month, int year) { + if (month > 12 || month < 1) { + return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), /*100 &int*/0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); + int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; + _option_int _t2; + opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); + return _t2; +} + +string time__Time_debug(time__Time* t) { + string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), /*100 &int*/0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), /*100 &int*/0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), /*100 &int*/0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), /*100 &int*/0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), /*100 &int*/0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), /*100 &int*/0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), /*100 &int*/0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), /*100 &i64*/0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); + return _t1; +} + +// TypeDecl +i64 time__Duration_nanoseconds(time__Duration d) { + i64 _t1 = ((i64)(d)); + return _t1; +} + +i64 time__Duration_microseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / _const_time__microsecond; + return _t1; +} + +i64 time__Duration_milliseconds(time__Duration d) { + i64 _t1 = ((i64)(d)) / _const_time__millisecond; + return _t1; +} + +f64 time__Duration_seconds(time__Duration d) { + i64 sec = d / _const_time__second; + i64 nsec = d % _const_time__second; + f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / _const_time__second; + return _t1; +} + +f64 time__Duration_minutes(time__Duration d) { + i64 min = d / _const_time__minute; + i64 nsec = d % _const_time__minute; + f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / _const_time__minute; + return _t1; +} + +f64 time__Duration_hours(time__Duration d) { + i64 hr = d / _const_time__hour; + i64 nsec = d % _const_time__hour; + f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / _const_time__hour; + return _t1; +} + +string time__Duration_str(time__Duration d) { + if (time__Duration_alias_eq(d, _const_time__infinite)) { + string _t1 = _SLIT("inf"); + return _t1; + } + i64 t = ((i64)(d)); + i64 hr = t / _const_time__hour; + t -= hr * _const_time__hour; + i64 min = t / _const_time__minute; + t -= min * _const_time__minute; + i64 sec = t / _const_time__second; + t -= sec * _const_time__second; + i64 ms = t / _const_time__millisecond; + t -= ms * _const_time__millisecond; + i64 us = t / _const_time__microsecond; + t -= us * _const_time__microsecond; + i64 ns = t; + if (hr > 0) { + string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = hr}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t2; + } + if (min > 0) { + string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); + return _t3; + } + if (sec > 0) { + string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); + return _t4; + } + if (ms > 0) { + string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ms}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); + return _t5; + } + if (us > 0) { + string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = us}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); + return _t6; + } + string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); + return _t7; +} + +int time__offset(void) { + time__Time t = time__utc(); + time__Time local = time__Time_local(&t); + int _t1 = ((int)(local._v_unix - t._v_unix)); + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { + i64 _t1 = time__portable_timegm(&t); + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void) { + u64 f = ((u64)(0U)); + QueryPerformanceFrequency(&f); + u64 _t1 = f; + return _t1; +} + +VV_LOCAL_SYMBOL u64 time__init_win_time_start(void) { + u64 s = ((u64)(0U)); + QueryPerformanceCounter(&s); + u64 _t1 = s; + return _t1; +} + +u64 time__sys_mono_now(void) { + u64 tm = ((u64)(0U)); + QueryPerformanceCounter(&tm); + u64 _t1 = (tm - _const_time__start_time) * 1000000000U / _const_time__freq_time; + return _t1; +} + +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { + u64 tm = ((u64)(0U)); + QueryPerformanceCounter(&tm); + u64 _t1 = tm; + return _t1; +} + +VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void) { + time_t t = time(0); + struct tm* tm = localtime(&t); + i64 _t1 = time__make_unix_time(*tm); + return _t1; +} + +time__Time time__Time_local(time__Time* t) { + if (t->is_local) { + time__Time _t1 = *t; + return _t1; + } + time__SystemTime st_utc = ((time__SystemTime){ + .year = ((u16)(t->year)), + .month = ((u16)(t->month)), + .day_of_week = 0, + .day = ((u16)(t->day)), + .hour = ((u16)(t->hour)), + .minute = ((u16)(t->minute)), + .second = ((u16)(t->second)), + .millisecond = ((u16)(t->microsecond / 1000)), + }); + time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); + time__Time t_local = ((time__Time){ + .year = st_local.year, + .month = st_local.month, + .day = st_local.day, + .hour = st_local.hour, + .minute = st_local.minute, + .second = st_local.second, + .microsecond = st_local.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_local), + .is_local = 0, + }); + time__Time _t2 = t_local; + return _t2; +} + +VV_LOCAL_SYMBOL time__Time time__win_now(void) { + struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); + GetSystemTimeAsFileTime(&ft_utc); + time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + FileTimeToSystemTime(&ft_utc, &st_utc); + time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); + time__Time t = ((time__Time){ + .year = st_local.year, + .month = st_local.month, + .day = st_local.day, + .hour = st_local.hour, + .minute = st_local.minute, + .second = st_local.second, + .microsecond = st_local.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_local), + .is_local = true, + }); + time__Time _t1 = t; + return _t1; +} + +VV_LOCAL_SYMBOL time__Time time__win_utc(void) { + struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); + GetSystemTimeAsFileTime(&ft_utc); + time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); + FileTimeToSystemTime(&ft_utc, &st_utc); + time__Time t = ((time__Time){ + .year = st_utc.year, + .month = st_utc.month, + .day = st_utc.day, + .hour = st_utc.hour, + .minute = st_utc.minute, + .second = st_utc.second, + .microsecond = st_utc.millisecond * 1000U, + ._v_unix = time__SystemTime_unix_time(st_utc), + .is_local = false, + }); + time__Time _t1 = t; + return _t1; +} + +i64 time__SystemTime_unix_time(time__SystemTime st) { + struct tm tt = ((struct tm){ + .tm_year = st.year - 1900U, + .tm_mon = st.month - 1U, + .tm_mday = st.day, + .tm_hour = st.hour, + .tm_min = st.minute, + .tm_sec = st.second, + }); + i64 _t1 = time__make_unix_time(tt); + return _t1; +} + +time__Time time__darwin_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__linux_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_now(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__darwin_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__linux_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +time__Time time__solaris_utc(void) { + time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); + return _t1; +} + +void time__sleep(time__Duration duration) { + Sleep(((int)(duration / _const_time__millisecond))); +} + +u32 time__Duration_sys_milliseconds(time__Duration d) { + if (d >= ((u32)(-1)) * _const_time__millisecond) { + u32 _t1 = ((u32)(-1)); + return _t1; + } else if (d <= 0) { + u32 _t2 = 0U; + return _t2; + } else { + u32 _t3 = ((u32)(d / _const_time__millisecond)); + return _t3; + } + return 0; +} + +time__Time time__unix(i64 abs) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); + int year = mr_472.arg0; + int month = mr_472.arg1; + int day = mr_472.arg2; + multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_528.arg0; + int min = mr_528.arg1; + int sec = mr_528.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = 0, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +time__Time time__unix2(i64 abs, int microsecond) { + i64 day_offset = abs / _const_time__seconds_per_day; + if (abs % _const_time__seconds_per_day < 0) { + day_offset--; + } + multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); + int year = mr_1020.arg0; + int month = mr_1020.arg1; + int day = mr_1020.arg2; + multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); + int hr = mr_1076.arg0; + int min = mr_1076.arg1; + int sec = mr_1076.arg2; + time__Time _t1 = ((time__Time){ + .year = year, + .month = month, + .day = day, + .hour = hr, + .minute = min, + .second = sec, + .microsecond = microsecond, + ._v_unix = abs, + .is_local = 0, + }); + return _t1; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { + i64 day_offset = day_offset_; + day_offset += 719468; + int era = 0; + if (day_offset >= 0) { + era = ((int)(day_offset / _const_time__days_per_400_years)); + } else { + era = ((int)((day_offset - _const_time__days_per_400_years - 1) / _const_time__days_per_400_years)); + } + i64 doe = day_offset - era * _const_time__days_per_400_years; + i64 yoe = (doe - doe / (_const_time__days_per_4_years - 1) + doe / _const_time__days_per_100_years - doe / (_const_time__days_per_400_years - 1)) / _const_time__days_in_year; + int y = ((int)(yoe + era * 400)); + i64 doy = doe - (_const_time__days_in_year * yoe + yoe / 4 - yoe / 100); + i64 mp = (5 * doy + 2) / 153; + int d = ((int)(doy - (153 * mp + 2) / 5 + 1)); + int m = ((int)(mp)); + if (mp < 10) { + m += 3; + } else { + m -= 9; + } + if (m <= 2) { + y += 1; + } + return (multi_return_int_int_int){.arg0=y, .arg1=m, .arg2=d}; +} + +VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { + i64 second_offset = second_offset_; + if (second_offset < 0) { + second_offset += _const_time__seconds_per_day; + } + i64 hour_ = second_offset / _const_time__seconds_per_hour; + second_offset %= _const_time__seconds_per_hour; + i64 min = second_offset / _const_time__seconds_per_minute; + second_offset %= _const_time__seconds_per_minute; + return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; +} + void v__dotgraph__start_digraph(void) { println(_SLIT("digraph G {")); atexit((voidptr) anon_fn_6b9593b3d6ef610a__82); @@ -26116,7 +27332,8 @@ VV_LOCAL_SYMBOL char** os__unix_environ(void) { } Map_string_string os__environ(void) { - Map_string_string res = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_string res = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; #if defined(_WIN32) { u16* estrings = GetEnvironmentStringsW(); @@ -26272,7 +27489,7 @@ _option_os__File os__open(string path) { _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("rb")); if (_t1.state != 0) { /*or block*/ _option_os__File _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26287,7 +27504,7 @@ _option_os__File os__create(string path) { _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("wb")); if (_t1.state != 0) { /*or block*/ _option_os__File _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26322,7 +27539,7 @@ _option_int os__File_read(os__File* f, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26366,7 +27583,7 @@ _option_int os__File_write_string(os__File* f, string s) { _option_void _t1 = os__File_write_full_buffer(f, s.str, ((usize)(s.len))); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_int _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26564,7 +27781,7 @@ _option_int os__File_read_bytes_into(os__File* f, u64 pos, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26585,7 +27802,7 @@ _option_int os__File_read_bytes_into(os__File* f, u64 pos, Array_u8* buf) { _option_int _t5 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t5.state != 0) { /*or block*/ _option_int _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -26617,7 +27834,7 @@ _option_int os__File_read_from(os__File* f, u64 pos, Array_u8* buf) { _option_int _t2 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t2.state != 0) { /*or block*/ _option_int _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26633,7 +27850,7 @@ _option_int os__File_read_from(os__File* f, u64 pos, Array_u8* buf) { _option_int _t5 = os__fread(buf->data, 1, buf->len, f->cfile); if (_t5.state != 0) { /*or block*/ _option_int _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -26725,12 +27942,143 @@ bool os__is_abs_path(string path) { bool _t1 = false; return _t1; } - bool _t2 = os__is_device_path(path) || os__is_drive_rooted(path) || os__is_normal_path(path); + bool _t2 = os__is_unc_path(path) || os__is_drive_rooted(path) || os__is_normal_path(path); return _t2; bool _t3 = string_at(path, 0) == _const_os__fslash; return _t3; } +string os__abs_path(string path) { + string wd = os__getwd(); + if (path.len == 0) { + string _t1 = wd; + return _t1; + } + string npath = os__norm_path(path); + if (string__eq(npath, _const_os__dot_str)) { + string _t2 = wd; + return _t2; + } + if (!os__is_abs_path(npath)) { + strings__Builder sb = strings__new_builder(npath.len); + strings__Builder_write_string(&sb, wd); + strings__Builder_write_string(&sb, _const_os__path_separator); + strings__Builder_write_string(&sb, npath); + string _t3 = os__norm_path(strings__Builder_str(&sb)); + return _t3; + } + string _t4 = npath; + return _t4; +} + +// Attr: [direct_array_access] +string os__norm_path(string path) { + if (path.len == 0) { + string _t1 = _const_os__dot_str; + return _t1; + } + bool rooted = os__is_abs_path(path); + string volume = os__get_volume(path); + int volume_len = volume.len; + string cpath = os__clean_path(string_substr(path, volume_len, (path).len)); + if (cpath.len == 0 && volume_len == 0) { + string _t2 = _const_os__dot_str; + return _t2; + } + Array_string spath = string_split(cpath, _const_os__path_separator); + if (!Array_string_contains(spath, _const_os__dot_dot)) { + string _t3 = (volume_len != 0 ? (string__plus(volume, cpath)) : (cpath)); + return _t3; + } + int spath_len = spath.len; + strings__Builder sb = strings__new_builder(cpath.len); + if (rooted) { + strings__Builder_write_string(&sb, _const_os__path_separator); + } + Array_string new_path = __new_array_with_default(0, spath_len, sizeof(string), 0); + int backlink_count = 0; + for (int i = spath_len - 1; i >= 0; i--) { + string part = ((string*)spath.data)[i]; + if (string__eq(part, _const_os__empty_str)) { + continue; + } + if (string__eq(part, _const_os__dot_dot)) { + backlink_count++; + continue; + } + if (backlink_count != 0) { + backlink_count--; + continue; + } + array_prepend(&new_path, &(string[]){part}); + } + if (backlink_count != 0 && !rooted) { + for (int i = 0; i < backlink_count; ++i) { + strings__Builder_write_string(&sb, _const_os__dot_dot); + if (new_path.len == 0 && i == backlink_count - 1) { + break; + } + strings__Builder_write_string(&sb, _const_os__path_separator); + } + } + strings__Builder_write_string(&sb, Array_string_join(new_path, _const_os__path_separator)); + string res = strings__Builder_str(&sb); + if (res.len == 0) { + if (volume_len != 0) { + string _t4 = volume; + return _t4; + } + if (!rooted) { + string _t5 = _const_os__dot_str; + return _t5; + } + string _t6 = _const_os__path_separator; + return _t6; + } + if (volume_len != 0) { + string _t7 = string__plus(volume, res); + return _t7; + } + string _t8 = res; + return _t8; +} + +VV_LOCAL_SYMBOL string os__clean_path(string path) { + if (path.len == 0) { + string _t1 = _const_os__empty_str; + return _t1; + } + strings__Builder sb = strings__new_builder(path.len); + strings__textscanner__TextScanner sc = strings__textscanner__new(path); + for (;;) { + if (!(strings__textscanner__TextScanner_next(&sc) != -1)) break; + u8 curr = ((u8)(strings__textscanner__TextScanner_current(&sc))); + int back = strings__textscanner__TextScanner_peek_back(&sc); + int peek = strings__textscanner__TextScanner_peek(&sc); + if (back != -1 && os__is_slash(((u8)(back))) && os__is_slash(curr)) { + continue; + } + if ((back == -1 || os__is_slash(((u8)(back)))) && curr == _const_os__dot && (peek == -1 || os__is_slash(((u8)(peek))))) { + if (peek != -1 && os__is_slash(((u8)(peek)))) { + strings__textscanner__TextScanner_skip_n(&sc, 1); + } + continue; + } + if (curr == _const_os__fslash) { + strings__Builder_write_u8(&sb, _const_os__bslash); + continue; + } + strings__Builder_write_u8(&sb, ((u8)(strings__textscanner__TextScanner_current(&sc)))); + } + string res = strings__Builder_str(&sb); + if (res.len > 1 && os__is_slash(string_at(res, res.len - 1))) { + string _t2 = string_substr(res, 0, res.len - 1); + return _t2; + } + string _t3 = res; + return _t3; +} + VV_LOCAL_SYMBOL int os__win_volume_len(string path) { int plen = path.len; if (plen < 2) { @@ -26741,7 +28089,7 @@ VV_LOCAL_SYMBOL int os__win_volume_len(string path) { int _t2 = 2; return _t2; } - if (path.len >= 5 && os__starts_w_slash_slash(path) && !os__is_slash(string_at(path, 2))) { + if (plen >= 5 && os__starts_w_slash_slash(path) && !os__is_slash(string_at(path, 2))) { for (int i = 3; i < plen; i++) { if (os__is_slash(string_at(path, i))) { if (i + 1 >= plen || os__is_slash(string_at(path, i + 1))) { @@ -26763,6 +28111,20 @@ VV_LOCAL_SYMBOL int os__win_volume_len(string path) { return _t5; } +VV_LOCAL_SYMBOL string os__get_volume(string path) { + string volume = string_substr(path, 0, os__win_volume_len(path)); + if (volume.len == 0) { + string _t1 = _const_os__empty_str; + return _t1; + } + if (string_at(volume, 0) == _const_os__fslash) { + string _t2 = string_replace(volume, _SLIT("/"), _SLIT("\\")); + return _t2; + } + string _t3 = volume; + return _t3; +} + VV_LOCAL_SYMBOL bool os__is_slash(u8 b) { bool _t1 = b == _const_os__bslash || b == _const_os__fslash; return _t1; @@ -26770,7 +28132,7 @@ VV_LOCAL_SYMBOL bool os__is_slash(u8 b) { return _t2; } -VV_LOCAL_SYMBOL bool os__is_device_path(string path) { +VV_LOCAL_SYMBOL bool os__is_unc_path(string path) { bool _t1 = os__win_volume_len(path) >= 5 && os__starts_w_slash_slash(path); return _t1; } @@ -26852,7 +28214,7 @@ _option_void os__open_uri(string uri) { _option_voidptr _t2 = dl__open_opt(_SLIT("shell32"), _const_dl__rtld_now); if (_t2.state != 0) { /*or block*/ _option_void _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -26860,7 +28222,7 @@ _option_void os__open_uri(string uri) { _option_voidptr _t4 = dl__sym_opt(handle, _SLIT("ShellExecuteW")); if (_t4.state != 0) { /*or block*/ _option_void _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -26877,7 +28239,7 @@ FILE* fp; _option_FILE_ptr _t1 = os__vfopen(path, _SLIT("rb")); if (_t1.state != 0) { /*or block*/ _option_Array_u8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -26943,7 +28305,7 @@ FILE* fp; _option_FILE_ptr _t1 = os__vfopen(path, mode); if (_t1.state != 0) { /*or block*/ _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -27883,7 +29245,7 @@ _option_void os__write_file_array(string path, array buffer) { _option_os__File _t1 = os__create(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -27891,7 +29253,7 @@ _option_void os__write_file_array(string path, array buffer) { _option_void _t3 = os__File_write_full_buffer(&f, buffer.data, ((usize)(buffer.len * buffer.element_size))); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -27907,7 +29269,7 @@ _option_Array_string os__glob(Array_string patterns) { _option_void _t2 = os__native_glob_pattern(pattern, &/*arr*/matches); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_Array_string _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -27953,7 +29315,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_void _t2 = os__rm(adjusted_path); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_void _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -27965,7 +29327,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_void _t5 = os__cp(source_path, adjusted_path); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -27976,7 +29338,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_bool _t7 = os__mkdir(dest_path); if (_t7.state != 0) { /*or block*/ _option_void _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -27988,7 +29350,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_Array_string _t10 = os__ls(source_path); if (_t10.state != 0) { /*or block*/ _option_void _t11; - memcpy(&_t11, &_t10, sizeof(Option)); + memcpy(&_t11, &_t10, sizeof(_option)); return _t11; } @@ -28002,7 +29364,7 @@ _option_void os__cp_all(string src, string dst, bool overwrite) { _option_bool _t13 = os__mkdir(dp); if (_t13.state != 0) { /*or block*/ _option_void _t14; - memcpy(&_t14, &_t13, sizeof(Option)); + memcpy(&_t14, &_t13, sizeof(_option)); return _t14; } @@ -28031,7 +29393,7 @@ _option_void os__mv_by_cp(string source, string target) { _option_void _t1 = os__cp(source, target); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -28039,7 +29401,7 @@ _option_void os__mv_by_cp(string source, string target) { _option_void _t3 = os__rm(source); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -28052,7 +29414,7 @@ _option_Array_string os__read_lines(string path) { _option_string _t1 = os__read_file(path); if (_t1.state != 0) { /*or block*/ _option_Array_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -28121,7 +29483,7 @@ _option_void os__rmdir_all(string path) { _option_Array_string _t1 = os__ls(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -28387,7 +29749,7 @@ _option_void os__write_file(string path, string text) { _option_os__File _t1 = os__create(path); if (_t1.state != 0) { /*or block*/ _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -28395,7 +29757,7 @@ _option_void os__write_file(string path, string text) { _option_void _t3 = os__File_write_full_buffer(&f, text.str, ((usize)(text.len))); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -29193,7 +30555,7 @@ _option_bool os__is_writable_folder(string folder) { _option_void _t5 = os__rm(tmp_perm_check); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_bool _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -29989,7 +31351,8 @@ string v__depgraph__DepGraph_display_cycles(v__depgraph__DepGraph* graph) { cycle_names = mr_3360.arg1; if (seen) { array_push((array*)&out, _MOV((string[]){ string_clone(string__plus(_SLIT(" * "), Array_string_join(cycle_names, _SLIT(" -> ")))) })); - nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + nn.is_cycle = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; } } string _t7 = Array_string_join(out, _SLIT("\n")); @@ -30048,2019 +31411,42 @@ void v__depgraph__show(v__depgraph__DepGraph* graph, string path) { v__dotgraph__DotGraph_finish(dg); } -// Attr: [deprecated] -f64 math__fabs(f64 x) { - if (x > 0.0) { - return x; - } - return -x; -} - -f64 math__inf(int sign) { - u64 v = (sign >= 0 ? (_const_math__uvinf) : (_const_math__uvneginf)); - return math__f64_from_bits(v); -} - -f64 math__nan(void) { - return math__f64_from_bits(_const_math__uvnan); -} - -bool math__is_nan(f64 f) { - return f != f; -} - -bool math__is_inf(f64 f, int sign) { - return (sign >= 0 && f > _const_math__max_f64) || (sign <= 0 && f < -_const_math__max_f64); -} - -bool math__is_finite(f64 f) { - return !math__is_nan(f) && !math__is_inf(f, 0); -} - -multi_return_f64_int math__normalize(f64 x) { - f64 smallest_normal = 2.2250738585072014e-308; - if (math__abs_T_f64(x) < smallest_normal) { - return (multi_return_f64_int){.arg0=x * _const_math__normalize_smallest_mask, .arg1=-52}; - } - return (multi_return_f64_int){.arg0=x, .arg1=0}; -} - -f64 math__cbrt(f64 a) { - f64 x = a; - int b1 = 715094163; - int b2 = 696219795; - f64 c = 5.42857142857142815906e-01; - f64 d = -7.05306122448979611050e-01; - f64 e_ = 1.41428571428571436819e+00; - f64 f = 1.60714285714285720630e+00; - f64 g = 3.57142857142857150787e-01; - f64 smallest_normal = 2.22507385850720138309e-308; - if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - f64 t = math__f64_from_bits(math__f64_bits(x) / ((u64)(3U)) + (((u64)(b1)) << 32U)); - if (x < smallest_normal) { - t = ((f64)(((u64)(1U)) << 54U)); - t *= x; - t = math__f64_from_bits(math__f64_bits(t) / ((u64)(3U)) + (((u64)(b2)) << 32U)); - } - f64 r = t * t / x; - f64 s = c + r * t; - t *= g + f / (s + e_ + d / s); - t = math__f64_from_bits((math__f64_bits(t) & (((u64)(0xffffffffcU)) << 28U)) + (((u64)(1U)) << 30U)); - s = t * t; - r = x / s; - f64 w = t + t; - r = (r - t) / (w + r); - t = t + t * r; - if (sign) { - t = -t; - } - return t; -} - -f64 math__mod(f64 x, f64 y) { - return math__fmod(x, y); -} - -f64 math__fmod(f64 x, f64 y) { - if (y == 0 || math__is_inf(x, 0) || math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } - f64 abs_y = math__abs_T_f64(y); - multi_return_f64_int mr_594 = math__frexp(abs_y); - f64 abs_y_fr = mr_594.arg0; - int abs_y_exp = mr_594.arg1; - f64 r = x; - if (x < 0) { - r = -x; - } - for (;;) { - if (!(r >= abs_y)) break; - multi_return_f64_int mr_680 = math__frexp(r); - f64 rfr = mr_680.arg0; - int rexp = mr_680.arg1; - if (rfr < abs_y_fr) { - rexp = rexp - 1; - } - r = r - math__ldexp(abs_y, rexp - abs_y_exp); - } - if (x < 0) { - r = -r; - } - return r; -} - -i64 math__gcd(i64 a_, i64 b_) { - i64 a = a_; - i64 b = b_; - if (a < 0) { - a = -a; - } - if (b < 0) { - b = -b; - } - for (;;) { - if (!(b != 0)) break; - a %= b; - if (a == 0) { - return b; - } - b %= a; - } - return a; -} - -multi_return_i64_i64_i64 math__egcd(i64 a, i64 b) { - i64 old_r = a; - i64 r = b; - i64 old_s = ((i64)(1)); - i64 s = ((i64)(0)); - i64 old_t = ((i64)(0)); - i64 t = ((i64)(1)); - for (;;) { - if (!(r != 0)) break; - i64 quot = old_r / r; - i64 _var_1339 = old_r; - i64 _var_1346 = r; - old_r = _var_1346; - r = _var_1339%_var_1346; - i64 _var_1365 = old_s; - i64 _var_1372 = s; - old_s = _var_1372; - s = _var_1365-quot*_var_1372; - i64 _var_1398 = old_t; - i64 _var_1405 = t; - old_t = _var_1405; - t = _var_1398-quot*_var_1405; - } - return (multi_return_i64_i64_i64){.arg0=(old_r < 0 ? (-old_r) : (old_r)), .arg1=old_s, .arg2=old_t}; -} - -i64 math__lcm(i64 a, i64 b) { - if (a == 0) { - return a; - } - i64 res = a * (b / math__gcd(b, a)); - if (res < 0) { - return -res; - } - return res; -} - -f64 math__erf(f64 a) { - f64 x = a; - f64 very_tiny = 2.848094538889218e-306; - f64 small_ = 1.0 / ((f64)(((u64)(1U)) << 28U)); - if (math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return 1.0; - } - if (math__is_inf(x, -1)) { - return ((f64)(-1)); - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - if (x < 0.84375) { - f64 temp = 0.0; - if (x < small_) { - if (x < very_tiny) { - temp = 0.125 * (8.0 * x + _const_math__efx8 * x); - } else { - temp = x + _const_math__efx * x; - } - } else { - f64 z = x * x; - f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); - f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); - f64 y = r / s_; - temp = x + x * y; - } - if (sign) { - return -temp; - } - return temp; - } - if (x < 1.25) { - f64 s_ = x - 1; - f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); - f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); - if (sign) { - return -_const_math__erx - p / q; - } - return _const_math__erx + p / q; - } - if (x >= 6) { - if (sign) { - return -1; - } - return 1.0; - } - f64 s_ = 1.0 / (x * x); - f64 r = 0.0; - f64 s = 0.0; - if (x < 2.857143) { - r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); - s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); - } else { - r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); - s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); - } - f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); - f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); - if (sign) { - return r_ / x - 1.0; - } - return 1.0 - r_ / x; -} - -f64 math__erfc(f64 a) { - f64 x = a; - f64 tiny = 1.0 / ((f64)(((u64)(1U)) << 56U)); - if (math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return 0.0; - } - if (math__is_inf(x, -1)) { - return 2.0; - } - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - if (x < 0.84375) { - f64 temp = 0.0; - if (x < tiny) { - temp = x; - } else { - f64 z = x * x; - f64 r = _const_math__pp0 + z * (_const_math__pp1 + z * (_const_math__pp2 + z * (_const_math__pp3 + z * _const_math__pp4))); - f64 s_ = 1.0 + z * (_const_math__qq1 + z * (_const_math__qq2 + z * (_const_math__qq3 + z * (_const_math__qq4 + z * _const_math__qq5)))); - f64 y = r / s_; - if (x < 0.25) { - temp = x + x * y; - } else { - temp = 0.5 + (x * y + (x - 0.5)); - } - } - if (sign) { - return 1.0 + temp; - } - return 1.0 - temp; - } - if (x < 1.25) { - f64 s_ = x - 1; - f64 p = _const_math__pa0 + s_ * (_const_math__pa1 + s_ * (_const_math__pa2 + s_ * (_const_math__pa3 + s_ * (_const_math__pa4 + s_ * (_const_math__pa5 + s_ * _const_math__pa6))))); - f64 q = 1.0 + s_ * (_const_math__qa1 + s_ * (_const_math__qa2 + s_ * (_const_math__qa3 + s_ * (_const_math__qa4 + s_ * (_const_math__qa5 + s_ * _const_math__qa6))))); - if (sign) { - return 1.0 + _const_math__erx + p / q; - } - return 1.0 - _const_math__erx - p / q; - } - if (x < 28) { - f64 s_ = 1.0 / (x * x); - f64 r = 0.0; - f64 s = 0.0; - if (x < 2.857143) { - r = _const_math__ra0 + s_ * (_const_math__ra1 + s_ * (_const_math__ra2 + s_ * (_const_math__ra3 + s_ * (_const_math__ra4 + s_ * (_const_math__ra5 + s_ * (_const_math__ra6 + s_ * _const_math__ra7)))))); - s = 1.0 + s_ * (_const_math__sa1 + s_ * (_const_math__sa2 + s_ * (_const_math__sa3 + s_ * (_const_math__sa4 + s_ * (_const_math__sa5 + s_ * (_const_math__sa6 + s_ * (_const_math__sa7 + s_ * _const_math__sa8))))))); - } else { - if (sign && x > 6) { - return 2.0; - } - r = _const_math__rb0 + s_ * (_const_math__rb1 + s_ * (_const_math__rb2 + s_ * (_const_math__rb3 + s_ * (_const_math__rb4 + s_ * (_const_math__rb5 + s_ * _const_math__rb6))))); - s = 1.0 + s_ * (_const_math__sb1 + s_ * (_const_math__sb2 + s_ * (_const_math__sb3 + s_ * (_const_math__sb4 + s_ * (_const_math__sb5 + s_ * (_const_math__sb6 + s_ * _const_math__sb7)))))); - } - f64 z = math__f64_from_bits((math__f64_bits(x) & 0xffffffff00000000U)); - f64 r_ = math__exp(-z * z - 0.5625) * math__exp((z - x) * (z + x) + r / s); - if (sign) { - return 2.0 - r_ / x; - } - return r_ / x; - } - if (sign) { - return 2.0; - } - return 0.0; -} - -f64 math__exp(f64 x) { - f64 log2e = 1.44269504088896338700e+00; - f64 overflow = 7.09782712893383973096e+02; - f64 underflow = -7.45133219101941108420e+02; - f64 near_zero = 1.0 / (268435456); - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (math__is_inf(x, -1)) { - return 0.0; - } - if (x > overflow) { - return math__inf(1); - } - if (x < underflow) { - return 0.0; - } - if (-near_zero < x && x < near_zero) { - return 1.0 + x; - } - int k = 0; - if (x < 0) { - k = ((int)(log2e * x - 0.5)); - } - if (x > 0) { - k = ((int)(log2e * x + 0.5)); - } - f64 hi = x - ((f64)(k)) * _const_math__ln2hi; - f64 lo = ((f64)(k)) * _const_math__ln2lo; - return math__expmulti(hi, lo, k); -} - -f64 math__exp2(f64 x) { - f64 overflow = 1.0239999999999999e+03; - f64 underflow = -1.0740e+03; - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (math__is_inf(x, -1)) { - return 0; - } - if (x > overflow) { - return math__inf(1); - } - if (x < underflow) { - return 0; - } - int k = 0; - if (x > 0) { - k = ((int)(x + 0.5)); - } - if (x < 0) { - k = ((int)(x - 0.5)); - } - f64 t = x - ((f64)(k)); - f64 hi = t * _const_math__ln2hi; - f64 lo = -t * _const_math__ln2lo; - return math__expmulti(hi, lo, k); -} - -f64 math__ldexp(f64 frac, int exp) { - return math__scalbn(frac, exp); -} - -multi_return_f64_int math__frexp(f64 x) { - u64 y = math__f64_bits(x); - int ee = ((int)(((y >> 52U) & 0x7ffU))); - if (ee == 0) { - if (x != 0.0) { - f64 x1p64 = math__f64_from_bits(((u64)(0x43f0000000000000U))); - multi_return_f64_int mr_3352 = math__frexp(x * x1p64); - f64 z = mr_3352.arg0; - int e_ = mr_3352.arg1; - return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; - } - return (multi_return_f64_int){.arg0=x, .arg1=0}; - } else if (ee == 0x7ff) { - return (multi_return_f64_int){.arg0=x, .arg1=0}; - } - int e_ = ee - 0x3fe; - y &= ((u64)(0x800fffffffffffffU)); - y |= ((u64)(0x3fe0000000000000U)); - return (multi_return_f64_int){.arg0=math__f64_from_bits(y), .arg1=e_}; -} - -f64 math__expm1(f64 x) { - if (math__is_inf(x, 1) || math__is_nan(x)) { - return x; - } - if (math__is_inf(x, -1)) { - return ((f64)(-1)); - } - if (math__abs_T_f64(x) < _const_math__ln2) { - f64 i = 1.0; - f64 sum = x; - f64 term = x / 1.0; - i++; - term *= x / ((f64)(i)); - sum += term; - for (;;) { - if (!(math__abs_T_f64(term) > math__abs_T_f64(sum) * _const_math__internal__f64_epsilon)) break; - i++; - term *= x / ((f64)(i)); - sum += term; - } - return sum; - } else { - return math__exp(x) - 1; - } - return 0; -} - -VV_LOCAL_SYMBOL f64 math__expmulti(f64 hi, f64 lo, int k) { - f64 exp_p1 = 1.66666666666666657415e-01; - f64 exp_p2 = -2.77777777770155933842e-03; - f64 exp_p3 = 6.61375632143793436117e-05; - f64 exp_p4 = -1.65339022054652515390e-06; - f64 exp_p5 = 4.13813679705723846039e-08; - f64 r = hi - lo; - f64 t = r * r; - f64 c = r - t * (exp_p1 + t * (exp_p2 + t * (exp_p3 + t * (exp_p4 + t * exp_p5)))); - f64 y = 1 - ((lo - (r * c) / (2 - c)) - hi); - return math__ldexp(y, k); -} - -f64 math__factorial(f64 n) { - if (n >= _const_math__factorials_table.len) { - return _const_math__max_f64; - } - if (n == ((f64)(((i64)(n)))) && n >= 0.0) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, ((i64)(n)))); - } - return math__gamma(n + 1.0); -} - -f64 math__log_factorial(f64 n) { - if (n < 0) { - return -_const_math__max_f64; - } - if (n != ((f64)(((i64)(n))))) { - return math__log_gamma(n + 1); - } else if (n < _const_math__log_factorials_table.len) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__log_factorials_table, ((i64)(n)))); - } - return math__log_factorial_asymptotic_expansion(((int)(n))); -} - -VV_LOCAL_SYMBOL f64 math__log_factorial_asymptotic_expansion(int n) { - int m = 6; - Array_f64 term = __new_array_with_default(0, 0, sizeof(f64), 0); - f64 xx = ((f64)((n + 1) * (n + 1))); - f64 xj = ((f64)(n + 1)); - f64 log_factorial = _const_math__log_sqrt_2pi - xj + (xj - 0.5) * math__log(xj); - int i = 0; - for (i = 0; i < m; i++) { - array_push((array*)&term, _MOV((f64[]){ (*(f64*)/*ee elem_sym */array_get(_const_math__bernoulli, i)) / xj })); - xj *= xx; - } - f64 sum = (*(f64*)/*ee elem_sym */array_get(term, m - 1)); - for (i = m - 2; i >= 0; i--) { - if (math__abs_T_f64(sum) <= math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(term, i)))) { - break; - } - sum = (*(f64*)/*ee elem_sym */array_get(term, i)); - } - for (;;) { - if (!(i >= 0)) break; - sum += (*(f64*)/*ee elem_sym */array_get(term, i)); - i--; - } - return log_factorial + sum; -} - -i64 math__factoriali(int n) { - if (n <= 0) { - return ((i64)(1)); - } - if (n < 21) { - return ((i64)((*(f64*)/*ee elem_sym */array_get(_const_math__factorials_table, n)))); - } - return ((i64)(-1)); -} - -f64 math__floor(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - if (x < 0) { - multi_return_f64_f64 mr_280 = math__modf(-x); - f64 d = mr_280.arg0; - f64 fract = mr_280.arg1; - if (fract != 0.0) { - d = d + 1; - } - return -d; - } - multi_return_f64_f64 mr_350 = math__modf(x); - f64 d = mr_350.arg0; - return d; -} - -f64 math__ceil(f64 x) { - return -math__floor(-x); -} - -f64 math__trunc(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - multi_return_f64_f64 mr_793 = math__modf(x); - f64 d = mr_793.arg0; - return d; -} - -f64 math__round(f64 x) { - if (x == 0 || math__is_nan(x) || math__is_inf(x, 0)) { - return x; - } - f64 y = math__floor(x); - f64 r = x - y; - if (r > 0.5) { - { // Unsafe block - goto rndup; - } - } - if (r == 0.5) { - r = y - 2.0 * math__floor(0.5 * y); - if (r == 1.0) { - rndup: {} - y += 1.0; - } - } - return y; -} - -f64 math__round_to_even(f64 x) { - u64 bits = math__f64_bits(x); - u64 e_ = ((bits >> _const_math__shift) & _const_math__mask); - if (e_ >= _const_math__bias) { - u64 half_minus_ulp = ((u64)(((u64)(1U)) << (_const_math__shift - 1))) - 1U; - e_ -= ((u64)(_const_math__bias)); - bits += (half_minus_ulp + ((bits >> (_const_math__shift - e_)) & 1U)) >> e_; - bits &= _const_math__frac_mask >> e_; - bits ^= _const_math__frac_mask >> e_; - } else if (e_ == _const_math__bias - 1 && (bits & _const_math__frac_mask) != 0U) { - bits = ((bits & _const_math__sign_mask) | _const_math__uvone); - } else { - bits &= _const_math__sign_mask; - } - return math__f64_from_bits(bits); -} - -VV_LOCAL_SYMBOL multi_return_f64_f64 math__stirling(f64 x) { - if (x > 200) { - return (multi_return_f64_f64){.arg0=math__inf(1), .arg1=1.0}; - } - f64 sqrt_two_pi = 2.506628274631000502417; - f64 max_stirling = 143.01608; - f64 w = 1.0 / x; - w = 1.0 + w * (((((*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 0)) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 1))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 2))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 3))) * w + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_s, 4))); - f64 y1 = math__exp(x); - f64 y2 = 1.0; - if (x > max_stirling) { - f64 v = math__pow(x, 0.5 * x - 0.25); - f64 y1_ = y1; - y1 = v; - y2 = v / y1_; - } else { - y1 = math__pow(x, x - 0.5) / y1; - } - return (multi_return_f64_f64){.arg0=y1, .arg1=((f64)(sqrt_two_pi)) * w * y2}; -} - -f64 math__gamma(f64 a) { - f64 x = a; - f64 euler = 0.57721566490153286060651209008240243104215933593992; - if (math__is_neg_int(x) || math__is_inf(x, -1) || math__is_nan(x)) { - return math__nan(); - } - if (math__is_inf(x, 1)) { - return math__inf(1); - } - if (x == 0.0) { - return math__copysign(math__inf(1), x); - } - f64 q = math__abs_T_f64(x); - f64 p = math__floor(q); - if (q > 33) { - if (x >= 0) { - multi_return_f64_f64 mr_1482 = math__stirling(x); - f64 y1 = mr_1482.arg0; - f64 y2 = mr_1482.arg1; - return y1 * y2; - } - int signgam = 1; - i64 ip = ((i64)(p)); - if (((ip & 1)) == 0) { - signgam = -1; - } - f64 z = q - p; - if (z > 0.5) { - p = p + 1; - z = q - p; - } - z = q * math__sin(_const_math__pi * z); - if (z == 0) { - return math__inf(signgam); - } - multi_return_f64_f64 mr_1927 = math__stirling(q); - f64 sq1 = mr_1927.arg0; - f64 sq2 = mr_1927.arg1; - f64 absz = math__abs_T_f64(z); - f64 d = absz * sq1 * sq2; - if (math__is_inf(d, 0)) { - z = _const_math__pi / absz / sq1 / sq2; - } else { - z = _const_math__pi / d; - } - return ((f64)(signgam)) * z; - } - f64 z = 1.0; - for (;;) { - if (!(x >= 3)) break; - x = x - 1; - z = z * x; - } - for (;;) { - if (!(x < 0)) break; - if (x > -1e-09) { - { // Unsafe block - goto _v_small; - } - } - z = z / x; - x = x + 1; - } - for (;;) { - if (!(x < 2)) break; - if (x < 1e-09) { - { // Unsafe block - goto _v_small; - } - } - z = z / x; - x = x + 1; - } - if (x == 2) { - return z; - } - x = x - 2; - p = (((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_p, 6)); - q = ((((((x * (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 0)) + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 1))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 2))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 3))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 4))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 5))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 6))) * x + (*(f64*)/*ee elem_sym */array_get(_const_math__gamma_q, 7)); - if (true) { - return z * p / q; - } - _v_small: {} - if (x == 0) { - return math__inf(1); - } - return z / ((1.0 + euler * x) * x); -} - -f64 math__log_gamma(f64 x) { - multi_return_f64_int mr_3045 = math__log_gamma_sign(x); - f64 y = mr_3045.arg0; - return y; -} - -multi_return_f64_int math__log_gamma_sign(f64 a) { - f64 x = a; - f64 ymin = 1.461632144968362245; - f64 tiny = math__exp2(-70); - f64 two52 = math__exp2(52); - f64 two58 = math__exp2(58); - f64 tc = 1.46163214496836224576e+00; - f64 tf = -1.21486290535849611461e-01; - f64 tt = -3.63867699703950536541e-18; - int sign = 1; - if (math__is_nan(x)) { - return (multi_return_f64_int){.arg0=x, .arg1=sign}; - } - if (math__is_inf(x, 1)) { - return (multi_return_f64_int){.arg0=x, .arg1=sign}; - } - if (x == 0.0) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - bool neg = false; - if (x < 0) { - x = -x; - neg = true; - } - if (x < tiny) { - if (neg) { - sign = -1; - } - return (multi_return_f64_int){.arg0=-math__log(x), .arg1=sign}; - } - f64 nadj = 0.0; - if (neg) { - if (x >= two52) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - f64 t = math__sin_pi(x); - if (t == 0) { - return (multi_return_f64_int){.arg0=math__inf(1), .arg1=sign}; - } - nadj = math__log(_const_math__pi / math__abs_T_f64(t * x)); - if (t < 0) { - sign = -1; - } - } - f64 lgamma = 0.0; - if (x == 1 || x == 2) { - return (multi_return_f64_int){.arg0=0.0, .arg1=sign}; - } else if (x < 2) { - f64 y = 0.0; - int i = 0; - if (x <= 0.9) { - lgamma = -math__log(x); - if (x >= (ymin - 1 + 0.27)) { - y = 1.0 - x; - i = 0; - } else if (x >= (ymin - 1 - 0.27)) { - y = x - (tc - 1); - i = 1; - } else { - y = x; - i = 2; - } - } else { - lgamma = 0; - if (x >= (ymin + 0.27)) { - y = ((f64)(2)) - x; - i = 0; - } else if (x >= (ymin - 0.27)) { - y = x - tc; - i = 1; - } else { - y = x - 1; - i = 2; - } - } - if (i == 0) { - f64 z = y * y; - f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 2)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 4)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 6)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 8)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 10)))))); - f64 gamma_p2 = z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 1)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 3)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 5)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 7)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 9)) + z * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_a, 11))))))); - f64 p = y * gamma_p1 + gamma_p2; - lgamma += (p - 0.5 * y); - } else if (i == 1) { - f64 z = y * y; - f64 w = z * y; - f64 gamma_p1 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 0)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 3)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 6)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 9)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 12))))); - f64 gamma_p2 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 1)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 4)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 7)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 10)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 13))))); - f64 gamma_p3 = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 2)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 5)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 8)) + w * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 11)) + w * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_t, 14))))); - f64 p = z * gamma_p1 - (tt - w * (gamma_p2 + y * gamma_p3)); - lgamma += (tf + p); - } else if (i == 2) { - f64 gamma_p1 = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_u, 5))))))); - f64 gamma_p2 = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 4)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_v, 5)))))); - lgamma += (-0.5 * y + gamma_p1 / gamma_p2); - } - } else if (x < 8) { - int i = ((int)(x)); - f64 y = x - ((f64)(i)); - f64 p = y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 0)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_s, 6)))))))); - f64 q = 1.0 + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_r, 6))))))); - lgamma = 0.5 * y + p / q; - f64 z = 1.0; - if (i == 7) { - z *= (y + 6); - z *= (y + 5); - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 6) { - z *= (y + 5); - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 5) { - z *= (y + 4); - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 4) { - z *= (y + 3); - z *= (y + 2); - lgamma += math__log(z); - } else if (i == 3) { - z *= (y + 2); - lgamma += math__log(z); - } - } else if (x < two58) { - f64 t = math__log(x); - f64 z = 1.0 / x; - f64 y = z * z; - f64 w = (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 0)) + z * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 1)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 2)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 3)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 4)) + y * ((*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 5)) + y * (*(f64*)/*ee elem_sym */array_get(_const_math__lgamma_w, 6))))))); - lgamma = (x - 0.5) * (t - 1.0) + w; - } else { - lgamma = x * (math__log(x) - 1.0); - } - if (neg) { - lgamma = nadj - lgamma; - } - return (multi_return_f64_int){.arg0=lgamma, .arg1=sign}; -} - -VV_LOCAL_SYMBOL f64 math__sin_pi(f64 x_) { - f64 x = x_; - f64 two52 = math__exp2(52); - f64 two53 = math__exp2(53); - if (x < 0.25) { - return -math__sin(_const_math__pi * x); - } - f64 z = math__floor(x); - int n = 0; - if (z != x) { - x = math__mod(x, 2); - n = ((int)(x * 4)); - } else { - if (x >= two53) { - x = 0; - n = 0; - } else { - if (x < two52) { - z = x + two52; - } - n = (1 & ((int)(math__f64_bits(z)))); - x = ((f64)(n)); - n <<= 2; - } - } - if (n == 0) { - x = math__sin(_const_math__pi * x); - } else if (n == 1 || n == 2) { - x = math__cos(_const_math__pi * (0.5 - x)); - } else if (n == 3 || n == 4) { - x = math__sin(_const_math__pi * (1.0 - x)); - } else if (n == 5 || n == 6) { - x = -math__cos(_const_math__pi * (x - 1.5)); - } else { - x = math__sin(_const_math__pi * (x - 2)); - } - return -x; -} - -f64 math__hypot(f64 x, f64 y) { - if (math__is_inf(x, 0) || math__is_inf(y, 0)) { - return math__inf(1); - } - if (math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } - f64 result = 0.0; - if (x != 0.0 || y != 0.0) { - f64 abs_x = math__abs_T_f64(x); - f64 abs_y = math__abs_T_f64(y); - multi_return_f64_f64 mr_240 = math__minmax(abs_x, abs_y); - f64 min = mr_240.arg0; - f64 max = mr_240.arg1; - f64 rat = min / max; - f64 root_term = math__sqrt(1.0 + rat * rat); - if (max < _const_math__max_f64 / root_term) { - result = max * root_term; - } else { - _v_panic(_SLIT("overflow in hypot_e function")); - VUNREACHABLE(); - } - } - return result; -} - -f64 math__acosh(f64 x) { - if (x == 0.0) { - return 0.0; - } else if (x > 1.0 / _const_math__internal__sqrt_f64_epsilon) { - return math__log(x) + _const_math__pi * 2; - } else if (x > 2.0) { - return math__log(2.0 * x - 1.0 / (math__sqrt(x * x - 1.0) + x)); - } else if (x > 1.0) { - f64 t = x - 1.0; - return math__log1p(t + math__sqrt(2.0 * t + t * t)); - } else if (x == 1.0) { - return 0.0; - } else { - return math__nan(); - } - return 0; -} - -f64 math__asinh(f64 x) { - f64 a = math__abs_T_f64(x); - f64 s = (x < 0 ? (-1.0) : (1.0)); - if (a > 1.0 / _const_math__internal__sqrt_f64_epsilon) { - return s * (math__log(a) + _const_math__pi * 2.0); - } else if (a > 2.0) { - return s * math__log(2.0 * a + 1.0 / (a + math__sqrt(a * a + 1.0))); - } else if (a > _const_math__internal__sqrt_f64_epsilon) { - f64 a2 = a * a; - return s * math__log1p(a + a2 / (1.0 + math__sqrt(1.0 + a2))); - } else { - return x; - } - return 0; -} - -f64 math__atanh(f64 x) { - f64 a = math__abs_T_f64(x); - f64 s = (x < 0 ? (-1.0) : (1.0)); - if (a > 1.0) { - return math__nan(); - } else if (a == 1.0) { - return (x < 0 ? (math__inf(-1)) : (math__inf(1))); - } else if (a >= 0.5) { - return s * 0.5 * math__log1p(2.0 * a / (1.0 - a)); - } else if (a > _const_math__internal__f64_epsilon) { - return s * 0.5 * math__log1p(2.0 * a + 2.0 * a * a / (1.0 - a)); - } else { - return x; - } - return 0; -} - // Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__xatan(f64 x) { - f64 xatan_p0 = -8.750608600031904122785e-01; - f64 xatan_p1 = -1.615753718733365076637e+01; - f64 xatan_p2 = -7.500855792314704667340e+01; - f64 xatan_p3 = -1.228866684490136173410e+02; - f64 xatan_p4 = -6.485021904942025371773e+01; - f64 xatan_q0 = 2.485846490142306297962e+01; - f64 xatan_q1 = 1.650270098316988542046e+02; - f64 xatan_q2 = 4.328810604912902668951e+02; - f64 xatan_q3 = 4.853903996359136964868e+02; - f64 xatan_q4 = 1.945506571482613964425e+02; - f64 z = x * x; - z = z * ((((xatan_p0 * z + xatan_p1) * z + xatan_p2) * z + xatan_p3) * z + xatan_p4) / (((((z + xatan_q0) * z + xatan_q1) * z + xatan_q2) * z + xatan_q3) * z + xatan_q4); - z = x * z + x; - return z; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__satan(f64 x) { - if (x <= 0.66) { - return math__xatan(x); - } - if (x > _const_math__tan3pio8) { - return _const_math__pi / 2.0 - math__xatan(1.0 / x) + ((f64)(_const_math__morebits)); - } - return _const_math__pi / 4 + math__xatan((x - 1.0) / (x + 1.0)) + 0.5 * ((f64)(_const_math__morebits)); -} - -f64 math__atan(f64 x) { - if (x == 0) { - return x; - } - if (x > 0) { - return math__satan(x); - } - return -math__satan(-x); -} - -f64 math__atan2(f64 y, f64 x) { - if (math__is_nan(y) || math__is_nan(x)) { - return math__nan(); - } - if (y == 0.0) { - if (x >= 0 && !math__signbit(x)) { - return math__copysign(0, y); - } - return math__copysign(_const_math__pi, y); - } - if (x == 0.0) { - return math__copysign(_const_math__pi / 2.0, y); - } - if (math__is_inf(x, 0)) { - if (math__is_inf(x, 1)) { - if (math__is_inf(y, 0)) { - return math__copysign(_const_math__pi / 4, y); - } - return math__copysign(0, y); - } - if (math__is_inf(y, 0)) { - return math__copysign(3.0 * _const_math__pi / 4.0, y); - } - return math__copysign(_const_math__pi, y); - } - if (math__is_inf(y, 0)) { - return math__copysign(_const_math__pi / 2.0, y); - } - f64 q = math__atan(y / x); - if (x < 0) { - if (q <= 0) { - return q + _const_math__pi; - } - return q - _const_math__pi; - } - return q; -} - -f64 math__asin(f64 x_) { - f64 x = x_; - if (x == 0.0) { - return x; - } - bool sign = false; - if (x < 0.0) { - x = -x; - sign = true; - } - if (x > 1.0) { - return math__nan(); - } - f64 temp = math__sqrt(1.0 - x * x); - if (x > 0.7) { - temp = _const_math__pi / 2.0 - math__satan(temp / x); - } else { - temp = math__satan(x / temp); - } - if (sign) { - temp = -temp; - } - return temp; -} - -// Attr: [inline] -inline f64 math__acos(f64 x) { - if ((x < -1.0) || (x > 1.0)) { - return math__nan(); - } - if (x > 0.5) { - return ((f64)(2.0)) * math__asin(math__sqrt(0.5 - 0.5 * x)); - } - f64 z = _const_math__pi / ((f64)(4.0)) - math__asin(x); - z = z + _const_math__morebits; - z = z + _const_math__pi / ((f64)(4.0)); - return z; -} - -f64 math__log_n(f64 x, f64 b) { - f64 y = math__log(x); - f64 z = math__log(b); - return y / z; -} - -f64 math__log10(f64 x) { - return math__log(x) * (1.0 / _const_math__ln10); -} - -f64 math__log2(f64 x) { - multi_return_f64_int mr_364 = math__frexp(x); - f64 frac = mr_364.arg0; - int exp = mr_364.arg1; - if (frac == 0.5) { - return ((f64)(exp - 1)); - } - return math__log(frac) * (1.0 / _const_math__ln2) + ((f64)(exp)); -} - -f64 math__log1p(f64 x) { - f64 y = 1.0 + x; - f64 z = y - 1.0; - return math__log(y) - (z - x) / y; -} - -f64 math__log_b(f64 x) { - if (x == 0) { - return math__inf(-1); - } - if (math__is_inf(x, 0)) { - return math__inf(1); - } - if (math__is_nan(x)) { - return x; - } - return ((f64)(math__ilog_b_(x))); -} - -int math__ilog_b(f64 x) { - if (x == 0) { - return _const_math__min_i32; - } - if (math__is_nan(x)) { - return _const_math__max_i32; - } - if (math__is_inf(x, 0)) { - return _const_math__max_i32; - } - return math__ilog_b_(x); -} - -VV_LOCAL_SYMBOL int math__ilog_b_(f64 x_) { - multi_return_f64_int mr_1424 = math__normalize(x_); - f64 x = mr_1424.arg0; - int exp = mr_1424.arg1; - return ((int)(((math__f64_bits(x) >> _const_math__shift) & _const_math__mask))) - _const_math__bias + exp; -} - -f64 math__log(f64 a) { - f64 ln2_hi = 6.93147180369123816490e-01; - f64 ln2_lo = 1.90821492927058770002e-10; - f64 l1 = 6.666666666666735130e-01; - f64 l2 = 3.999999999940941908e-01; - f64 l3 = 2.857142874366239149e-01; - f64 l4 = 2.222219843214978396e-01; - f64 l5 = 1.818357216161805012e-01; - f64 l6 = 1.531383769920937332e-01; - f64 l7 = 1.479819860511658591e-01; - f64 x = a; - if (math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } else if (x < 0) { - return math__nan(); - } else if (x == 0) { - return math__inf(-1); - } - multi_return_f64_int mr_4006 = math__frexp(x); - f64 f1 = mr_4006.arg0; - int ki = mr_4006.arg1; - if (f1 < _const_math__sqrt2 / 2) { - f1 *= 2; - ki--; - } - f64 f = f1 - 1; - f64 k = ((f64)(ki)); - f64 s = f / (2 + f); - f64 s2 = s * s; - f64 s4 = s2 * s2; - f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); - f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); - f64 r = t1 + t2; - f64 hfsq = 0.5 * f * f; - return k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); -} - -#if defined(_WIN32) -#else -#endif -f64 math__aprox_sin(f64 a) { - f64 a0 = 1.91059300966915117e-31; - f64 a1 = 1.00086760103908896; - f64 a2 = -1.21276126894734565e-2; - f64 a3 = -1.38078780785773762e-1; - f64 a4 = -2.67353392911981221e-2; - f64 a5 = 2.08026600266304389e-2; - f64 a6 = -3.03996055049204407e-3; - f64 a7 = 1.38235642404333740e-4; - return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * a7)))))); -} - -f64 math__aprox_cos(f64 a) { - f64 a0 = 9.9995999154986614e-1; - f64 a1 = 1.2548995793001028e-3; - f64 a2 = -5.0648546280678015e-1; - f64 a3 = 1.2942246466519995e-2; - f64 a4 = 2.8668384702547972e-2; - f64 a5 = 7.3726485210586547e-3; - f64 a6 = -3.8510875386947414e-3; - f64 a7 = 4.7196604604366623e-4; - f64 a8 = -1.8776444013090451e-5; - return a0 + a * (a1 + a * (a2 + a * (a3 + a * (a4 + a * (a5 + a * (a6 + a * (a7 + a * a8))))))); -} - -// Attr: [inline] -inline f64 math__copysign(f64 x, f64 y) { - return math__f64_from_bits((((math__f64_bits(x) & ~_const_math__sign_mask)) | ((math__f64_bits(y) & _const_math__sign_mask)))); -} - -// Attr: [inline] -inline f64 math__degrees(f64 radians) { - return radians * (180.0 / _const_math__pi); -} - -Array_int math__digits(i64 num, math__DigitParams params) { - int b = params.base; - if (b < 2) { - _v_panic( str_intp(2, _MOV((StrIntpData[]){{_SLIT("digits: Cannot find digits of n with base "), /*100 &int*/0xfe07, {.d_i32 = b}}, {_SLIT0, 0, { .d_c = 0 }}}))); - VUNREACHABLE(); - } - i64 n = num; - int sign = 1; - if (n < 0) { - sign = -1; - n = -n; - } - Array_int res = __new_array_with_default(0, 0, sizeof(int), 0); - if (n == 0) { - array_push((array*)&res, _MOV((int[]){ 0 })); - return res; - } - for (;;) { - if (!(n != 0)) break; - i64 next_n = n / b; - array_push((array*)&res, _MOV((int[]){ ((int)(n - next_n * b)) })); - n = next_n; - } - if (sign == -1) { - (*(int*)array_get(res, res.len - 1)) *= sign; - } - if (params.reverse) { - res = array_reverse(res); - } - return res; -} - -int math__count_digits(i64 number) { - i64 n = number; - if (n == 0) { - return 1; - } - int c = 0; - for (;;) { - if (!(n != 0)) break; - n = n / 10; - c++; - } - return c; -} - -multi_return_f64_f64 math__minmax(f64 a, f64 b) { - if (a < b) { - return (multi_return_f64_f64){.arg0=a, .arg1=b}; - } - return (multi_return_f64_f64){.arg0=b, .arg1=a}; -} - -// Attr: [inline] -inline f64 math__clamp(f64 x, f64 a, f64 b) { - if (x < a) { - return a; - } - if (x > b) { - return b; - } - return x; -} - -// Attr: [inline] -inline f64 math__sign(f64 n) { - if (math__is_nan(n)) { - return math__nan(); - } - return math__copysign(1.0, n); -} - -// Attr: [inline] -inline int math__signi(f64 n) { - return ((int)(math__copysign(1.0, n))); -} - -// Attr: [inline] -inline f64 math__radians(f64 degrees) { - return degrees * (_const_math__pi / 180.0); -} - -// Attr: [inline] -inline bool math__signbit(f64 x) { - return (math__f64_bits(x) & _const_math__sign_mask) != 0U; -} - -bool math__tolerance(f64 a, f64 b, f64 tol) { - f64 ee = tol; - if (a == b) { - return true; - } - f64 d = a - b; - if (d < 0) { - d = -d; - } - if (b != 0) { - ee = ee * b; - if (ee < 0) { - ee = -ee; - } - } - return d < ee; -} - -bool math__close(f64 a, f64 b) { - return math__tolerance(a, b, 1e-14); -} - -bool math__veryclose(f64 a, f64 b) { - return math__tolerance(a, b, 4e-16); -} - -bool math__alike(f64 a, f64 b) { - if (math__is_nan(a) && math__is_nan(b)) { - return true; - } else if (a == b) { - return math__signbit(a) == math__signbit(b); - } - return false; -} - -VV_LOCAL_SYMBOL bool math__is_odd_int(f64 x) { - multi_return_f64_f64 mr_4654 = math__modf(x); - f64 xi = mr_4654.arg0; - f64 xf = mr_4654.arg1; - return xf == 0 && ((((i64)(xi)) & 1)) == 1; -} - -VV_LOCAL_SYMBOL bool math__is_neg_int(f64 x) { - if (x < 0) { - multi_return_f64_f64 mr_4754 = math__modf(x); - f64 xf = mr_4754.arg1; - return xf == 0; - } - return false; -} - -// Attr: [inline] -inline int math__min_T_int(int a, int b) { - return (a < b ? (a) : (b)); -} - -// Attr: [inline] -inline f64 math__abs_T_f64(f64 a) { - return (a < 0 ? (-a) : (a)); -} - -multi_return_f64_f64 math__modf(f64 f) { - f64 abs_f = math__abs_T_f64(f); - f64 i = 0.0; - if (abs_f >= _const_math__modf_maxpowtwo) { - i = f; - } else { - i = abs_f + _const_math__modf_maxpowtwo; - i -= _const_math__modf_maxpowtwo; - for (;;) { - if (!(i > abs_f)) break; - i -= 1.0; - } - if (f < 0.0) { - i = -i; - } - } - return (multi_return_f64_f64){.arg0=i, .arg1=f - i}; -} - -f32 math__nextafter32(f32 x, f32 y) { - f32 r = ((f32)(0.0)); - if (math__is_nan(((f64)(x))) || math__is_nan(((f64)(y)))) { - r = ((f32)(math__nan())); - } else if (x == y) { - r = x; - } else if (x == 0) { - r = ((f32)(math__copysign(((f64)(math__f32_from_bits(1U))), ((f64)(y))))); - } else if ((y > x) == (x > 0)) { - r = math__f32_from_bits(math__f32_bits(x) + 1U); - } else { - r = math__f32_from_bits(math__f32_bits(x) - 1U); - } - return r; -} - -f64 math__nextafter(f64 x, f64 y) { - f64 r = 0.0; - if (math__is_nan(x) || math__is_nan(y)) { - r = math__nan(); - } else if (x == y) { - r = x; - } else if (x == 0) { - r = math__copysign(math__f64_from_bits(1U), y); - } else if ((y > x) == (x > 0)) { - r = math__f64_from_bits(math__f64_bits(x) + 1U); - } else { - r = math__f64_from_bits(math__f64_bits(x) - 1U); - } - return r; -} - -VV_LOCAL_SYMBOL f64 math__poly_n_eval(Array_f64 c, int n, f64 x) { - if (c.len == 0) { - _v_panic(_SLIT("coeficients can not be empty")); - VUNREACHABLE(); - } - int len = ((int)(math__min_T_int(c.len, n))); - f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); - Array_f64 _t1 = array_slice(c, 0, len - 1); - for (int _t2 = 0; _t2 < _t1.len; ++_t2) { - f64 e = ((f64*)_t1.data)[_t2]; - ans = e + x * ans; - } - return ans; -} - -VV_LOCAL_SYMBOL f64 math__poly_n_1_eval(Array_f64 c, int n, f64 x) { - if (c.len == 0) { - _v_panic(_SLIT("coeficients can not be empty")); - VUNREACHABLE(); - } - int len = ((int)(math__min_T_int(c.len, n))) - 1; - f64 ans = (*(f64*)/*ee elem_sym */array_get(c, len - 1)); - Array_f64 _t1 = array_slice(c, 0, len - 1); - for (int _t2 = 0; _t2 < _t1.len; ++_t2) { - f64 e = ((f64*)_t1.data)[_t2]; - ans = e + x * ans; - } - return ans; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__poly_eval(Array_f64 c, f64 x) { - return math__poly_n_eval(c, c.len, x); -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL f64 math__poly_1_eval(Array_f64 c, f64 x) { - return math__poly_n_1_eval(c, c.len, x); -} - -VV_LOCAL_SYMBOL multi_return_f64_f64 math__ChebSeries_eval_e(math__ChebSeries cs, f64 x) { - f64 d = 0.0; - f64 dd = 0.0; - f64 y = (2.0 * x - cs.a - cs.b) / (cs.b - cs.a); - f64 y2 = 2.0 * y; - f64 e_ = 0.0; - f64 temp = 0.0; - for (int j = cs.order; j >= 1; j--) { - temp = d; - d = y2 * d - dd + (*(f64*)/*ee elem_sym */array_get(cs.c, j)); - e_ += math__abs_T_f64(y2 * temp) + math__abs_T_f64(dd) + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, j))); - dd = temp; - } - temp = d; - d = y * d - dd + 0.5 * (*(f64*)/*ee elem_sym */array_get(cs.c, 0)); - e_ += math__abs_T_f64(y * temp) + math__abs_T_f64(dd) + 0.5 * math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, 0))); - return (multi_return_f64_f64){.arg0=d, .arg1=((f64)(_const_math__internal__f64_epsilon)) * e_ + math__abs_T_f64((*(f64*)/*ee elem_sym */array_get(cs.c, cs.order)))}; -} - -// Attr: [inline] -inline f32 math__powf(f32 a, f32 b) { - return powf(a, b); -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_powf(f32 a, f32 b) { - return ((f32)(math__pow(a, b))); -} - -f64 math__pow10(int n) { - if (0 <= n && n <= 308) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10postab32, ((u32)(n)) / 32U)) * (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(n)) % 32U)); - } - if (-323 <= n && n <= 0) { - return (*(f64*)/*ee elem_sym */array_get(_const_math__pow10negtab32, ((u32)(-n)) / 32U)) / (*(f64*)/*ee elem_sym */array_get(_const_math__pow10tab, ((u32)(-n)) % 32U)); - } - if (n > 0) { - return math__inf(1); - } - return 0.0; -} - -i64 math__powi(i64 a, i64 b) { - i64 b_ = b; - i64 p = a; - i64 v = ((i64)(1)); - if (b_ < 0) { - if (a == 0) { - return -1; - } - return (a * a != 1 ? (0) : ((((b_ & 1)) > 0 ? (a) : (1)))); - } - for (; b_ > 0; ) { - if ((b_ & 1) > 0) { - v *= p; - } - p *= p; - b_ >>= 1; - } - return v; -} - -f64 math__pow(f64 x, f64 y) { - if (y == 0 || x == 1) { - return 1; - } else if (y == 1) { - return x; - } else if (math__is_nan(x) || math__is_nan(y)) { - return math__nan(); - } else if (x == 0) { - if (y < 0) { - if (math__is_odd_int(y)) { - return math__copysign(math__inf(1), x); - } - return math__inf(1); - } else if (y > 0) { - if (math__is_odd_int(y)) { - return x; - } - return 0; - } - } else if (math__is_inf(y, 0)) { - if (x == -1) { - return 1; - } else if ((math__abs_T_f64(x) < 1) == math__is_inf(y, 1)) { - return 0; - } else { - return math__inf(1); - } - } else if (math__is_inf(x, 0)) { - if (math__is_inf(x, -1)) { - return math__pow(1 / x, -y); - } - if (y < 0) { - return 0; - } else if (y > 0) { - return math__inf(1); - } - } else if (y == 0.5) { - return math__sqrt(x); - } else if (y == -0.5) { - return 1 / math__sqrt(x); - } - multi_return_f64_f64 mr_2400 = math__modf(math__abs_T_f64(y)); - f64 yi = mr_2400.arg0; - f64 yf = mr_2400.arg1; - if (yf != 0 && x < 0) { - return math__nan(); - } - if (yi >= (((u64)(1U)) << 63U)) { - if (x == -1) { - return 1; - } else if ((math__abs_T_f64(x) < 1) == (y > 0)) { - return 0; - } else { - return math__inf(1); - } - } - f64 a1 = 1.0; - int ae = 0; - if (yf != 0) { - if (yf > 0.5) { - yf--; - yi++; - } - a1 = math__exp(yf * math__log(x)); - } - multi_return_f64_int mr_3038 = math__frexp(x); - f64 x1 = mr_3038.arg0; - int xe = mr_3038.arg1; - for (i64 i = ((i64)(yi)); i != 0; i >>= 1) { - if (xe < ((int)(((u32)(((u32)(-1)) << 12U)))) || 4096 < xe) { - ae += xe; - break; - } - if ((i & 1) == 1) { - a1 *= x1; - ae += xe; - } - x1 *= x1; - xe <<= 1; - if (x1 < .5) { - x1 += x1; - xe--; - } - } - if (y < 0) { - a1 = 1 / a1; - ae = -ae; - } - return math__ldexp(a1, ae); -} - -// Attr: [inline] -inline f64 math__q_rsqrt(f64 x) { - f64 x_half = 0.5 * x; - i64 i = ((i64)(math__f64_bits(x))); - i = 0x5fe6eb50c7b537a9 - (i >> 1); - f64 j = math__f64_from_bits(((u64)(i))); - j *= (1.5 - x_half * j * j); - j *= (1.5 - x_half * j * j); - return j; -} - -f64 math__scalbn(f64 x, int n_) { - int n = n_; - f64 x1p1023 = math__f64_from_bits(((u64)(0x7fe0000000000000U))); - f64 x1p53 = math__f64_from_bits(((u64)(0x4340000000000000U))); - f64 x1p_1022 = math__f64_from_bits(((u64)(0x0010000000000000U))); - f64 y = x; - if (n > 1023) { - y *= x1p1023; - n -= 1023; - if (n > 1023) { - y *= x1p1023; - n -= 1023; - if (n > 1023) { - n = 1023; - } - } - } else if (n < -1022) { - y *= x1p_1022 * x1p53; - n += 969; - if (n < -1022) { - y *= x1p_1022 * x1p53; - n += 969; - if (n < -1022) { - n = -1022; - } - } - } - return y * math__f64_from_bits(((u64)((0x3ff + n))) << 52U); -} - -// Attr: [inline] -inline f32 math__cosf(f32 a) { - return cosf(a); -} - -// Attr: [inline] -inline f32 math__sinf(f32 a) { - return sinf(a); -} - -f64 math__sin(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - int sgn_x = (x < 0 ? (-1) : (1)); - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return x * (1.0 - x2 / 6.0); - } else { - int sgn_result = sgn_x; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result = -sgn_result; - } - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 result = 0.0; - if (octant == 0) { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_1676 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_1676.arg0; - result = z * (1.0 + z * z * sin_cs_val); - } else { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_1804 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_1804.arg0; - result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } - result *= sgn_result; - return result; - } - return 0; -} - -f64 math__cos(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return 1.0 - 0.5 * x2; - } else { - int sgn_result = 1; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result = -sgn_result; - } - if (octant > 1) { - sgn_result = -sgn_result; - } - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 result = 0.0; - if (octant == 0) { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_2597 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_2597.arg0; - result = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } else { - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_2741 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_2741.arg0; - result = z * (1.0 + z * z * sin_cs_val); - } - result *= sgn_result; - return result; - } - return 0; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_cosf(f32 a) { - return ((f32)(math__cos(a))); -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_sinf(f32 a) { - return ((f32)(math__sin(a))); -} - -multi_return_f64_f64 math__sincos(f64 x) { - f64 p1 = 7.85398125648498535156e-1; - f64 p2 = 3.77489470793079817668e-8; - f64 p3 = 2.69515142907905952645e-15; - int sgn_x = (x < 0 ? (-1) : (1)); - f64 abs_x = math__abs_T_f64(x); - if (abs_x < _const_math__internal__root4_f64_epsilon) { - f64 x2 = x * x; - return (multi_return_f64_f64){.arg0=x * (1.0 - x2 / 6.0), .arg1=1.0 - 0.5 * x2}; - } else { - int sgn_result_sin = sgn_x; - int sgn_result_cos = 1; - f64 y = math__floor(abs_x / (0.25 * _const_math__pi)); - int octant = ((int)(y - math__ldexp(math__floor(math__ldexp(y, -3)), 3))); - if (((octant & 1)) == 1) { - octant++; - octant &= 7; - y += 1.0; - } - if (octant > 3) { - octant -= 4; - sgn_result_sin = -sgn_result_sin; - sgn_result_cos = -sgn_result_cos; - } - sgn_result_cos = (octant > 1 ? (-sgn_result_cos) : (sgn_result_cos)); - f64 z = ((abs_x - y * p1) - y * p2) - y * p3; - f64 t = 8.0 * math__abs_T_f64(z) / _const_math__pi - 1.0; - multi_return_f64_f64 mr_3838 = math__ChebSeries_eval_e(_const_math__sin_cs, t); - f64 sin_cs_val = mr_3838.arg0; - multi_return_f64_f64 mr_3879 = math__ChebSeries_eval_e(_const_math__cos_cs, t); - f64 cos_cs_val = mr_3879.arg0; - f64 result_sin = 0.0; - f64 result_cos = 0.0; - if (octant == 0) { - result_sin = z * (1.0 + z * z * sin_cs_val); - result_cos = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - } else { - result_sin = 1.0 - 0.5 * z * z * (1.0 - z * z * cos_cs_val); - result_cos = z * (1.0 + z * z * sin_cs_val); - } - result_sin *= sgn_result_sin; - result_cos *= sgn_result_cos; - return (multi_return_f64_f64){.arg0=result_sin, .arg1=result_cos}; - } - return (multi_return_f64_f64){0}; -} - -f64 math__sinh(f64 x_) { - f64 x = x_; - f64 p0 = -0.6307673640497716991184787251e+6; - f64 p1 = -0.8991272022039509355398013511e+5; - f64 p2 = -0.2894211355989563807284660366e+4; - f64 p3 = -0.2630563213397497062819489e+2; - f64 q0 = -0.6307673640497716991212077277e+6; - f64 q1 = 0.1521517378790019070696485176e+5; - f64 q2 = -0.173678953558233699533450911e+3; - bool sign = false; - if (x < 0) { - x = -x; - sign = true; - } - f64 temp = 0.0; - if (x > 21) { - temp = math__exp(x) * 0.5; - } else if (x > 0.5) { - f64 ex = math__exp(x); - temp = (ex - 1.0 / ex) * 0.5; - } else { - f64 sq = x * x; - temp = (((p3 * sq + p2) * sq + p1) * sq + p0) * x; - temp = temp / (((sq + q2) * sq + q1) * sq + q0); - } - if (sign) { - temp = -temp; - } - return temp; -} - -f64 math__cosh(f64 x) { - f64 abs_x = math__abs_T_f64(x); - if (abs_x > 21) { - return math__exp(abs_x) * 0.5; - } - f64 ex = math__exp(abs_x); - return (ex + 1.0 / ex) * 0.5; -} - -// Attr: [inline] -inline f32 math__sqrtf(f32 a) { - return sqrtf(a); -} - -// Attr: [inline] -inline f64 math__sqrt(f64 a) { - f64 x = a; - if (x == 0.0 || math__is_nan(x) || math__is_inf(x, 1)) { - return x; - } - if (x < 0.0) { - return math__nan(); - } - multi_return_f64_int mr_258 = math__frexp(x); - f64 z = mr_258.arg0; - int ex = mr_258.arg1; - f64 w = x; - x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; - if (((ex & 1)) != 0) { - x *= _const_math__sqrt2; - } - x = math__ldexp(x, ex >> 1); - x = 0.5 * (x + w / x); - x = 0.5 * (x + w / x); - x = 0.5 * (x + w / x); - return x; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_sqrtf(f32 a) { - return ((f32)(math__sqrt(a))); -} - -i64 math__sqrti(i64 a) { - i64 x = a; - i64 q = ((i64)(1)); - i64 r = ((i64)(0)); - for (; q <= x; ) { - q <<= 2; - } - for (; q > 1; ) { - q >>= 2; - i64 t = x - r - q; - r >>= 1; - if (t >= 0) { - x = t; - r += q; - } - } - return r; -} - -// Attr: [inline] -inline f32 math__tanf(f32 a) { - return tanf(a); -} - -f64 math__tan(f64 a) { - f64 x = a; - if (x == 0.0 || math__is_nan(x)) { - return x; - } - if (math__is_inf(x, 0)) { - return math__nan(); - } - int sign = 1; - if (x < 0) { - x = -x; - sign = -1; - } - if (x > _const_math__tan_lossth) { - return 0.0; - } - f64 y = math__floor(x * 4.0 / _const_math__pi); - f64 z = math__ldexp(y, -3); - z = math__floor(z); - z = y - math__ldexp(z, 3); - int octant = ((int)(z)); - if (((octant & 1)) == 1) { - octant++; - y += 1.0; - } - z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; - f64 zz = z * z; - if (zz > 1.0e-14) { - y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); - } else { - y = z; - } - if (((octant & 2)) == 2) { - y = -1.0 / y; - } - if (sign < 0) { - y = -y; - } - return y; -} - -// Attr: [inline] -inline f32 math__pure_v_but_overriden_by_c_tanf(f32 a) { - return ((f32)(math__tan(a))); -} - -f64 math__cot(f64 a) { - f64 x = a; - if (x == 0.0) { - return math__inf(1); - } - int sign = 1; - if (x < 0) { - x = -x; - sign = -1; - } - if (x > _const_math__tan_lossth) { - return 0.0; - } - f64 y = math__floor(x * 4.0 / _const_math__pi); - f64 z = math__ldexp(y, -3); - z = math__floor(z); - z = y - math__ldexp(z, 3); - int octant = ((int)(z)); - if (((octant & 1)) == 1) { - octant++; - y += 1.0; - } - z = ((x - y * _const_math__tan_dp1) - y * _const_math__tan_dp2) - y * _const_math__tan_dp3; - f64 zz = z * z; - if (zz > 1.0e-14) { - y = z + z * (zz * ((((*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 0)) * zz) + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_p, 2))) / ((((zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 1))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 2))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 3))) * zz + (*(f64*)/*ee elem_sym */array_get(_const_math__tan_q, 4)))); - } else { - y = z; - } - if (((octant & 2)) == 2) { - y = -y; - } else { - y = 1.0 / y; - } - if (sign < 0) { - y = -y; - } - return y; -} - -f64 math__tanh(f64 x) { - f64 maxlog = 8.8029691931113054295988e+01; - f64 z = math__abs_T_f64(x); - if (z > 0.5 * maxlog) { - if (x < 0) { - return ((f64)(-1)); - } - return 1.0; - } else if (z >= 0.625) { - f64 s = math__exp(2.0 * z); - z = 1.0 - 2.0 / (s + 1.0); - if (x < 0) { - z = -z; - } - } else { - if (x == 0) { - return x; - } - f64 s = x * x; - z = x + x * s * (((*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 0)) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_p, 2))) / (((s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 0))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 1))) * s + (*(f64*)/*ee elem_sym */array_get(_const_math__tanh_q, 2))); - } - return z; -} - -u32 math__f32_bits(f32 f) { - u32 p = *((u32*)(&f)); - return p; -} - -f32 math__f32_from_bits(u32 b) { - f32 p = *((f32*)(&b)); - return p; -} - -u64 math__f64_bits(f64 f) { - u64 p = *((u64*)(&f)); - return p; -} - -f64 math__f64_from_bits(u64 b) { - f64 p = *((f64*)(&b)); - return p; -} - -f64 math__with_set_low_word(f64 f, u32 lo) { - u64 tmp = math__f64_bits(f); - tmp &= 0xffffffff00000000U; - tmp |= ((u64)(lo)); - return math__f64_from_bits(tmp); -} - -f64 math__with_set_high_word(f64 f, u32 hi) { - u64 tmp = math__f64_bits(f); - tmp &= 0x00000000ffffffffU; - tmp |= ((u64)(hi)) << 32U; - return math__f64_from_bits(tmp); -} - -u32 math__get_high_word(f64 f) { - return ((u32)(math__f64_bits(f) >> 32U)); +inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { + u32 _t1 = prev * 1664525U + 1013904223U; + return _t1; +} + +Array_u32 rand__seed__time_seed_array(int count) { + u64 ctime = time__sys_mono_now(); + u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); + Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); + for (int _t1 = 0; _t1 < count; ++_t1) { + seed = rand__seed__nr_next(seed); + array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); + } + Array_u32 _t3 = seed_data; + return _t3; +} + +// Attr: [manualfree] +u32 rand__seed__time_seed_32(void) { + Array_u32 sa = rand__seed__time_seed_array(1); + u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); + array_free(&sa); + u32 _t1 = res; + return _t1; +} + +// Attr: [manualfree] +u64 rand__seed__time_seed_64(void) { + Array_u32 seed_data = rand__seed__time_seed_array(2); + u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); + u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); + array_free(&seed_data); + u64 res = (lower | (upper << 32U)); + u64 _t1 = res; + return _t1; } string term__format(string msg, string open, string close) { @@ -32891,7 +32277,7 @@ _option_string v__vcache__CacheManager_save(v__vcache__CacheManager* cm, string _option_void _t1 = os__write_file(fpath, content); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -32906,7 +32292,7 @@ _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string _option_string _t1 = v__vcache__CacheManager_exists(cm, postfix, key); if (_t1.state != 0) { /*or block*/ _option_string _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -32914,7 +32300,7 @@ _option_string v__vcache__CacheManager_load(v__vcache__CacheManager* cm, string _option_string _t3 = os__read_file(fpath); if (_t3.state != 0) { /*or block*/ _option_string _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -32935,1516 +32321,119 @@ VV_LOCAL_SYMBOL int v__vcache__mypid(void) { return _t1; } -i64 time__portable_timegm(struct tm* t) { - int year = t->tm_year + 1900; - int month = t->tm_mon; - if (month > 11) { - year += month / 12; - month %= 12; - } else if (month < 0) { - int years_diff = (11 - month) / 12; - year -= years_diff; - month += 12 * years_diff; - } - i64 days_since_1970 = ((i64)(time__days_from_civil(year, month + 1, t->tm_mday))); - i64 _t1 = 60 * (60 * (24 * days_since_1970 + t->tm_hour) + t->tm_min) + t->tm_sec; - return _t1; -} - -int time__days_from_civil(int oy, int m, int d) { - int y = (m <= 2 ? (oy - 1) : (oy)); - int era = y / 400; - int yoe = y - era * 400; - int doy = (153 * (m + ((m > 2 ? (-3) : (9)))) + 2) / 5 + d - 1; - int doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - int _t1 = era * 146097 + doe - 719468; - return _t1; -} - -string time__Time_format(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmm24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_milli(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_milli, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_format_ss_micro(time__Time t) { - string _t1 = time__Time_get_fmt_str(t, time__FormatDelimiter__hyphen, time__FormatTime__hhmmss24_micro, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_hhmm(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; -} - -string time__Time_hhmmss(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmmss24); - return _t1; -} - -string time__Time_hhmm12(time__Time t) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; -} - -string time__Time_ymmdd(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__hyphen, time__FormatDate__yyyymmdd); - return _t1; -} - -string time__Time_ddmmy(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__dot, time__FormatDate__ddmmyyyy); - return _t1; -} - -string time__Time_md(time__Time t) { - string _t1 = time__Time_get_fmt_date_str(t, time__FormatDelimiter__space, time__FormatDate__mmmd); - return _t1; -} - -VV_LOCAL_SYMBOL string time__ordinal_suffix(int n) { - if (n > 3 && n < 21) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); +_option_string v__util__diff__find_working_diff_command(void) { + string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); + string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); + if ((env_difftool).len != 0) { + _option_string _t1; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t1), sizeof(string)); return _t1; } - int _t2 = n % 10; - - if (_t2 == (1)) { - string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("st"), 0, { .d_c = 0 }}})); - return _t3; + Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); + if (env_difftool.len > 0) { + array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); } - else if (_t2 == (2)) { - string _t4 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("nd"), 0, { .d_c = 0 }}})); - return _t4; - } - else if (_t2 == (3)) { - string _t5 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("rd"), 0, { .d_c = 0 }}})); - return _t5; - } - else { - string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = n}}, {_SLIT("th"), 0, { .d_c = 0 }}})); - return _t6; - }; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string time__Time_custom_format(time__Time t, string s) { - Array_string tokens = __new_array_with_default(0, 0, sizeof(string), 0); - for (int i = 0; i < s.len; ) { - for (int j = 4; j > 0; j--) { - if (i > s.len - j) { - continue; + _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); + for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { + string diffcmd = ((string*)known_diff_tools.data)[_t4]; + if (string__eq(diffcmd, _SLIT("opendiff"))) { + if (v__util__diff__opendiff_exists()) { + _option_string _t5; + opt_ok2(&(string[]) { diffcmd }, (_option*)(&_t5), sizeof(string)); + return _t5; } - if (j == 1 || (j == 2 && Array_string_contains(_const_time__tokens_2, string_substr(s, i, i + j))) || (j == 3 && Array_string_contains(_const_time__tokens_3, string_substr(s, i, i + j))) || (j == 4 && Array_string_contains(_const_time__tokens_4, string_substr(s, i, i + j)))) { - array_push((array*)&tokens, _MOV((string[]){ string_clone(string_substr(s, i, i + j)) })); - i += (j - 1); - break; + continue; + } + os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); + if (p.exit_code < 0) { + continue; + } + if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { + return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + if (p.exit_code == 0) { + if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { + _option_string _t7; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (_option*)(&_t7), sizeof(string)); + return _t7; } - } - i++; - } - strings__Builder sb = strings__new_builder(128); - for (int _t2 = 0; _t2 < tokens.len; ++_t2) { - string token = ((string*)tokens.data)[_t2]; - - if (string__eq(token, _SLIT("M"))) { - strings__Builder_write_string(&sb, int_str(t.month)); - } - else if (string__eq(token, _SLIT("MM"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Mo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.month)); - } - else if (string__eq(token, _SLIT("MMM"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1)), 0, 3)); - } - else if (string__eq(token, _SLIT("MMMM"))) { - strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_months, t.month - 1))); - } - else if (string__eq(token, _SLIT("D"))) { - strings__Builder_write_string(&sb, int_str(t.day)); - } - else if (string__eq(token, _SLIT("DD"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Do"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.day)); - } - else if (string__eq(token, _SLIT("DDD"))) { - strings__Builder_write_string(&sb, int_str((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]))); - } - else if (string__eq(token, _SLIT("DDDD"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8006fe27, {.d_i32 = t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("DDDo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0])); - } - else if (string__eq(token, _SLIT("d"))) { - strings__Builder_write_string(&sb, int_str(time__Time_day_of_week(&t))); - } - else if (string__eq(token, _SLIT("dd"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 2)); - } - else if (string__eq(token, _SLIT("ddd"))) { - strings__Builder_write_string(&sb, string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1)), 0, 3)); - } - else if (string__eq(token, _SLIT("dddd"))) { - strings__Builder_write_string(&sb, (*(string*)/*ee elem_sym */array_get(_const_time__long_days, time__Time_day_of_week(&t) - 1))); - } - else if (string__eq(token, _SLIT("YY"))) { - strings__Builder_write_string(&sb, string_substr(int_str(t.year), 2, 4)); - } - else if (string__eq(token, _SLIT("YYYY"))) { - strings__Builder_write_string(&sb, int_str(t.year)); - } - else if (string__eq(token, _SLIT("H"))) { - strings__Builder_write_string(&sb, int_str(t.hour)); - } - else if (string__eq(token, _SLIT("HH"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("h"))) { - strings__Builder_write_string(&sb, int_str((t.hour % 12))); - } - else if (string__eq(token, _SLIT("hh"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour % 12)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("m"))) { - strings__Builder_write_string(&sb, int_str(t.minute)); - } - else if (string__eq(token, _SLIT("mm"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("s"))) { - strings__Builder_write_string(&sb, int_str(t.second)); - } - else if (string__eq(token, _SLIT("ss"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("k"))) { - strings__Builder_write_string(&sb, int_str((t.hour + 1))); - } - else if (string__eq(token, _SLIT("kk"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.hour + 1)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("w"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1000f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("ww"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x8005002f, {.d_f64 = math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("wo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix(((int)(math__ceil((t.day + (*(int*)/*ee elem_sym */array_get(_const_time__days_before, t.month - 1)) + (int[]){(time__is_leap_year(t.year))?1:0}[0]) / 7))))); - } - else if (string__eq(token, _SLIT("Q"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("QQ"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.month % 4) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("Qo"))) { - strings__Builder_write_string(&sb, time__ordinal_suffix((t.month % 4) + 1)); - } - else if (string__eq(token, _SLIT("c"))) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = time__Time_day_of_week(&t) + 1}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - else if (string__eq(token, _SLIT("N"))) { - strings__Builder_write_string(&sb, _SLIT("AD")); - } - else if (string__eq(token, _SLIT("NN"))) { - strings__Builder_write_string(&sb, _SLIT("Anno Domini")); - } - else if (string__eq(token, _SLIT("Z"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0xfe07, {.d_i32 = hours}}, {_SLIT0, 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("ZZ"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT("00"), 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("ZZZ"))) { - int hours = time__offset() / _const_time__seconds_per_hour; - if (hours >= 0) { - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("+"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); - } else { - hours = -hours; - strings__Builder_write_string(&sb, str_intp(2, _MOV((StrIntpData[]){{_SLIT("-"), /*100 &int*/0x8004fe27, {.d_i32 = hours}}, {_SLIT(":00"), 0, { .d_c = 0 }}}))); - } - } - else if (string__eq(token, _SLIT("a"))) { - if (t.hour > 12) { - strings__Builder_write_string(&sb, _SLIT("pm")); - } else { - strings__Builder_write_string(&sb, _SLIT("am")); - } - } - else if (string__eq(token, _SLIT("A"))) { - if (t.hour > 12) { - strings__Builder_write_string(&sb, _SLIT("PM")); - } else { - strings__Builder_write_string(&sb, _SLIT("AM")); - } - } - else { - strings__Builder_write_string(&sb, token); - }; - } - string _t3 = strings__Builder_str(&sb); - return _t3; -} - -string time__Time_clean(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm24); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm24, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_clean12(time__Time t) { - time__Time znow = time__now(); - if (t.month == znow.month && t.year == znow.year && t.day == znow.day) { - string _t1 = time__Time_get_fmt_time_str(t, time__FormatTime__hhmm12); - return _t1; - } - if (t.year == znow.year) { - string _t2 = time__Time_get_fmt_str(t, time__FormatDelimiter__space, time__FormatTime__hhmm12, time__FormatDate__mmmd); - return _t2; - } - string _t3 = time__Time_format(t); - return _t3; -} - -string time__Time_get_fmt_time_str(time__Time t, time__FormatTime fmt_time) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } - string tp = (t.hour > 11 ? (_SLIT("p.m.")) : (_SLIT("a.m."))); - int hour_ = (t.hour > 12 ? (t.hour - 12) : t.hour == 0 ? (12) : (t.hour)); - string _t3 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_time) { - case time__FormatTime__hhmm12: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmm24: - { - _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss12: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = hour_}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tp}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24: - { - _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_milli: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x8006fe27, {.d_i32 = (t.microsecond / 1000)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__hhmmss24_micro: - { - _t3 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT("."), /*100 &int*/0x800cfe27, {.d_i32 = t.microsecond}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatTime__no_time: - default: - { - _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatTime*/0xfe10, {.d_s = time__FormatTime_str(fmt_time)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string _t2 = _t3; - return _t2; -} - -string time__Time_get_fmt_date_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - string _t1 = _SLIT(""); - return _t1; - } - string month = time__Time_smonth(&t); - string year = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = (t.year % 100)}}, {_SLIT0, 0, { .d_c = 0 }}})); - string _t2 = (string){.str=(byteptr)"", .is_lit=1}; - switch (fmt_date) { - case time__FormatDate__ddmmyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__ddmmyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmdd: - { - _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__mmmddyyyy: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT("|"), /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yyyymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0x8008fe27, {.d_i32 = t.year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__yymmdd: - { - _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = year}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.month}}, {_SLIT("|"), /*100 &int*/0x8004fe27, {.d_i32 = t.day}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - case time__FormatDate__no_date: - default: - { - _t2 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown enumeration "), /*115 &time.FormatDate*/0xfe10, {.d_s = time__FormatDate_str(fmt_date)}}, {_SLIT0, 0, { .d_c = 0 }}})); - break; - } - } - string res = _t2; - string del = ((fmt_dlmtr == (time__FormatDelimiter__dot))? (_SLIT(".")) : (fmt_dlmtr == (time__FormatDelimiter__hyphen))? (_SLIT("-")) : (fmt_dlmtr == (time__FormatDelimiter__slash))? (_SLIT("/")) : (fmt_dlmtr == (time__FormatDelimiter__space))? (_SLIT(" ")) : (_SLIT(""))); - res = string_replace(res, _SLIT("|"), del); - string _t3 = res; - return _t3; -} - -string time__Time_get_fmt_str(time__Time t, time__FormatDelimiter fmt_dlmtr, time__FormatTime fmt_time, time__FormatDate fmt_date) { - if (fmt_date == time__FormatDate__no_date) { - if (fmt_time == time__FormatTime__no_time) { - string _t1 = _SLIT(""); - return _t1; - } else { - string _t2 = time__Time_get_fmt_time_str(t, fmt_time); - return _t2; - } - } else { - if (fmt_time != time__FormatTime__no_time) { - string dstr = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - string tstr = time__Time_get_fmt_time_str(t, fmt_time); - string _t3 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dstr}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tstr}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } else { - string _t4 = time__Time_get_fmt_date_str(t, fmt_dlmtr, fmt_date); - return _t4; - } - } - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string time__Time_utc_string(time__Time t) { - string day_str = time__Time_weekday_str(&t); - string month_str = time__Time_smonth(&t); - string utc_string = str_intp(8, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = day_str}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = t.day}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = month_str}}, {_SLIT(" "), /*100 &int*/0xfe07, {.d_i32 = t.year}}, {_SLIT(" "), /*100 &int*/0x8004fe27, {.d_i32 = t.hour}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.minute}}, {_SLIT(":"), /*100 &int*/0x8004fe27, {.d_i32 = t.second}}, {_SLIT(" UTC"), 0, { .d_c = 0 }}})); - string _t1 = utc_string; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__eq(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix == t2._v_unix && t1.microsecond == t2.microsecond; - return _t1; -} - -// Attr: [inline] -inline bool time__Time__lt(time__Time t1, time__Time t2) { - bool _t1 = t1._v_unix < t2._v_unix || (t1._v_unix == t2._v_unix && t1.microsecond < t2.microsecond); - return _t1; -} - -// Attr: [inline] -inline time__Duration time__Time__minus(time__Time lhs, time__Time rhs) { - i64 lhs_micro = lhs._v_unix * 1000000 + lhs.microsecond; - i64 rhs_micro = rhs._v_unix * 1000000 + rhs.microsecond; - time__Duration _t1 = (lhs_micro - rhs_micro) * _const_time__microsecond; - return _t1; -} - -_option_time__Time time__parse_rfc3339(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string sn = string_replace_each(s, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("t"), _SLIT("T"), _SLIT("z"), _SLIT("Z")}))); - _option_time__Time _t2 = time__parse_iso8601(sn); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(time__Time*) _t2.data = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - } - - time__Time t = (*(time__Time*)_t2.data); - if (!time__Time__eq(t, ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}))) { - _option_time__Time _t3; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t3), sizeof(time__Time)); - return _t3; - } - _option_int _t4 = string_index(sn, _SLIT("T")); - if (_t4.state != 0) { /*or block*/ - IError err = _t4.err; - *(int*) _t4.data = -1; - } - - int t_i = (*(int*)_t4.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(sn, 0, t_i)), string_clone(string_substr(sn, t_i + 1, (sn).len))}))) : (string_split(sn, _SLIT(" ")))); - if (!string_contains_any((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(" Z")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-"))) { - _option_multi_return_int_int_int _t5 = time__parse_iso8601_date(sn); - if (_t5.state != 0) { /*or block*/ - _option_time__Time _t6; - memcpy(&_t6, &_t5, sizeof(Option)); - return _t6; - } - - multi_return_int_int_int mr_1001 = (*(multi_return_int_int_int*)_t5.data); - int year = mr_1001.arg0; - int month = mr_1001.arg1; - int day = mr_1001.arg2; - t = time__new_time(((time__Time){.year = year,.month = month,.day = day,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,})); - _option_time__Time _t7; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t7), sizeof(time__Time)); - return _t7; - } - if (!string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT("-")) && string_contains((*(string*)/*ee elem_sym */array_get(parts, 0)), _SLIT(":"))) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - _option_multi_return_int_int_int_int_i64_bool _t8 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t8.state != 0) { /*or block*/ - _option_time__Time _t9; - memcpy(&_t9, &_t8, sizeof(Option)); - return _t9; - } - - multi_return_int_int_int_int_i64_bool mr_1383 = (*(multi_return_int_int_int_int_i64_bool*)_t8.data); - hour_ = mr_1383.arg0; - minute_ = mr_1383.arg1; - second_ = mr_1383.arg2; - microsecond_ = mr_1383.arg3; - unix_offset = mr_1383.arg4; - is_local_time = mr_1383.arg5; - t = time__new_time(((time__Time){.year = 0,.month = 0,.day = 0,.hour = hour_,.minute = minute_,.second = second_,.microsecond = microsecond_,._v_unix = 0,.is_local = 0,})); - if (is_local_time) { - _option_time__Time _t10; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t10), sizeof(time__Time)); - return _t10; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - _option_time__Time _t11; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t11), sizeof(time__Time)); - return _t11; - } - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(9), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -_option_time__Time time__parse(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t2 = string_index(s, _SLIT(" ")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t2.data); - string symd = string_substr(s, 0, pos); - Array_string ymd = string_split(symd, _SLIT("-")); - if (ymd.len != 3) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - string shms = string_substr(s, pos, (s).len); - Array_string hms = string_split(shms, _SLIT(":")); - string hour_ = string_substr((*(string*)/*ee elem_sym */array_get(hms, 0)), 1, ((*(string*)/*ee elem_sym */array_get(hms, 0))).len); - string minute_ = (*(string*)/*ee elem_sym */array_get(hms, 1)); - string second_ = (*(string*)/*ee elem_sym */array_get(hms, 2)); - int iyear = string_int((*(string*)/*ee elem_sym */array_get(ymd, 0))); - int imonth = string_int((*(string*)/*ee elem_sym */array_get(ymd, 1))); - int iday = string_int((*(string*)/*ee elem_sym */array_get(ymd, 2))); - int ihour = string_int(hour_); - int iminute = string_int(minute_); - int isecond = string_int(second_); - if (iyear > 9999 || iyear < -9999) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(3), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (imonth > 12 || imonth < 1) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(4), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iday > 31 || iday < 1) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(5), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (ihour > 23 || ihour < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(6), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (iminute > 59 || iminute < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(7), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (isecond > 59 || isecond < 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(8), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - time__Time res = time__new_time(((time__Time){ - .year = iyear, - .month = imonth, - .day = iday, - .hour = ihour, - .minute = iminute, - .second = isecond, - .microsecond = 0, - ._v_unix = 0, - .is_local = 0, - })); - _option_time__Time _t11; - opt_ok2(&(time__Time[]) { res }, (_option*)(&_t11), sizeof(time__Time)); - return _t11; -} - -_option_time__Time time__parse_iso8601(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t2 = string_index(s, _SLIT("T")); - if (_t2.state != 0) { /*or block*/ - IError err = _t2.err; - *(int*) _t2.data = -1; - } - - int t_i = (*(int*)_t2.data); - Array_string parts = (t_i != -1 ? (new_array_from_c_array(2, 2, sizeof(string), _MOV((string[2]){string_clone(string_substr(s, 0, t_i)), string_clone(string_substr(s, t_i + 1, (s).len))}))) : (string_split(s, _SLIT(" ")))); - if (!(parts.len == 1 || parts.len == 2)) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_multi_return_int_int_int _t4 = time__parse_iso8601_date((*(string*)/*ee elem_sym */array_get(parts, 0))); - if (_t4.state != 0) { /*or block*/ - _option_time__Time _t5; - memcpy(&_t5, &_t4, sizeof(Option)); - return _t5; - } - - multi_return_int_int_int mr_3644 = (*(multi_return_int_int_int*)_t4.data); - int year = mr_3644.arg0; - int month = mr_3644.arg1; - int day = mr_3644.arg2; - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - i64 unix_offset = ((i64)(0)); - bool is_local_time = true; - if (parts.len == 2) { - _option_multi_return_int_int_int_int_i64_bool _t6 = time__parse_iso8601_time((*(string*)/*ee elem_sym */array_get(parts, 1))); - if (_t6.state != 0) { /*or block*/ - _option_time__Time _t7; - memcpy(&_t7, &_t6, sizeof(Option)); - return _t7; - } - - multi_return_int_int_int_int_i64_bool mr_3885 = (*(multi_return_int_int_int_int_i64_bool*)_t6.data); - hour_ = mr_3885.arg0; - minute_ = mr_3885.arg1; - second_ = mr_3885.arg2; - microsecond_ = mr_3885.arg3; - unix_offset = mr_3885.arg4; - is_local_time = mr_3885.arg5; - } - time__Time t = time__new_time(((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hour_, - .minute = minute_, - .second = second_, - .microsecond = microsecond_, - ._v_unix = 0, - .is_local = 0, - })); - if (is_local_time) { - _option_time__Time _t8; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t8), sizeof(time__Time)); - return _t8; - } - i64 unix_time = t._v_unix; - if (unix_offset < 0) { - unix_time -= (-unix_offset); - } else if (unix_offset > 0) { - unix_time += unix_offset; - } - t = time__unix2(((i64)(unix_time)), t.microsecond); - _option_time__Time _t9; - opt_ok2(&(time__Time[]) { t }, (_option*)(&_t9), sizeof(time__Time)); - return _t9; -} - -_option_time__Time time__parse_rfc2822(string s) { - if ((s).len == 0) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(0), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - Array_string fields = string_split(s, _SLIT(" ")); - if (fields.len < 5) { - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(1), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_int _t3 = string_index(_const_time__months_string, (*(string*)/*ee elem_sym */array_get(fields, 2))); - if (_t3.state != 0) { /*or block*/ - IError err = _t3.err; - return (_option_time__Time){ .state=2, .err=time__error_invalid_time(2), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - - int pos = (*(int*)_t3.data); - int mm = pos / 3 + 1; - { // Unsafe block - u8* tmstr = malloc_noscan(s.len * 2); - int count = snprintf(((char*)(tmstr)), (s.len * 2), "%s-%02d-%s %s", (*(string*)/*ee elem_sym */array_get(fields, 3)).str, mm, (*(string*)/*ee elem_sym */array_get(fields, 1)).str, (*(string*)/*ee elem_sym */array_get(fields, 4)).str); - _option_time__Time _t5 = time__parse(tos(tmstr, count)); - return _t5; - } - return (_option_time__Time){0}; -} - -VV_LOCAL_SYMBOL _option_multi_return_int_int_int time__parse_iso8601_date(string s) { - int year = 0; - int month = 0; - int day = 0; - u8 dummy = ((u8)(0)); - int count = sscanf(((char*)(s.str)), "%4d-%2d-%2d%c", &year, &month, &day, &dummy); - if (count != 3) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (year > 9999) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(13), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (month > 12) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(14), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (day > 31) { - return (_option_multi_return_int_int_int){ .state=2, .err=time__error_invalid_time(15), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - _option_multi_return_int_int_int _t5; - opt_ok2(&(multi_return_int_int_int/*X*/[]) { (multi_return_int_int_int){.arg0=year, .arg1=month, .arg2=day} }, (_option*)(&_t5), sizeof(multi_return_int_int_int)); - return _t5; -} - -VV_LOCAL_SYMBOL _option_multi_return_int_int_int_int_i64_bool time__parse_iso8601_time(string s) { - int hour_ = 0; - int minute_ = 0; - int second_ = 0; - int microsecond_ = 0; - int nanosecond_ = 0; - rune plus_min_z = 'a'; - int offset_hour = 0; - int offset_minute = 0; - int count = 0; - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%9d%c", &hour_, &minute_, &second_, &nanosecond_, ((char*)(&plus_min_z))); - if (count == 5 && plus_min_z == 'Z') { - int ndigits = 0; - _option_int _t1; - if (_t1 = string_index(s, _SLIT(".")), _t1.state == 0) { - int pos = *(int*)_t1.data; - pos++; - for (; pos < s.len && u8_is_digit(string_at(s, pos)); pos++) { - ndigits++; - } - } - for (;;) { - if (!(ndigits < 9)) break; - nanosecond_ *= 10; - ndigits++; - } - microsecond_ = nanosecond_ / 1000; - } else { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d.%6d%c%2d:%2d", &hour_, &minute_, &second_, µsecond_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - if (count < 4) { - count = sscanf(((char*)(s.str)), "%2d:%2d:%2d%c%2d:%2d", &hour_, &minute_, &second_, ((char*)(&plus_min_z)), &offset_hour, &offset_minute); - count++; - } - if (count < 4) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(10), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - } - bool is_local_time = plus_min_z == 'a' && count == 4; - bool is_utc = plus_min_z == 'Z' && count == 5; - if (!(count == 7 || is_local_time || is_utc)) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(11), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (plus_min_z != '+' && plus_min_z != '-' && !is_utc && !is_local_time) { - return (_option_multi_return_int_int_int_int_i64_bool){ .state=2, .err=time__error_invalid_time(12), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int unix_offset = 0; - if (offset_hour > 0) { - unix_offset += 3600 * offset_hour; - } - if (offset_minute > 0) { - unix_offset += 60 * offset_minute; - } - if (plus_min_z == '+') { - unix_offset *= -1; - } - _option_multi_return_int_int_int_int_i64_bool _t5; - opt_ok2(&(multi_return_int_int_int_int_i64_bool/*X*/[]) { (multi_return_int_int_int_int_i64_bool){.arg0=hour_, .arg1=minute_, .arg2=second_, .arg3=microsecond_, .arg4=unix_offset, .arg5=is_local_time} }, (_option*)(&_t5), sizeof(multi_return_int_int_int_int_i64_bool)); - return _t5; -} - -string time__TimeParseError_msg(time__TimeParseError err) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid time format code: "), /*100 &int*/0xfe07, {.d_i32 = err.code}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t1; -} - -VV_LOCAL_SYMBOL IError time__error_invalid_time(int code) { - IError _t1 = I_time__TimeParseError_to_Interface_IError(((time__TimeParseError*)memdup(&(time__TimeParseError){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),.code = code,}, sizeof(time__TimeParseError)))); - return _t1; -} - -time__StopWatch time__new_stopwatch(time__StopWatchOptions opts) { - u64 initial = ((u64)(0U)); - if (opts.auto_start) { - initial = time__sys_mono_now(); - } - time__StopWatch _t1 = ((time__StopWatch){.elapsed = 0U,.start = initial,.end = 0U,}); - return _t1; -} - -void time__StopWatch_start(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; -} - -void time__StopWatch_restart(time__StopWatch* t) { - t->start = time__sys_mono_now(); - t->end = 0U; - t->elapsed = 0U; -} - -void time__StopWatch_stop(time__StopWatch* t) { - t->end = time__sys_mono_now(); -} - -void time__StopWatch_pause(time__StopWatch* t) { - if (t->start > 0U) { - if (t->end == 0U) { - t->elapsed += time__sys_mono_now() - t->start; - } else { - t->elapsed += t->end - t->start; - } - } - t->start = 0U; -} - -time__Duration time__StopWatch_elapsed(time__StopWatch t) { - if (t.start > 0U) { - if (t.end == 0U) { - time__Duration _t1 = ((((i64)(time__sys_mono_now() - t.start + t.elapsed)))); - return _t1; - } else { - time__Duration _t2 = ((((i64)(t.end - t.start + t.elapsed)))); - return _t2; - } - } - time__Duration _t3 = ((((i64)(t.elapsed)))); - return _t3; -} - -time__Time time__now(void) { - time__Time _t1 = time__win_now(); - return _t1; - time_t t = time(0); - struct tm* now = localtime(&t); - time__Time _t2 = time__convert_ctime(*now, 0); - return _t2; -} - -time__Time time__utc(void) { - time__Time _t1 = time__win_utc(); - return _t1; - time_t t = time(0); - time(&t); - time__Time _t2 = time__unix2(((i64)(t)), 0); - return _t2; -} - -time__Time time__new_time(time__Time t) { - if (t._v_unix != 0) { - time__Time _t1 = t; - return _t1; - } - struct tm tt = ((struct tm){ - .tm_year = t.year - 1900, - .tm_mon = t.month - 1, - .tm_mday = t.day, - .tm_hour = t.hour, - .tm_min = t.minute, - .tm_sec = t.second, - }); - i64 utime = time__make_unix_time(tt); - time__Time _t2 = ((time__Time){t.year,t.month,t.day,t.hour,t.minute,t.second,t.microsecond,._v_unix = utime,t.is_local,}); - return _t2; -} - -i64 time__ticks(void) { - #if defined(_WIN32) - { - i64 _t1 = GetTickCount(); - return _t1; - } - #else - { - } - #endif - return 0; -} - -string time__Time_str(time__Time t) { - string _t1 = time__Time_format_ss(t); - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__convert_ctime(struct tm t, int microsecond) { - time__Time _t1 = ((time__Time){ - .year = t.tm_year + 1900, - .month = t.tm_mon + 1, - .day = t.tm_mday, - .hour = t.tm_hour, - .minute = t.tm_min, - .second = t.tm_sec, - .microsecond = microsecond, - ._v_unix = time__make_unix_time(t), - .is_local = true, - }); - return _t1; -} - -string time__Time_strftime(time__Time t, string fmt) { - struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_year = 0,.tm_mon = 0,.tm_mday = 0,.tm_hour = 0,.tm_min = 0,.tm_sec = 0,}, sizeof(struct tm))); - #if defined(_WIN32) - { - tm = gmtime(((voidptr)(&t._v_unix))); - } - #else - { - } - #endif - Array_fixed_C__char_1024 buf = {0}; - char* fmt_c = ((char*)(fmt.str)); - strftime(&buf[0], ((size_t)(sizeof(Array_fixed_C__char_1024))), fmt_c, tm); - string _t1 = cstring_to_vstring(((char*)(&buf[0]))); - return _t1; -} - -string time__Time_smonth(time__Time* t) { - if (t->month <= 0 || t->month > 12) { - string _t1 = _SLIT("---"); - return _t1; - } - int i = t->month - 1; - string _t2 = string_substr(_const_time__months_string, i * 3, (i + 1) * 3); - return _t2; -} - -// Attr: [inline] -inline i64 time__Time_unix_time(time__Time* t) { - i64 _t1 = t->_v_unix; - return _t1; -} - -// Attr: [inline] -inline i64 time__Time_unix_time_milli(time__Time* t) { - i64 _t1 = t->_v_unix * 1000 + (t->microsecond / 1000); - return _t1; -} - -time__Time time__Time_add(time__Time* t, time__Duration d) { - i64 microseconds = ((i64)(t->_v_unix)) * 1000000 + t->microsecond + time__Duration_microseconds(d); - i64 _v_unix = microseconds / 1000000; - i64 micro = microseconds % 1000000; - time__Time _t1 = time__unix2(_v_unix, ((int)(micro))); - return _t1; -} - -time__Time time__Time_add_seconds(time__Time* t, int seconds) { - time__Time _t1 = time__Time_add(t, seconds * _const_time__second); - return _t1; -} - -time__Time time__Time_add_days(time__Time* t, int days) { - time__Time _t1 = time__Time_add(t, days * 24 * _const_time__hour); - return _t1; -} - -time__Duration time__since(time__Time t) { - time__Duration _t1 = time__Time__minus(time__now(), t); - return _t1; -} - -string time__Time_relative(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - string prefix = _SLIT(""); - string suffix = _SLIT(""); - if (secs < 0) { - secs *= -1; - prefix = _SLIT("in "); - } else { - suffix = _SLIT(" ago"); - } - if (secs < _const_time__seconds_per_minute / 2) { - string _t1 = _SLIT("now"); - return _t1; - } - if (secs < _const_time__seconds_per_hour) { - i64 m = secs / _const_time__seconds_per_minute; - if (m == 1) { - string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 minute"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t2; - } - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT(" minutes"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; - } - if (secs < _const_time__seconds_per_hour * 24) { - i64 h = secs / _const_time__seconds_per_hour; - if (h == 1) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 hour"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t4; - } - string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT(" hours"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t5; - } - if (secs < _const_time__seconds_per_hour * 24 * 7) { - i64 d = secs / _const_time__seconds_per_hour / 24; - if (d == 1) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 day"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT(" days"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t7; - } - if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { - if (string__eq(prefix, _SLIT("in "))) { - string _t8 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("on "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); + _option_string _t8; + opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t8), sizeof(string)); return _t8; } - string _t9 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("last "), /*115 &string*/0xfe10, {.d_s = time__Time_md(/*rec*/*t)}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t9; } - i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; - if (y == 1) { - string _t10 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1 year"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t10; - } - string _t11 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT(" years"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t11; + return (_option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; } -string time__Time_relative_short(time__Time* t) { - time__Time znow = time__now(); - i64 secs = znow._v_unix - t->_v_unix; - string prefix = _SLIT(""); - string suffix = _SLIT(""); - if (secs < 0) { - secs *= -1; - prefix = _SLIT("in "); - } else { - suffix = _SLIT(" ago"); - } - if (secs < _const_time__seconds_per_minute / 2) { - string _t1 = _SLIT("now"); +VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { + os__Result o = os__execute(_SLIT("opendiff")); + if (o.exit_code < 0) { + bool _t1 = false; return _t1; } - if (secs < _const_time__seconds_per_hour) { - i64 m = secs / _const_time__seconds_per_minute; - if (m == 1) { - string _t2 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); + if (o.exit_code == 1) { + if (string_contains(o.output, _SLIT("too few arguments"))) { + bool _t2 = true; return _t2; } - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = m}}, {_SLIT("m"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; } - if (secs < _const_time__seconds_per_hour * 24) { - i64 h = secs / _const_time__seconds_per_hour; - if (h == 1) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t4; + bool _t3 = false; + return _t3; +} + +string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { + if ((diff_cmd).len != 0) { + string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); + os__Result x = os__execute(full_cmd); + if (x.exit_code < 0) { + string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), /*115 &string*/0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); + return _t1; } - string _t5 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = h}}, {_SLIT("h"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t5; - } - if (secs < _const_time__seconds_per_hour * 24 * _const_time__days_in_year) { - i64 d = secs / _const_time__seconds_per_hour / 24; - if (d == 1) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t6; - } - string _t7 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = d}}, {_SLIT("d"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t7; - } - i64 y = secs / _const_time__seconds_per_hour / 24 / _const_time__days_in_year; - if (y == 1) { - string _t8 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("1y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t8; - } - string _t9 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = y}}, {_SLIT("y"), /*115 &string*/0xfe10, {.d_s = suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t9; -} - -int time__day_of_week(int y, int m, int d) { - Array_int t = new_array_from_c_array(12, 12, sizeof(int), _MOV((int[12]){ - 0, 3, 2, 5, 0, 3, 5, 1, 4, - 6, 2, 4})); - int sy = y; - if (m < 3) { - sy = sy - 1; - } - int _t1 = (sy + sy / 4 - sy / 100 + sy / 400 + (*(int*)/*ee elem_sym */array_get(t, m - 1)) + d - 1) % 7 + 1; - return _t1; -} - -int time__Time_day_of_week(time__Time* t) { - int _t1 = time__day_of_week(t->year, t->month, t->day); - return _t1; -} - -string time__Time_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = string_substr((*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)), 0, 3); - return _t1; -} - -string time__Time_long_weekday_str(time__Time* t) { - int i = time__Time_day_of_week(t) - 1; - string _t1 = (*(string*)/*ee elem_sym */array_get(_const_time__long_days, i)); - return _t1; -} - -bool time__is_leap_year(int year) { - bool _t1 = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0); - return _t1; -} - -_option_int time__days_in_month(int month, int year) { - if (month > 12 || month < 1) { - return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Invalid month: "), /*100 &int*/0xfe07, {.d_i32 = month}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - int extra = (month == 2 && time__is_leap_year(year) ? (1) : (0)); - int res = (*(int*)/*ee elem_sym */array_get(_const_time__month_days, month - 1)) + extra; - _option_int _t2; - opt_ok2(&(int[]) { res }, (_option*)(&_t2), sizeof(int)); - return _t2; -} - -string time__Time_debug(time__Time* t) { - string _t1 = str_intp(9, _MOV((StrIntpData[]){{_SLIT("Time{ year: "), /*100 &int*/0x8008fe27, {.d_i32 = t->year}}, {_SLIT(" month: "), /*100 &int*/0x8004fe27, {.d_i32 = t->month}}, {_SLIT(" day: "), /*100 &int*/0x8004fe27, {.d_i32 = t->day}}, {_SLIT(" hour: "), /*100 &int*/0x8004fe27, {.d_i32 = t->hour}}, {_SLIT(" minute: "), /*100 &int*/0x8004fe27, {.d_i32 = t->minute}}, {_SLIT(" second: "), /*100 &int*/0x8004fe27, {.d_i32 = t->second}}, {_SLIT(" microsecond: "), /*100 &int*/0x800cfe27, {.d_i32 = t->microsecond}}, {_SLIT(" unix: "), /*100 &i64*/0x800efe29, {.d_i64 = t->_v_unix}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); - return _t1; -} - -// TypeDecl -i64 time__Duration_nanoseconds(time__Duration d) { - i64 _t1 = ((i64)(d)); - return _t1; -} - -i64 time__Duration_microseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / _const_time__microsecond; - return _t1; -} - -i64 time__Duration_milliseconds(time__Duration d) { - i64 _t1 = ((i64)(d)) / _const_time__millisecond; - return _t1; -} - -f64 time__Duration_seconds(time__Duration d) { - i64 sec = d / _const_time__second; - i64 nsec = d % _const_time__second; - f64 _t1 = ((f64)(sec)) + ((f64)(nsec)) / _const_time__second; - return _t1; -} - -f64 time__Duration_minutes(time__Duration d) { - i64 min = d / _const_time__minute; - i64 nsec = d % _const_time__minute; - f64 _t1 = ((f64)(min)) + ((f64)(nsec)) / _const_time__minute; - return _t1; -} - -f64 time__Duration_hours(time__Duration d) { - i64 hr = d / _const_time__hour; - i64 nsec = d % _const_time__hour; - f64 _t1 = ((f64)(hr)) + ((f64)(nsec)) / _const_time__hour; - return _t1; -} - -string time__Duration_str(time__Duration d) { - if (time__Duration_alias_eq(d, _const_time__infinite)) { - string _t1 = _SLIT("inf"); - return _t1; - } - i64 t = ((i64)(d)); - i64 hr = t / _const_time__hour; - t -= hr * _const_time__hour; - i64 min = t / _const_time__minute; - t -= min * _const_time__minute; - i64 sec = t / _const_time__second; - t -= sec * _const_time__second; - i64 ms = t / _const_time__millisecond; - t -= ms * _const_time__millisecond; - i64 us = t / _const_time__microsecond; - t -= us * _const_time__microsecond; - i64 ns = t; - if (hr > 0) { - string _t2 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = hr}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT0, 0, { .d_c = 0 }}})); + string _t2 = string_trim_right(x.output, _SLIT("\r\n")); return _t2; } - if (min > 0) { - string _t3 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = min}}, {_SLIT(":"), /*100 &i64*/0x8004fe29, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT0, 0, { .d_c = 0 }}})); - return _t3; + string _t3 = _SLIT(""); + return _t3; +} + +string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { + string cdir = os__join_path_single(os__cache_dir(), unique_prefix); + _option_bool _t1 = os__mkdir(cdir); + if (_t1.state != 0) { /*or block*/ + IError err = _t1.err; } - if (sec > 0) { - string _t4 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = sec}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ms}}, {_SLIT("s"), 0, { .d_c = 0 }}})); - return _t4; + + (*(bool*)_t1.data); + u64 ctime = time__sys_mono_now(); + string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); + string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); + _option_void _t2 = os__write_file(e_file, expected); + if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { + IError err = _t2.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; } - if (ms > 0) { - string _t5 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ms}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = us}}, {_SLIT("ms"), 0, { .d_c = 0 }}})); - return _t5; + + ; + _option_void _t3 = os__write_file(f_file, found); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; } - if (us > 0) { - string _t6 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = us}}, {_SLIT("."), /*100 &i64*/0x8006fe29, {.d_i64 = ns}}, {_SLIT("us"), 0, { .d_c = 0 }}})); - return _t6; + + ; + string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); + _option_void _t4 = os__rmdir_all(cdir); + if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { + IError err = _t4.err; } - string _t7 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &i64*/0xfe09, {.d_i64 = ns}}, {_SLIT("ns"), 0, { .d_c = 0 }}})); - return _t7; -} - -int time__offset(void) { - time__Time t = time__utc(); - time__Time local = time__Time_local(&t); - int _t1 = ((int)(local._v_unix - t._v_unix)); - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__make_unix_time(struct tm t) { - i64 _t1 = time__portable_timegm(&t); - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__init_win_time_freq(void) { - u64 f = ((u64)(0U)); - QueryPerformanceFrequency(&f); - u64 _t1 = f; - return _t1; -} - -VV_LOCAL_SYMBOL u64 time__init_win_time_start(void) { - u64 s = ((u64)(0U)); - QueryPerformanceCounter(&s); - u64 _t1 = s; - return _t1; -} - -u64 time__sys_mono_now(void) { - u64 tm = ((u64)(0U)); - QueryPerformanceCounter(&tm); - u64 _t1 = (tm - _const_time__start_time) * 1000000000U / _const_time__freq_time; - return _t1; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u64 time__vpc_now(void) { - u64 tm = ((u64)(0U)); - QueryPerformanceCounter(&tm); - u64 _t1 = tm; - return _t1; -} - -VV_LOCAL_SYMBOL i64 time__local_as_unix_time(void) { - time_t t = time(0); - struct tm* tm = localtime(&t); - i64 _t1 = time__make_unix_time(*tm); - return _t1; -} - -time__Time time__Time_local(time__Time* t) { - if (t->is_local) { - time__Time _t1 = *t; - return _t1; - } - time__SystemTime st_utc = ((time__SystemTime){ - .year = ((u16)(t->year)), - .month = ((u16)(t->month)), - .day_of_week = 0, - .day = ((u16)(t->day)), - .hour = ((u16)(t->hour)), - .minute = ((u16)(t->minute)), - .second = ((u16)(t->second)), - .millisecond = ((u16)(t->microsecond / 1000)), - }); - time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); - time__Time t_local = ((time__Time){ - .year = st_local.year, - .month = st_local.month, - .day = st_local.day, - .hour = st_local.hour, - .minute = st_local.minute, - .second = st_local.second, - .microsecond = st_local.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_local), - .is_local = 0, - }); - time__Time _t2 = t_local; - return _t2; -} - -VV_LOCAL_SYMBOL time__Time time__win_now(void) { - struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); - GetSystemTimeAsFileTime(&ft_utc); - time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - FileTimeToSystemTime(&ft_utc, &st_utc); - time__SystemTime st_local = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - SystemTimeToTzSpecificLocalTime(((voidptr)(0)), &st_utc, &st_local); - time__Time t = ((time__Time){ - .year = st_local.year, - .month = st_local.month, - .day = st_local.day, - .hour = st_local.hour, - .minute = st_local.minute, - .second = st_local.second, - .microsecond = st_local.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_local), - .is_local = true, - }); - time__Time _t1 = t; - return _t1; -} - -VV_LOCAL_SYMBOL time__Time time__win_utc(void) { - struct _FILETIME ft_utc = ((struct _FILETIME){.dwLowDateTime = 0,.dwHighDateTime = 0,}); - GetSystemTimeAsFileTime(&ft_utc); - time__SystemTime st_utc = ((time__SystemTime){.year = 0,.month = 0,.day_of_week = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.millisecond = 0,}); - FileTimeToSystemTime(&ft_utc, &st_utc); - time__Time t = ((time__Time){ - .year = st_utc.year, - .month = st_utc.month, - .day = st_utc.day, - .hour = st_utc.hour, - .minute = st_utc.minute, - .second = st_utc.second, - .microsecond = st_utc.millisecond * 1000U, - ._v_unix = time__SystemTime_unix_time(st_utc), - .is_local = false, - }); - time__Time _t1 = t; - return _t1; -} - -i64 time__SystemTime_unix_time(time__SystemTime st) { - struct tm tt = ((struct tm){ - .tm_year = st.year - 1900U, - .tm_mon = st.month - 1U, - .tm_mday = st.day, - .tm_hour = st.hour, - .tm_min = st.minute, - .tm_sec = st.second, - }); - i64 _t1 = time__make_unix_time(tt); - return _t1; -} - -time__Time time__darwin_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__linux_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_now(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__darwin_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__linux_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -time__Time time__solaris_utc(void) { - time__Time _t1 = ((time__Time){.year = 0,.month = 0,.day = 0,.hour = 0,.minute = 0,.second = 0,.microsecond = 0,._v_unix = 0,.is_local = 0,}); - return _t1; -} - -void time__sleep(time__Duration duration) { - Sleep(((int)(duration / _const_time__millisecond))); -} - -u32 time__Duration_sys_milliseconds(time__Duration d) { - if (d >= ((u32)(-1)) * _const_time__millisecond) { - u32 _t1 = ((u32)(-1)); - return _t1; - } else if (d <= 0) { - u32 _t2 = 0U; - return _t2; - } else { - u32 _t3 = ((u32)(d / _const_time__millisecond)); - return _t3; - } - return 0; -} - -time__Time time__unix(i64 abs) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_472 = time__calculate_date_from_offset(day_offset); - int year = mr_472.arg0; - int month = mr_472.arg1; - int day = mr_472.arg2; - multi_return_int_int_int mr_528 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_528.arg0; - int min = mr_528.arg1; - int sec = mr_528.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = 0, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -time__Time time__unix2(i64 abs, int microsecond) { - i64 day_offset = abs / _const_time__seconds_per_day; - if (abs % _const_time__seconds_per_day < 0) { - day_offset--; - } - multi_return_int_int_int mr_1020 = time__calculate_date_from_offset(day_offset); - int year = mr_1020.arg0; - int month = mr_1020.arg1; - int day = mr_1020.arg2; - multi_return_int_int_int mr_1076 = time__calculate_time_from_offset(abs % _const_time__seconds_per_day); - int hr = mr_1076.arg0; - int min = mr_1076.arg1; - int sec = mr_1076.arg2; - time__Time _t1 = ((time__Time){ - .year = year, - .month = month, - .day = day, - .hour = hr, - .minute = min, - .second = sec, - .microsecond = microsecond, - ._v_unix = abs, - .is_local = 0, - }); - return _t1; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_date_from_offset(i64 day_offset_) { - i64 day_offset = day_offset_; - day_offset += 719468; - int era = 0; - if (day_offset >= 0) { - era = ((int)(day_offset / _const_time__days_per_400_years)); - } else { - era = ((int)((day_offset - _const_time__days_per_400_years - 1) / _const_time__days_per_400_years)); - } - i64 doe = day_offset - era * _const_time__days_per_400_years; - i64 yoe = (doe - doe / (_const_time__days_per_4_years - 1) + doe / _const_time__days_per_100_years - doe / (_const_time__days_per_400_years - 1)) / _const_time__days_in_year; - int y = ((int)(yoe + era * 400)); - i64 doy = doe - (_const_time__days_in_year * yoe + yoe / 4 - yoe / 100); - i64 mp = (5 * doy + 2) / 153; - int d = ((int)(doy - (153 * mp + 2) / 5 + 1)); - int m = ((int)(mp)); - if (mp < 10) { - m += 3; - } else { - m -= 9; - } - if (m <= 2) { - y += 1; - } - return (multi_return_int_int_int){.arg0=y, .arg1=m, .arg2=d}; -} - -VV_LOCAL_SYMBOL multi_return_int_int_int time__calculate_time_from_offset(i64 second_offset_) { - i64 second_offset = second_offset_; - if (second_offset < 0) { - second_offset += _const_time__seconds_per_day; - } - i64 hour_ = second_offset / _const_time__seconds_per_hour; - second_offset %= _const_time__seconds_per_hour; - i64 min = second_offset / _const_time__seconds_per_minute; - second_offset %= _const_time__seconds_per_minute; - return (multi_return_int_int_int){.arg0=((int)(hour_)), .arg1=((int)(min)), .arg2=((int)(second_offset))}; + + ; + string _t5 = res; + return _t5; } _option_v__vmod__Manifest v__vmod__from_file(string vmod_path) { @@ -34661,7 +32650,7 @@ VV_LOCAL_SYMBOL _option_v__vmod__Manifest v__vmod__Parser_parse(v__vmod__Parser* _option_multi_return_Array_string_int _t5 = v__vmod__get_array_content(tokens, i + 1); if (_t5.state != 0) { /*or block*/ _option_v__vmod__Manifest _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -34677,7 +32666,7 @@ VV_LOCAL_SYMBOL _option_v__vmod__Manifest v__vmod__Parser_parse(v__vmod__Parser* _option_multi_return_Array_string_int _t7 = v__vmod__get_array_content(tokens, i + 1); if (_t7.state != 0) { /*or block*/ _option_v__vmod__Manifest _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -34983,6 +32972,90 @@ multi_return_Array_string_Array_string_Array_string Array_v__cflag__CFlag_define return (multi_return_Array_string_Array_string_Array_string){.arg0=defines, .arg1=others, .arg2=libs}; } +void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { + if (seed_data.len != 2) { + eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); + _v_exit(1); + VUNREACHABLE(); + } + rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); + rng->bytes_left = 0; + rng->buffer = 0U; +} + +// Attr: [inline] +inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 1) { + rng->bytes_left -= 1; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t1 = value; + return _t1; + } + rng->buffer = rand__wyrand__WyRandRNG_u64(rng); + rng->bytes_left = 7; + u8 value = ((u8)(rng->buffer)); + rng->buffer >>= 8U; + u8 _t2 = value; + return _t2; +} + +// Attr: [inline] +inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 2) { + rng->bytes_left -= 2; + u16 value = ((u16)(rng->buffer)); + rng->buffer >>= 16U; + u16 _t1 = value; + return _t1; + } + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 16U; + rng->bytes_left = 6; + u16 _t2 = ((u16)(ans)); + return _t2; +} + +// Attr: [inline] +inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { + if (rng->bytes_left >= 4) { + rng->bytes_left -= 4; + u32 value = ((u32)(rng->buffer)); + rng->buffer >>= 32U; + u32 _t1 = value; + return _t1; + } + u64 ans = rand__wyrand__WyRandRNG_u64(rng); + rng->buffer = ans >> 32U; + rng->bytes_left = 4; + u32 _t2 = ((u32)(ans)); + return _t2; +} + +// Attr: [inline] +inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { + { // Unsafe block + u64 seed1 = rng->state; + seed1 += _const_rand__wyrand__wyp0; + rng->state = seed1; + u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); + return _t1; + } + u64 _t2 = 0U; + return _t2; +} + +// Attr: [inline] +inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { + int _t1 = 64; + return _t1; +} + +// Attr: [unsafe] +void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { + _v_free(rng); +} + VV_LOCAL_SYMBOL _option_string v__pkgconfig__desc(string mod) { v__pkgconfig__Options options = ((v__pkgconfig__Options){.path = (string){.str=(byteptr)"", .is_lit=1},.debug = 0,.norecurse = 0,.only_description = true,.use_default_paths = true,}); _option_v__pkgconfig__PkgConfig_ptr _t1 = v__pkgconfig__load(mod, options); @@ -35061,7 +33134,7 @@ _option_string v__pkgconfig__Main_run(v__pkgconfig__Main* m) { _option_string _t4 = v__pkgconfig__PkgConfig_extend(pc, pcdep); if (_t4.state != 0) { /*or block*/ _option_string _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35397,7 +33470,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_requires(v__pkgconfig_ _option_void _t2 = v__pkgconfig__PkgConfig_load_require(pc, dep); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { _option_void _t3; - memcpy(&_t3, &_t2, sizeof(Option)); + memcpy(&_t3, &_t2, sizeof(_option)); return _t3; } @@ -35408,7 +33481,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_requires(v__pkgconfig_ _option_void _t5 = v__pkgconfig__PkgConfig_load_require(pc, dep); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -35435,7 +33508,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_require(v__pkgconfig__ _option_void _t4 = v__pkgconfig__PkgConfig_load_requires(&pcdep); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { _option_void _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35443,7 +33516,7 @@ VV_LOCAL_SYMBOL _option_void v__pkgconfig__PkgConfig_load_require(v__pkgconfig__ _option_string _t6 = v__pkgconfig__PkgConfig_extend(pc, (voidptr)&/*qq*/pcdep); if (_t6.state != 0) { /*or block*/ _option_void _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -35500,7 +33573,7 @@ _option_v__pkgconfig__PkgConfig_ptr v__pkgconfig__load(string pkgname, v__pkgcon _option_void _t4 = v__pkgconfig__PkgConfig_load_requires(pc); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { _option_v__pkgconfig__PkgConfig_ptr _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -35607,243 +33680,124 @@ int runtime__nr_cpus(void) { return _t1; } -_option_string v__util__diff__find_working_diff_command(void) { - string env_difftool = os__getenv(_SLIT("VDIFF_TOOL")); - string env_diffopts = os__getenv(_SLIT("VDIFF_OPTIONS")); - if ((env_difftool).len != 0) { - _option_string _t1; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_difftool}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t1), sizeof(string)); +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 rand__msqrt(f64 a) { + if (a == 0) { + f64 _t1 = a; return _t1; } - Array_string known_diff_tools = __new_array_with_default(0, 0, sizeof(string), 0); - if (env_difftool.len > 0) { - array_push((array*)&known_diff_tools, _MOV((string[]){ string_clone(env_difftool) })); + f64 x = a; + multi_return_f64_int mr_866 = rand__frexp(x); + f64 z = mr_866.arg0; + int ex = mr_866.arg1; + f64 w = x; + x = 4.173075996388649989089e-1 + 5.9016206709064458299663e-1 * z; + if (((ex & 1)) != 0) { + x *= _const_rand__sqrt2; } - _PUSH_MANY(&known_diff_tools, (new_array_from_c_array(8, 8, sizeof(string), _MOV((string[8]){_SLIT("colordiff"), _SLIT("gdiff"), _SLIT("diff"), _SLIT("colordiff.exe"), _SLIT("diff.exe"), _SLIT("opendiff"), _SLIT("code"), _SLIT("code.cmd")}))), _t3, Array_string); - for (int _t4 = 0; _t4 < known_diff_tools.len; ++_t4) { - string diffcmd = ((string*)known_diff_tools.data)[_t4]; - if (string__eq(diffcmd, _SLIT("opendiff"))) { - if (v__util__diff__opendiff_exists()) { - _option_string _t5; - opt_ok2(&(string[]) { diffcmd }, (_option*)(&_t5), sizeof(string)); - return _t5; + x = rand__scalbn(x, ex >> 1); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + x = 0.5 * (x + w / x); + f64 _t2 = x; + return _t2; +} + +VV_LOCAL_SYMBOL f64 rand__mlog(f64 a) { + f64 ln2_lo = 1.90821492927058770002e-10; + f64 ln2_hi = 0.693147180369123816490; + f64 l1 = 0.6666666666666735130; + f64 l2 = 0.3999999999940941908; + f64 l3 = 0.2857142874366239149; + f64 l4 = 0.2222219843214978396; + f64 l5 = 0.1818357216161805012; + f64 l6 = 0.1531383769920937332; + f64 l7 = 0.1479819860511658591; + f64 x = a; + multi_return_f64_int mr_1643 = rand__frexp(x); + f64 f1 = mr_1643.arg0; + int ki = mr_1643.arg1; + if (f1 < _const_rand__sqrt2 / 2) { + f1 *= 2; + ki--; + } + f64 f = f1 - 1; + f64 k = ((f64)(ki)); + f64 s = f / (2 + f); + f64 s2 = s * s; + f64 s4 = s2 * s2; + f64 t1 = s2 * (l1 + s4 * (l3 + s4 * (l5 + s4 * l7))); + f64 t2 = s4 * (l2 + s4 * (l4 + s4 * l6)); + f64 r = t1 + t2; + f64 hfsq = 0.5 * f * f; + f64 _t1 = k * ln2_hi - ((hfsq - (s * (hfsq + r) + k * ln2_lo)) - f); + return _t1; +} + +VV_LOCAL_SYMBOL multi_return_f64_int rand__frexp(f64 x) { + u64 y = rand__f64_bits(x); + int ee = ((int)(((y >> 52U) & 0x7ffU))); + if (ee == 0) { + if (x != 0.0) { + f64 x1p64 = rand__f64_from_bits(((u64)(0x43f0000000000000U))); + multi_return_f64_int mr_2139 = rand__frexp(x * x1p64); + f64 z = mr_2139.arg0; + int e_ = mr_2139.arg1; + return (multi_return_f64_int){.arg0=z, .arg1=e_ - 64}; + } + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } else if (ee == 0x7ff) { + return (multi_return_f64_int){.arg0=x, .arg1=0}; + } + int e_ = ee - 0x3fe; + y &= ((u64)(0x800fffffffffffffU)); + y |= ((u64)(0x3fe0000000000000U)); + return (multi_return_f64_int){.arg0=rand__f64_from_bits(y), .arg1=e_}; +} + +VV_LOCAL_SYMBOL f64 rand__scalbn(f64 x, int n_) { + int n = n_; + f64 x1p1023 = rand__f64_from_bits(((u64)(0x7fe0000000000000U))); + f64 x1p53 = rand__f64_from_bits(((u64)(0x4340000000000000U))); + f64 x1p_1022 = rand__f64_from_bits(((u64)(0x0010000000000000U))); + f64 y = x; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + y *= x1p1023; + n -= 1023; + if (n > 1023) { + n = 1023; } - continue; } - os__Result p = os__execute( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" --version"), 0, { .d_c = 0 }}}))); - if (p.exit_code < 0) { - continue; - } - if (p.exit_code == 127 && string__eq(diffcmd, env_difftool)) { - return (_option_string){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("could not find specified VDIFF_TOOL "), /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT0, 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; - } - if (p.exit_code == 0) { - if (string__eq(diffcmd, _SLIT("code")) || string__eq(diffcmd, _SLIT("code.cmd"))) { - _option_string _t7; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT(" -d"), 0, { .d_c = 0 }}})) }, (_option*)(&_t7), sizeof(string)); - return _t7; + } else if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + y *= x1p_1022 * x1p53; + n += 969; + if (n < -1022) { + n = -1022; } - _option_string _t8; - opt_ok2(&(string[]) { str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diffcmd}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = env_diffopts}}, {_SLIT0, 0, { .d_c = 0 }}})) }, (_option*)(&_t8), sizeof(string)); - return _t8; } } - return (_option_string){ .state=2, .err=_v_error(_SLIT("No working \"diff\" command found")), .data={EMPTY_STRUCT_INITIALIZATION} }; -} - -VV_LOCAL_SYMBOL bool v__util__diff__opendiff_exists(void) { - os__Result o = os__execute(_SLIT("opendiff")); - if (o.exit_code < 0) { - bool _t1 = false; - return _t1; - } - if (o.exit_code == 1) { - if (string_contains(o.output, _SLIT("too few arguments"))) { - bool _t2 = true; - return _t2; - } - } - bool _t3 = false; - return _t3; -} - -string v__util__diff__color_compare_files(string diff_cmd, string file1, string file2) { - if ((diff_cmd).len != 0) { - string full_cmd = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = diff_cmd}}, {_SLIT(" --minimal --text --unified=2 --show-function-line=\"fn \" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file1)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = os__quoted_path(file2)}}, {_SLIT(" "), 0, { .d_c = 0 }}})); - os__Result x = os__execute(full_cmd); - if (x.exit_code < 0) { - string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("comparison command: `"), /*115 &string*/0xfe10, {.d_s = full_cmd}}, {_SLIT("` not found"), 0, { .d_c = 0 }}})); - return _t1; - } - string _t2 = string_trim_right(x.output, _SLIT("\r\n")); - return _t2; - } - string _t3 = _SLIT(""); - return _t3; -} - -string v__util__diff__color_compare_strings(string diff_cmd, string unique_prefix, string expected, string found) { - string cdir = os__join_path_single(os__cache_dir(), unique_prefix); - _option_bool _t1 = os__mkdir(cdir); - if (_t1.state != 0) { /*or block*/ - IError err = _t1.err; - } - - (*(bool*)_t1.data); - u64 ctime = time__sys_mono_now(); - string e_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".expected.txt"), 0, { .d_c = 0 }}}))); - string f_file = os__join_path_single(cdir, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*117 &u64*/0xfe08, {.d_u64 = ctime}}, {_SLIT(".found.txt"), 0, { .d_c = 0 }}}))); - _option_void _t2 = os__write_file(e_file, expected); - if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { - IError err = _t2.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - _option_void _t3 = os__write_file(f_file, found); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - string res = v__util__diff__color_compare_files(diff_cmd, e_file, f_file); - _option_void _t4 = os__rmdir_all(cdir); - if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { - IError err = _t4.err; - } - - ; - string _t5 = res; - return _t5; -} - -// Attr: [inline] -inline VV_LOCAL_SYMBOL u32 rand__seed__nr_next(u32 prev) { - u32 _t1 = prev * 1664525U + 1013904223U; + f64 _t1 = y * rand__f64_from_bits(((u64)((0x3ff + n))) << 52U); return _t1; } -Array_u32 rand__seed__time_seed_array(int count) { - u64 ctime = time__sys_mono_now(); - u32 seed = ((u32)((ctime >> 32U ^ ((ctime & 0x00000000FFFFFFFFU))))); - Array_u32 seed_data = __new_array_with_default(0, count, sizeof(u32), 0); - for (int _t1 = 0; _t1 < count; ++_t1) { - seed = rand__seed__nr_next(seed); - array_push((array*)&seed_data, _MOV((u32[]){ rand__seed__nr_next(seed) })); - } - Array_u32 _t3 = seed_data; - return _t3; -} - -// Attr: [manualfree] -u32 rand__seed__time_seed_32(void) { - Array_u32 sa = rand__seed__time_seed_array(1); - u32 res = (*(u32*)/*ee elem_sym */array_get(sa, 0)); - array_free(&sa); - u32 _t1 = res; +// Attr: [inline] +inline VV_LOCAL_SYMBOL f64 rand__f64_from_bits(u64 b) { + f64 _t1 = *((f64*)(&b)); return _t1; } -// Attr: [manualfree] -u64 rand__seed__time_seed_64(void) { - Array_u32 seed_data = rand__seed__time_seed_array(2); - u64 lower = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 0)))); - u64 upper = ((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))); - array_free(&seed_data); - u64 res = (lower | (upper << 32U)); - u64 _t1 = res; +// Attr: [inline] +inline VV_LOCAL_SYMBOL u64 rand__f64_bits(f64 f) { + u64 _t1 = *((u64*)(&f)); return _t1; } -void rand__wyrand__WyRandRNG_seed(rand__wyrand__WyRandRNG* rng, Array_u32 seed_data) { - if (seed_data.len != 2) { - eprintln(_SLIT("WyRandRNG needs 2 32-bit unsigned integers as the seed.")); - _v_exit(1); - VUNREACHABLE(); - } - rng->state = ((*(u32*)/*ee elem_sym */array_get(seed_data, 0)) | (((u64)((*(u32*)/*ee elem_sym */array_get(seed_data, 1)))) << 32U)); - rng->bytes_left = 0; - rng->buffer = 0U; -} - -// Attr: [inline] -inline u8 rand__wyrand__WyRandRNG_u8(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 1) { - rng->bytes_left -= 1; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t1 = value; - return _t1; - } - rng->buffer = rand__wyrand__WyRandRNG_u64(rng); - rng->bytes_left = 7; - u8 value = ((u8)(rng->buffer)); - rng->buffer >>= 8U; - u8 _t2 = value; - return _t2; -} - -// Attr: [inline] -inline u16 rand__wyrand__WyRandRNG_u16(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 2) { - rng->bytes_left -= 2; - u16 value = ((u16)(rng->buffer)); - rng->buffer >>= 16U; - u16 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 16U; - rng->bytes_left = 6; - u16 _t2 = ((u16)(ans)); - return _t2; -} - -// Attr: [inline] -inline u32 rand__wyrand__WyRandRNG_u32(rand__wyrand__WyRandRNG* rng) { - if (rng->bytes_left >= 4) { - rng->bytes_left -= 4; - u32 value = ((u32)(rng->buffer)); - rng->buffer >>= 32U; - u32 _t1 = value; - return _t1; - } - u64 ans = rand__wyrand__WyRandRNG_u64(rng); - rng->buffer = ans >> 32U; - rng->bytes_left = 4; - u32 _t2 = ((u32)(ans)); - return _t2; -} - -// Attr: [inline] -inline u64 rand__wyrand__WyRandRNG_u64(rand__wyrand__WyRandRNG* rng) { - { // Unsafe block - u64 seed1 = rng->state; - seed1 += _const_rand__wyrand__wyp0; - rng->state = seed1; - u64 _t1 = hash__wymum((seed1 ^ _const_rand__wyrand__wyp1), seed1); - return _t1; - } - u64 _t2 = 0U; - return _t2; -} - -// Attr: [inline] -inline int rand__wyrand__WyRandRNG_block_size(rand__wyrand__WyRandRNG* rng) { - int _t1 = 64; - return _t1; -} - -// Attr: [unsafe] -void rand__wyrand__WyRandRNG_free(rand__wyrand__WyRandRNG* rng) { - _v_free(rng); -} - string rand__uuid_v4(void) { string _t1 = rand__internal_uuid_v4(default_rng); return _t1; @@ -36092,7 +34046,7 @@ inline _option_u32 rand__PRNG_u32_in_range(rand__PRNG* rng, u32 min, u32 max) { _option_u32 _t3 = rand__PRNG_u32n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_u32 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36109,7 +34063,7 @@ inline _option_u64 rand__PRNG_u64_in_range(rand__PRNG* rng, u64 min, u64 max) { _option_u64 _t3 = rand__PRNG_u64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_u64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36162,7 +34116,7 @@ inline _option_int rand__PRNG_intn(rand__PRNG* rng, int max) { _option_u32 _t3 = rand__PRNG_u32n(rng, ((u32)(max))); if (_t3.state != 0) { /*or block*/ _option_int _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36179,7 +34133,7 @@ inline _option_i64 rand__PRNG_i64n(rand__PRNG* rng, i64 max) { _option_u64 _t3 = rand__PRNG_u64n(rng, ((u64)(max))); if (_t3.state != 0) { /*or block*/ _option_i64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36196,7 +34150,7 @@ inline _option_int rand__PRNG_int_in_range(rand__PRNG* rng, int min, int max) { _option_int _t3 = rand__PRNG_intn(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_int _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36213,7 +34167,7 @@ inline _option_i64 rand__PRNG_i64_in_range(rand__PRNG* rng, i64 min, i64 max) { _option_i64 _t3 = rand__PRNG_i64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_i64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36262,7 +34216,7 @@ inline _option_f32 rand__PRNG_f32_in_range(rand__PRNG* rng, f32 min, f32 max) { _option_f32 _t3 = rand__PRNG_f32n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_f32 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36279,7 +34233,7 @@ inline _option_f64 rand__PRNG_f64_in_range(rand__PRNG* rng, f64 min, f64 max) { _option_f64 _t3 = rand__PRNG_f64n(rng, max - min); if (_t3.state != 0) { /*or block*/ _option_f64 _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -36318,9 +34272,97 @@ string rand__PRNG_ascii(rand__PRNG* rng, int len) { return _t1; } +_option_bool rand__PRNG_bernoulli(rand__PRNG* rng, f64 p) { + if (p < 0 || p > 1) { + return (_option_bool){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1fe0f, {.d_f64 = p}}, {_SLIT(" is not a valid probability value."), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + _option_bool _t2; + opt_ok2(&(bool[]) { rand__PRNG_f64(rng) <= p }, (_option*)(&_t2), sizeof(bool)); + return _t2; +} + +_option_f64 rand__PRNG_normal(rand__PRNG* rng, rand__config__NormalConfigStruct conf) { + _option_multi_return_f64_f64 _t1 = rand__PRNG_normal_pair(rng, conf); + if (_t1.state != 0) { /*or block*/ + _option_f64 _t2; + memcpy(&_t2, &_t1, sizeof(_option)); + return _t2; + } + + multi_return_f64_f64 mr_8072 = (*(multi_return_f64_f64*)_t1.data); + f64 x = mr_8072.arg0; + _option_f64 _t3; + opt_ok2(&(f64[]) { x }, (_option*)(&_t3), sizeof(f64)); + return _t3; +} + +_option_multi_return_f64_f64 rand__PRNG_normal_pair(rand__PRNG* rng, rand__config__NormalConfigStruct conf) { + if (conf.sigma <= 0) { + return (_option_multi_return_f64_f64){ .state=2, .err=_v_error(_SLIT("Standard deviation must be positive")), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + for (;;) { + _option_f64 _t2 = rand__PRNG_f64_in_range(rng, -1, 1); + if (_t2.state != 0) { /*or block*/ + IError err = _t2.err; + *(f64*) _t2.data = 0.0; + } + + f64 u = (*(f64*)_t2.data); + _option_f64 _t3 = rand__PRNG_f64_in_range(rng, -1, 1); + if (_t3.state != 0) { /*or block*/ + IError err = _t3.err; + *(f64*) _t3.data = 0.0; + } + + f64 v = (*(f64*)_t3.data); + f64 s = u * u + v * v; + if (s >= 1 || s == 0) { + continue; + } + f64 t = rand__msqrt(-2 * rand__mlog(s) / s); + f64 x = conf.mu + conf.sigma * t * u; + f64 y = conf.mu + conf.sigma * t * v; + _option_multi_return_f64_f64 _t4; + opt_ok2(&(multi_return_f64_f64/*X*/[]) { (multi_return_f64_f64){.arg0=x, .arg1=y} }, (_option*)(&_t4), sizeof(multi_return_f64_f64)); + return _t4; + } + return (_option_multi_return_f64_f64){ .state=2, .err=_v_error(_SLIT("Implementation error. Please file an issue.")), .data={EMPTY_STRUCT_INITIALIZATION} }; +} + +_option_int rand__PRNG_binomial(rand__PRNG* rng, int n, f64 p) { + if (p < 0 || p > 1) { + return (_option_int){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*103 &f64*/0x1fe0f, {.d_f64 = p}}, {_SLIT(" is not a valid probability value."), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; + } + int count = 0; + for (int _t2 = 0; _t2 < n; ++_t2) { + _option_bool _t3 = rand__PRNG_bernoulli(rng, p); + if (_t3.state != 0) { /*or block*/ + _option_int _t4; + memcpy(&_t4, &_t3, sizeof(_result)); + return _t4; + } + + if ( (*(bool*)_t3.data)) { + count++; + } + } + _option_int _t5; + opt_ok2(&(int[]) { count }, (_option*)(&_t5), sizeof(int)); + return _t5; +} + +f64 rand__PRNG_exponential(rand__PRNG* rng, f64 lambda) { + if (lambda <= 0) { + _v_panic(_SLIT("The rate (lambda) must be positive.")); + VUNREACHABLE(); + } + f64 _t1 = -rand__mlog(rand__PRNG_f64(rng)) / lambda; + return _t1; +} + // Attr: [manualfree] rand__PRNG* rand__new_default(rand__config__PRNGConfigStruct config) { - rand__wyrand__WyRandRNG* rng = ((rand__wyrand__WyRandRNG*)memdup(&(rand__wyrand__WyRandRNG){.state = rand__seed__time_seed_64(),.bytes_left = 0,.buffer = 0,}, sizeof(rand__wyrand__WyRandRNG))); + rand__wyrand__WyRandRNG* rng = ((rand__wyrand__WyRandRNG*)memdup(&(rand__wyrand__WyRandRNG){.PRNGBuffer = ((rand__buffer__PRNGBuffer){.bytes_left = 0,.buffer = 0,}),.state = rand__seed__time_seed_64(),.bytes_left = 0,.buffer = 0,}, sizeof(rand__wyrand__WyRandRNG))); rand__wyrand__WyRandRNG_seed(rng, config.seed_); array_free(&config.seed_); rand__PRNG* _t1 = HEAP(rand__PRNG, /*&rand.PRNG*/I_rand__wyrand__WyRandRNG_to_Interface_rand__PRNG(rng)); @@ -36489,8 +34531,33 @@ string rand__ascii(int len) { return _t1; } +_option_bool rand__bernoulli(f64 p) { + _option_bool _t1 = rand__PRNG_bernoulli(default_rng, p); + return _t1; +} + +_option_f64 rand__normal(rand__config__NormalConfigStruct conf) { + _option_f64 _t1 = rand__PRNG_normal(default_rng, conf); + return _t1; +} + +_option_multi_return_f64_f64 rand__normal_pair(rand__config__NormalConfigStruct conf) { + _option_multi_return_f64_f64 _t1 = rand__PRNG_normal_pair(default_rng, conf); + return _t1; +} + +_option_int rand__binomial(int n, f64 p) { + _option_int _t1 = rand__PRNG_binomial(default_rng, n, p); + return _t1; +} + +f64 rand__exponential(f64 lambda) { + f64 _t1 = rand__PRNG_exponential(default_rng, lambda); + return _t1; +} + v__pref__Preferences* v__pref__new_preferences(void) { - v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* p = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.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; @@ -36558,7 +34625,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("9a0f49950"); + string vhash = _SLIT("f9079b670"); 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; @@ -36986,7 +35053,7 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args(Array_string kn } multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors(Array_string known_external_commands, Array_string args, bool show_output) { - v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* res = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.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) { @@ -37288,6 +35355,14 @@ multi_return_ref_v__pref__Preferences_string v__pref__parse_args_and_show_errors res->dump_c_flags = os__cmdline__option(current_args, arg, _SLIT("-")); i++; } + else if (string__eq(arg, _SLIT("-dump-modules"))) { + res->dump_modules = os__cmdline__option(current_args, arg, _SLIT("-")); + i++; + } + else if (string__eq(arg, _SLIT("-dump-files"))) { + res->dump_files = os__cmdline__option(current_args, arg, _SLIT("-")); + i++; + } else if (string__eq(arg, _SLIT("-experimental"))) { res->experimental = true; } @@ -37602,7 +35677,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); + Map_string_string m = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; 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("") }); @@ -37895,7 +35971,8 @@ Array_string v__pref__Preferences_should_compile_filtered_files(v__pref__Prefere array_push((array*)&all_v_files, _MOV((string[]){ string_clone(os__join_path(dir, new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){file})))) })); } Array_string defaults = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_Array_string fnames_no_postfixes = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_Array_string fnames_no_postfixes = new_map(sizeof(string), sizeof(Array_string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t7 = 0; _t7 < all_v_files.len; ++_t7) { string file = ((string*)all_v_files.data)[_t7]; if (string_contains(file, _SLIT("default.c.v"))) { @@ -39685,7 +37762,8 @@ void v__util__Surrounder_free(v__util__Surrounder* s) { } v__util__Timers* v__util__new_timers(v__util__TimerParams params) { - v__util__Timers* _t1 = ((v__util__Timers*)memdup(&(v__util__Timers){.label = params.label,.swatches = new_map(sizeof(string), sizeof(time__StopWatch), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.should_print = params.should_print,.already_shown = __new_array_with_default(0, 100, sizeof(string), 0),}, sizeof(v__util__Timers))); + v__util__Timers* _t1 = ((v__util__Timers*)memdup(&(v__util__Timers){.label = params.label,.swatches = new_map(sizeof(string), sizeof(time__StopWatch), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ,.should_print = params.should_print,.already_shown = __new_array_with_default(0, 100, sizeof(string), 0),}, sizeof(v__util__Timers))); return _t1; } @@ -40555,10 +38633,10 @@ v__ast__Node v__ast__empty_node(void) { _option_v__ast__Ident v__ast__SelectorExpr_root_ident(v__ast__SelectorExpr* e) { v__ast__Expr root = e->expr; for (;;) { - if (!((root)._typ == 327 /* v.ast.SelectorExpr */)) break; + if (!((root)._typ == 329 /* v.ast.SelectorExpr */)) break; root = (*root._v__ast__SelectorExpr).expr; } - if ((root)._typ == 307 /* v.ast.Ident */) { + if ((root)._typ == 309 /* v.ast.Ident */) { _option_v__ast__Ident _t1; opt_ok2(&(v__ast__Ident[]) { (*root._v__ast__Ident) }, (_option*)(&_t1), sizeof(v__ast__Ident)); return _t1; @@ -40591,19 +38669,19 @@ void v__ast__File_free(v__ast__File* f) { // TypeDecl bool v__ast__Ident_is_mut(v__ast__Ident* i) { - if (i->obj._typ == 365 /* v.ast.Var */) { + if (i->obj._typ == 367 /* v.ast.Var */) { bool _t1 = (*i->obj._v__ast__Var).is_mut; return _t1; } - else if (i->obj._typ == 363 /* v.ast.ConstField */) { + else if (i->obj._typ == 365 /* v.ast.ConstField */) { bool _t2 = false; return _t2; } - else if (i->obj._typ == 362 /* v.ast.AsmRegister */) { + else if (i->obj._typ == 364 /* v.ast.AsmRegister */) { bool _t3 = true; return _t3; } - else if (i->obj._typ == 364 /* v.ast.GlobalField */) { + else if (i->obj._typ == 366 /* v.ast.GlobalField */) { bool _t4 = true; return _t4; } @@ -40612,7 +38690,7 @@ bool v__ast__Ident_is_mut(v__ast__Ident* i) { } v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i) { - if (i->info._typ == 417 /* v.ast.IdentVar */) { + if (i->info._typ == 419 /* v.ast.IdentVar */) { v__ast__IdentVar _t1 = (*i->info._v__ast__IdentVar); return _t1; } @@ -40628,7 +38706,7 @@ v__ast__IdentVar v__ast__Ident_var_info(v__ast__Ident* i) { // TypeDecl // Attr: [inline] inline bool v__ast__Expr_is_blank_ident(v__ast__Expr expr) { - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { bool _t1 = (*expr._v__ast__Ident).kind == v__ast__IdentKind__blank_ident; return _t1; } @@ -40637,199 +38715,199 @@ inline bool v__ast__Expr_is_blank_ident(v__ast__Expr expr) { } v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { - if (expr._typ == 285 /* v.ast.AnonFn */) { + if (expr._typ == 287 /* v.ast.AnonFn */) { v__token__Pos _t1 = (*expr._v__ast__AnonFn).decl.pos; return _t1; } - else if (expr._typ == 292 /* v.ast.CTempVar */) { + else if (expr._typ == 294 /* v.ast.CTempVar */) { v__token__Pos _t2 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t2; } - else if (expr._typ == 303 /* v.ast.EmptyExpr */) { + else if (expr._typ == 305 /* v.ast.EmptyExpr */) { v__token__Pos _t3 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t3; } - else if (expr._typ == 318 /* v.ast.NodeError */) { + else if (expr._typ == 320 /* v.ast.NodeError */) { v__token__Pos _t4 = (*expr._v__ast__NodeError).pos; return _t4; } - else if (expr._typ == 286 /* v.ast.ArrayDecompose */) { + else if (expr._typ == 288 /* v.ast.ArrayDecompose */) { v__token__Pos _t5 = (*expr._v__ast__ArrayDecompose).pos; return _t5; } - else if (expr._typ == 287 /* v.ast.ArrayInit */) { + else if (expr._typ == 289 /* v.ast.ArrayInit */) { v__token__Pos _t6 = (*expr._v__ast__ArrayInit).pos; return _t6; } - else if (expr._typ == 288 /* v.ast.AsCast */) { + else if (expr._typ == 290 /* v.ast.AsCast */) { v__token__Pos _t7 = (*expr._v__ast__AsCast).pos; return _t7; } - else if (expr._typ == 289 /* v.ast.Assoc */) { + else if (expr._typ == 291 /* v.ast.Assoc */) { v__token__Pos _t8 = (*expr._v__ast__Assoc).pos; return _t8; } - else if (expr._typ == 290 /* v.ast.AtExpr */) { + else if (expr._typ == 292 /* v.ast.AtExpr */) { v__token__Pos _t9 = (*expr._v__ast__AtExpr).pos; return _t9; } - else if (expr._typ == 291 /* v.ast.BoolLiteral */) { + else if (expr._typ == 293 /* v.ast.BoolLiteral */) { v__token__Pos _t10 = (*expr._v__ast__BoolLiteral).pos; return _t10; } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { v__token__Pos _t11 = (*expr._v__ast__CallExpr).pos; return _t11; } - else if (expr._typ == 294 /* v.ast.CastExpr */) { + else if (expr._typ == 296 /* v.ast.CastExpr */) { v__token__Pos _t12 = (*expr._v__ast__CastExpr).pos; return _t12; } - else if (expr._typ == 295 /* v.ast.ChanInit */) { + else if (expr._typ == 297 /* v.ast.ChanInit */) { v__token__Pos _t13 = (*expr._v__ast__ChanInit).pos; return _t13; } - else if (expr._typ == 296 /* v.ast.CharLiteral */) { + else if (expr._typ == 298 /* v.ast.CharLiteral */) { v__token__Pos _t14 = (*expr._v__ast__CharLiteral).pos; return _t14; } - else if (expr._typ == 301 /* v.ast.ConcatExpr */) { + else if (expr._typ == 303 /* v.ast.ConcatExpr */) { v__token__Pos _t15 = (*expr._v__ast__ConcatExpr).pos; return _t15; } - else if (expr._typ == 297 /* v.ast.Comment */) { + else if (expr._typ == 299 /* v.ast.Comment */) { v__token__Pos _t16 = (*expr._v__ast__Comment).pos; return _t16; } - else if (expr._typ == 298 /* v.ast.ComptimeCall */) { + else if (expr._typ == 300 /* v.ast.ComptimeCall */) { v__token__Pos _t17 = (*expr._v__ast__ComptimeCall).pos; return _t17; } - else if (expr._typ == 299 /* v.ast.ComptimeSelector */) { + else if (expr._typ == 301 /* v.ast.ComptimeSelector */) { v__token__Pos _t18 = (*expr._v__ast__ComptimeSelector).pos; return _t18; } - else if (expr._typ == 304 /* v.ast.EnumVal */) { + else if (expr._typ == 306 /* v.ast.EnumVal */) { v__token__Pos _t19 = (*expr._v__ast__EnumVal).pos; return _t19; } - else if (expr._typ == 302 /* v.ast.DumpExpr */) { + else if (expr._typ == 304 /* v.ast.DumpExpr */) { v__token__Pos _t20 = (*expr._v__ast__DumpExpr).pos; return _t20; } - else if (expr._typ == 305 /* v.ast.FloatLiteral */) { + else if (expr._typ == 307 /* v.ast.FloatLiteral */) { v__token__Pos _t21 = (*expr._v__ast__FloatLiteral).pos; return _t21; } - else if (expr._typ == 306 /* v.ast.GoExpr */) { + else if (expr._typ == 308 /* v.ast.GoExpr */) { v__token__Pos _t22 = (*expr._v__ast__GoExpr).pos; return _t22; } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { v__token__Pos _t23 = (*expr._v__ast__Ident).pos; return _t23; } - else if (expr._typ == 308 /* v.ast.IfExpr */) { + else if (expr._typ == 310 /* v.ast.IfExpr */) { v__token__Pos _t24 = (*expr._v__ast__IfExpr).pos; return _t24; } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { v__token__Pos _t25 = (*expr._v__ast__IntegerLiteral).pos; return _t25; } - else if (expr._typ == 313 /* v.ast.IsRefType */) { + else if (expr._typ == 315 /* v.ast.IsRefType */) { v__token__Pos _t26 = (*expr._v__ast__IsRefType).pos; return _t26; } - else if (expr._typ == 314 /* v.ast.Likely */) { + else if (expr._typ == 316 /* v.ast.Likely */) { v__token__Pos _t27 = (*expr._v__ast__Likely).pos; return _t27; } - else if (expr._typ == 315 /* v.ast.LockExpr */) { + else if (expr._typ == 317 /* v.ast.LockExpr */) { v__token__Pos _t28 = (*expr._v__ast__LockExpr).pos; return _t28; } - else if (expr._typ == 316 /* v.ast.MapInit */) { + else if (expr._typ == 318 /* v.ast.MapInit */) { v__token__Pos _t29 = (*expr._v__ast__MapInit).pos; return _t29; } - else if (expr._typ == 317 /* v.ast.MatchExpr */) { + else if (expr._typ == 319 /* v.ast.MatchExpr */) { v__token__Pos _t30 = (*expr._v__ast__MatchExpr).pos; return _t30; } - else if (expr._typ == 319 /* v.ast.None */) { + else if (expr._typ == 321 /* v.ast.None */) { v__token__Pos _t31 = (*expr._v__ast__None).pos; return _t31; } - else if (expr._typ == 320 /* v.ast.OffsetOf */) { + else if (expr._typ == 322 /* v.ast.OffsetOf */) { v__token__Pos _t32 = (*expr._v__ast__OffsetOf).pos; return _t32; } - else if (expr._typ == 321 /* v.ast.OrExpr */) { + else if (expr._typ == 323 /* v.ast.OrExpr */) { v__token__Pos _t33 = (*expr._v__ast__OrExpr).pos; return _t33; } - else if (expr._typ == 322 /* v.ast.ParExpr */) { + else if (expr._typ == 324 /* v.ast.ParExpr */) { v__token__Pos _t34 = (*expr._v__ast__ParExpr).pos; return _t34; } - else if (expr._typ == 323 /* v.ast.PostfixExpr */) { + else if (expr._typ == 325 /* v.ast.PostfixExpr */) { v__token__Pos _t35 = (*expr._v__ast__PostfixExpr).pos; return _t35; } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { v__token__Pos _t36 = (*expr._v__ast__PrefixExpr).pos; return _t36; } - else if (expr._typ == 325 /* v.ast.RangeExpr */) { + else if (expr._typ == 327 /* v.ast.RangeExpr */) { v__token__Pos _t37 = (*expr._v__ast__RangeExpr).pos; return _t37; } - else if (expr._typ == 326 /* v.ast.SelectExpr */) { + else if (expr._typ == 328 /* v.ast.SelectExpr */) { v__token__Pos _t38 = (*expr._v__ast__SelectExpr).pos; return _t38; } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { v__token__Pos _t39 = (*expr._v__ast__SelectorExpr).pos; return _t39; } - else if (expr._typ == 328 /* v.ast.SizeOf */) { + else if (expr._typ == 330 /* v.ast.SizeOf */) { v__token__Pos _t40 = (*expr._v__ast__SizeOf).pos; return _t40; } - else if (expr._typ == 329 /* v.ast.SqlExpr */) { + else if (expr._typ == 331 /* v.ast.SqlExpr */) { v__token__Pos _t41 = (*expr._v__ast__SqlExpr).pos; return _t41; } - else if (expr._typ == 330 /* v.ast.StringInterLiteral */) { + else if (expr._typ == 332 /* v.ast.StringInterLiteral */) { v__token__Pos _t42 = (*expr._v__ast__StringInterLiteral).pos; return _t42; } - else if (expr._typ == 331 /* v.ast.StringLiteral */) { + else if (expr._typ == 333 /* v.ast.StringLiteral */) { v__token__Pos _t43 = (*expr._v__ast__StringLiteral).pos; return _t43; } - else if (expr._typ == 332 /* v.ast.StructInit */) { + else if (expr._typ == 334 /* v.ast.StructInit */) { v__token__Pos _t44 = (*expr._v__ast__StructInit).pos; return _t44; } - else if (expr._typ == 333 /* v.ast.TypeNode */) { + else if (expr._typ == 335 /* v.ast.TypeNode */) { v__token__Pos _t45 = (*expr._v__ast__TypeNode).pos; return _t45; } - else if (expr._typ == 334 /* v.ast.TypeOf */) { + else if (expr._typ == 336 /* v.ast.TypeOf */) { v__token__Pos _t46 = (*expr._v__ast__TypeOf).pos; return _t46; } - else if (expr._typ == 335 /* v.ast.UnsafeExpr */) { + else if (expr._typ == 337 /* v.ast.UnsafeExpr */) { v__token__Pos _t47 = (*expr._v__ast__UnsafeExpr).pos; return _t47; } - else if (expr._typ == 300 /* v.ast.ComptimeType */) { + else if (expr._typ == 302 /* v.ast.ComptimeType */) { v__token__Pos _t48 = (*expr._v__ast__ComptimeType).pos; return _t48; } - else if (expr._typ == 310 /* v.ast.IndexExpr */) { + else if (expr._typ == 312 /* v.ast.IndexExpr */) { if ((*expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { v__token__Pos _t49 = (*expr._v__ast__IndexExpr).or_expr.pos; return _t49; @@ -40837,11 +38915,11 @@ v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { v__token__Pos _t50 = (*expr._v__ast__IndexExpr).pos; return _t50; } - else if (expr._typ == 309 /* v.ast.IfGuardExpr */) { + else if (expr._typ == 311 /* v.ast.IfGuardExpr */) { v__token__Pos _t51 = v__ast__Expr_pos((*expr._v__ast__IfGuardExpr).expr); return _t51; } - else if (expr._typ == 311 /* v.ast.InfixExpr */) { + else if (expr._typ == 313 /* v.ast.InfixExpr */) { v__token__Pos left_pos = v__ast__Expr_pos((*expr._v__ast__InfixExpr).left); v__token__Pos right_pos = v__ast__Expr_pos((*expr._v__ast__InfixExpr).right); v__token__Pos _t52 = ((v__token__Pos){.len = right_pos.pos - left_pos.pos + right_pos.len,.line_nr = (*expr._v__ast__InfixExpr).pos.line_nr,.pos = left_pos.pos,.col = left_pos.col,.last_line = right_pos.last_line,}); @@ -40852,27 +38930,27 @@ v__token__Pos v__ast__Expr_pos(v__ast__Expr expr) { } bool v__ast__Expr_is_lvalue(v__ast__Expr expr) { - if (expr._typ == 307 /* v.ast.Ident */) { + if (expr._typ == 309 /* v.ast.Ident */) { bool _t1 = true; return _t1; } - else if (expr._typ == 292 /* v.ast.CTempVar */) { + else if (expr._typ == 294 /* v.ast.CTempVar */) { bool _t2 = true; return _t2; } - else if (expr._typ == 310 /* v.ast.IndexExpr */) { + else if (expr._typ == 312 /* v.ast.IndexExpr */) { bool _t3 = v__ast__Expr_is_lvalue((*expr._v__ast__IndexExpr).left); return _t3; } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { bool _t4 = v__ast__Expr_is_lvalue((*expr._v__ast__SelectorExpr).expr); return _t4; } - else if (expr._typ == 322 /* v.ast.ParExpr */) { + else if (expr._typ == 324 /* v.ast.ParExpr */) { bool _t5 = v__ast__Expr_is_lvalue((*expr._v__ast__ParExpr).expr); return _t5; } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { bool _t6 = v__ast__Expr_is_lvalue((*expr._v__ast__PrefixExpr).right); return _t6; } @@ -40885,19 +38963,19 @@ bool v__ast__Expr_is_lvalue(v__ast__Expr expr) { } bool v__ast__Expr_is_expr(v__ast__Expr expr) { - if (expr._typ == 308 /* v.ast.IfExpr */) { + if (expr._typ == 310 /* v.ast.IfExpr */) { bool _t1 = (*expr._v__ast__IfExpr).is_expr; return _t1; } - else if (expr._typ == 315 /* v.ast.LockExpr */) { + else if (expr._typ == 317 /* v.ast.LockExpr */) { bool _t2 = (*expr._v__ast__LockExpr).is_expr; return _t2; } - else if (expr._typ == 317 /* v.ast.MatchExpr */) { + else if (expr._typ == 319 /* v.ast.MatchExpr */) { bool _t3 = (*expr._v__ast__MatchExpr).is_expr; return _t3; } - else if (expr._typ == 326 /* v.ast.SelectExpr */) { + else if (expr._typ == 328 /* v.ast.SelectExpr */) { bool _t4 = (*expr._v__ast__SelectExpr).is_expr; return _t4; } @@ -40910,20 +38988,20 @@ bool v__ast__Expr_is_expr(v__ast__Expr expr) { } bool v__ast__Expr_is_lit(v__ast__Expr expr) { - bool _t1 = ((expr._typ == 291 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 296 /* v.ast.CharLiteral */)? (true) : (expr._typ == 331 /* v.ast.StringLiteral */)? (true) : (expr._typ == 312 /* v.ast.IntegerLiteral */)? (true) : (false)); + bool _t1 = ((expr._typ == 293 /* v.ast.BoolLiteral */)? (true) : (expr._typ == 298 /* v.ast.CharLiteral */)? (true) : (expr._typ == 333 /* v.ast.StringLiteral */)? (true) : (expr._typ == 314 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr) { - if (expr._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (expr._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if ((*(*expr._v__ast__Ident).obj._v__ast__Var).is_auto_deref) { bool _t1 = true; return _t1; } } } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { if ((*expr._v__ast__PrefixExpr).op == v__token__Kind__amp && v__ast__Expr_is_auto_deref_var((*expr._v__ast__PrefixExpr).right)) { bool _t2 = true; return _t2; @@ -40938,11 +39016,11 @@ bool v__ast__Expr_is_auto_deref_var(v__ast__Expr expr) { } bool v__ast__Expr_is_lockable(v__ast__Expr* e) { - if (e->_typ == 307 /* v.ast.Ident */) { + if (e->_typ == 309 /* v.ast.Ident */) { bool _t1 = true; return _t1; } - else if (e->_typ == 327 /* v.ast.SelectorExpr */) { + else if (e->_typ == 329 /* v.ast.SelectorExpr */) { bool _t2 = v__ast__Expr_is_lockable(&(*e->_v__ast__SelectorExpr).expr); return _t2; } @@ -40956,19 +39034,19 @@ bool v__ast__Expr_is_lockable(v__ast__Expr* e) { } _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt) { - if (stmt._typ == 339 /* v.ast.AssignStmt */) { + if (stmt._typ == 341 /* v.ast.AssignStmt */) { return (_option_void){0}; } - else if (stmt._typ == 348 /* v.ast.ForCStmt */) { + else if (stmt._typ == 350 /* v.ast.ForCStmt */) { return (_option_void){0}; } - else if (stmt._typ == 349 /* v.ast.ForInStmt */) { + else if (stmt._typ == 351 /* v.ast.ForInStmt */) { return (_option_void){0}; } - else if (stmt._typ == 350 /* v.ast.ForStmt */) { + else if (stmt._typ == 352 /* v.ast.ForStmt */) { return (_option_void){0}; } - else if (stmt._typ == 347 /* v.ast.ExprStmt */) { + else if (stmt._typ == 349 /* v.ast.ExprStmt */) { if (v__ast__Expr_is_expr((*stmt._v__ast__ExprStmt).expr)) { return (_option_void){0}; } @@ -40982,29 +39060,29 @@ _option_void v__ast__Stmt_check_c_expr(v__ast__Stmt stmt) { } v__token__Pos v__ast__Node_pos(v__ast__Node node) { - if (node._typ == 318 /* v.ast.NodeError */) { + if (node._typ == 320 /* v.ast.NodeError */) { v__token__Pos _t1 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t1; } - else if (node._typ == 368 /* v.ast.EmptyNode */) { + else if (node._typ == 370 /* v.ast.EmptyNode */) { v__token__Pos _t2 = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); return _t2; } - else if (node._typ == 361 /* v.ast.Stmt */) { + else if (node._typ == 363 /* v.ast.Stmt */) { v__token__Pos pos = (*((*node._v__ast__Stmt).pos)); - if (((*node._v__ast__Stmt))._typ == 355 /* v.ast.Import */) { + if (((*node._v__ast__Stmt))._typ == 357 /* v.ast.Import */) { for (int _t3 = 0; _t3 < (*(*node._v__ast__Stmt)._v__ast__Import).syms.len; ++_t3) { v__ast__ImportSymbol sym = ((v__ast__ImportSymbol*)(*(*node._v__ast__Stmt)._v__ast__Import).syms.data)[_t3]; pos = v__token__Pos_extend(pos, sym.pos); } - } else if (((*node._v__ast__Stmt))._typ == 284 /* v.ast.TypeDecl */) { - if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 282 /* v.ast.FnTypeDecl */) { + } else if (((*node._v__ast__Stmt))._typ == 286 /* v.ast.TypeDecl */) { + if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 284 /* v.ast.FnTypeDecl */) { pos = v__token__Pos_extend(pos, (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__FnTypeDecl).type_pos); } - else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 281 /* v.ast.AliasTypeDecl */) { + else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 283 /* v.ast.AliasTypeDecl */) { pos = v__token__Pos_extend(pos, (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__AliasTypeDecl).type_pos); } - else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 283 /* v.ast.SumTypeDecl */) { + else if ((*(*node._v__ast__Stmt)._v__ast__TypeDecl)._typ == 285 /* v.ast.SumTypeDecl */) { for (int _t4 = 0; _t4 < (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants.len; ++_t4) { v__ast__TypeNode variant = ((v__ast__TypeNode*)(*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants.data)[_t4]; pos = v__token__Pos_extend(pos, variant.pos); @@ -41012,75 +39090,75 @@ v__token__Pos v__ast__Node_pos(v__ast__Node node) { } ; } - if (((*node._v__ast__Stmt))._typ == 339 /* v.ast.AssignStmt */) { + if (((*node._v__ast__Stmt))._typ == 341 /* v.ast.AssignStmt */) { v__token__Pos _t5 = v__token__Pos_extend(pos, v__ast__Expr_pos((*(v__ast__Expr*)array_last((*(*node._v__ast__Stmt)._v__ast__AssignStmt).right)))); return _t5; } - if (((*node._v__ast__Stmt))._typ == 338 /* v.ast.AssertStmt */) { + if (((*node._v__ast__Stmt))._typ == 340 /* v.ast.AssertStmt */) { v__token__Pos _t6 = v__token__Pos_extend(pos, v__ast__Expr_pos((*(*node._v__ast__Stmt)._v__ast__AssertStmt).expr)); return _t6; } v__token__Pos _t7 = pos; return _t7; } - else if (node._typ == 336 /* v.ast.Expr */) { + else if (node._typ == 338 /* v.ast.Expr */) { v__token__Pos _t8 = v__ast__Expr_pos((*node._v__ast__Expr)); return _t8; } - else if (node._typ == 374 /* v.ast.StructField */) { + else if (node._typ == 376 /* v.ast.StructField */) { v__token__Pos _t9 = v__token__Pos_extend((*node._v__ast__StructField).pos, (*node._v__ast__StructField).type_pos); return _t9; } - else if (node._typ == 371 /* v.ast.MatchBranch */) { + else if (node._typ == 373 /* v.ast.MatchBranch */) { v__token__Pos _t10 = (*node._v__ast__MatchBranch).pos; return _t10; } - else if (node._typ == 373 /* v.ast.SelectBranch */) { + else if (node._typ == 375 /* v.ast.SelectBranch */) { v__token__Pos _t11 = (*node._v__ast__SelectBranch).pos; return _t11; } - else if (node._typ == 369 /* v.ast.EnumField */) { + else if (node._typ == 371 /* v.ast.EnumField */) { v__token__Pos _t12 = (*node._v__ast__EnumField).pos; return _t12; } - else if (node._typ == 363 /* v.ast.ConstField */) { + else if (node._typ == 365 /* v.ast.ConstField */) { v__token__Pos _t13 = (*node._v__ast__ConstField).pos; return _t13; } - else if (node._typ == 375 /* v.ast.StructInitField */) { + else if (node._typ == 377 /* v.ast.StructInitField */) { v__token__Pos _t14 = (*node._v__ast__StructInitField).pos; return _t14; } - else if (node._typ == 364 /* v.ast.GlobalField */) { + else if (node._typ == 366 /* v.ast.GlobalField */) { v__token__Pos _t15 = (*node._v__ast__GlobalField).pos; return _t15; } - else if (node._typ == 367 /* v.ast.CallArg */) { + else if (node._typ == 369 /* v.ast.CallArg */) { v__token__Pos _t16 = (*node._v__ast__CallArg).pos; return _t16; } - else if (node._typ == 372 /* v.ast.Param */) { + else if (node._typ == 374 /* v.ast.Param */) { v__token__Pos _t17 = v__token__Pos_extend((*node._v__ast__Param).pos, (*node._v__ast__Param).type_pos); return _t17; } - else if (node._typ == 370 /* v.ast.IfBranch */) { + else if (node._typ == 372 /* v.ast.IfBranch */) { v__token__Pos _t18 = v__token__Pos_extend((*node._v__ast__IfBranch).pos, (*node._v__ast__IfBranch).body_pos); return _t18; } - else if (node._typ == 366 /* v.ast.ScopeObject */) { - if ((*node._v__ast__ScopeObject)._typ == 363 /* v.ast.ConstField */) { + else if (node._typ == 368 /* v.ast.ScopeObject */) { + if ((*node._v__ast__ScopeObject)._typ == 365 /* v.ast.ConstField */) { v__token__Pos _t19 = (*(*node._v__ast__ScopeObject)._v__ast__ConstField).pos; return _t19; } - else if ((*node._v__ast__ScopeObject)._typ == 364 /* v.ast.GlobalField */) { + else if ((*node._v__ast__ScopeObject)._typ == 366 /* v.ast.GlobalField */) { v__token__Pos _t20 = (*(*node._v__ast__ScopeObject)._v__ast__GlobalField).pos; return _t20; } - else if ((*node._v__ast__ScopeObject)._typ == 365 /* v.ast.Var */) { + else if ((*node._v__ast__ScopeObject)._typ == 367 /* v.ast.Var */) { v__token__Pos _t21 = (*(*node._v__ast__ScopeObject)._v__ast__Var).pos; return _t21; } - else if ((*node._v__ast__ScopeObject)._typ == 362 /* v.ast.AsmRegister */) { + else if ((*node._v__ast__ScopeObject)._typ == 364 /* v.ast.AsmRegister */) { v__token__Pos _t22 = ((v__token__Pos){.len = -1,.line_nr = -1,.pos = -1,.col = -1,.last_line = -1,}); return _t22; } @@ -41102,8 +39180,8 @@ v__token__Pos v__ast__Node_pos(v__ast__Node node) { Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node children = __new_array_with_default(0, 0, sizeof(v__ast__Node), 0); - if ((node)._typ == 336 /* v.ast.Expr */) { - if ((*node._v__ast__Expr)._typ == 330 /* v.ast.StringInterLiteral */) { + if ((node)._typ == 338 /* v.ast.Expr */) { + if ((*node._v__ast__Expr)._typ == 332 /* v.ast.StringInterLiteral */) { Array_v__ast__Node _t2 = {0}; Array_v__ast__Expr _t2_orig = (*(*node._v__ast__Expr)._v__ast__StringInterLiteral).exprs; int _t2_len = _t2_orig.len; @@ -41117,7 +39195,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t1 =_t2; return _t1; } - else if ((*node._v__ast__Expr)._typ == 289 /* v.ast.Assoc */) { + else if ((*node._v__ast__Expr)._typ == 291 /* v.ast.Assoc */) { Array_v__ast__Node _t5 = {0}; Array_v__ast__Expr _t5_orig = (*(*node._v__ast__Expr)._v__ast__Assoc).exprs; int _t5_len = _t5_orig.len; @@ -41131,7 +39209,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t4 =_t5; return _t4; } - else if ((*node._v__ast__Expr)._typ == 287 /* v.ast.ArrayInit */) { + else if ((*node._v__ast__Expr)._typ == 289 /* v.ast.ArrayInit */) { Array_v__ast__Node _t8 = {0}; Array_v__ast__Expr _t8_orig = (*(*node._v__ast__Expr)._v__ast__ArrayInit).exprs; int _t8_len = _t8_orig.len; @@ -41145,37 +39223,37 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t7 =_t8; return _t7; } - else if ((*node._v__ast__Expr)._typ == 327 /* v.ast.SelectorExpr */) { + else if ((*node._v__ast__Expr)._typ == 329 /* v.ast.SelectorExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__SelectorExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 323 /* v.ast.PostfixExpr */) { + else if ((*node._v__ast__Expr)._typ == 325 /* v.ast.PostfixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__PostfixExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 335 /* v.ast.UnsafeExpr */) { + else if ((*node._v__ast__Expr)._typ == 337 /* v.ast.UnsafeExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__UnsafeExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 288 /* v.ast.AsCast */) { + else if ((*node._v__ast__Expr)._typ == 290 /* v.ast.AsCast */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__AsCast).expr) })); } - else if ((*node._v__ast__Expr)._typ == 322 /* v.ast.ParExpr */) { + else if ((*node._v__ast__Expr)._typ == 324 /* v.ast.ParExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ParExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 309 /* v.ast.IfGuardExpr */) { + else if ((*node._v__ast__Expr)._typ == 311 /* v.ast.IfGuardExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IfGuardExpr).expr) })); } - else if ((*node._v__ast__Expr)._typ == 328 /* v.ast.SizeOf */) { + else if ((*node._v__ast__Expr)._typ == 330 /* v.ast.SizeOf */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__SizeOf).expr) })); } - else if ((*node._v__ast__Expr)._typ == 314 /* v.ast.Likely */) { + else if ((*node._v__ast__Expr)._typ == 316 /* v.ast.Likely */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__Likely).expr) })); } - else if ((*node._v__ast__Expr)._typ == 334 /* v.ast.TypeOf */) { + else if ((*node._v__ast__Expr)._typ == 336 /* v.ast.TypeOf */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__TypeOf).expr) })); } - else if ((*node._v__ast__Expr)._typ == 286 /* v.ast.ArrayDecompose */) { + else if ((*node._v__ast__Expr)._typ == 288 /* v.ast.ArrayDecompose */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ArrayDecompose).expr) })); } - else if ((*node._v__ast__Expr)._typ == 315 /* v.ast.LockExpr */) { + else if ((*node._v__ast__Expr)._typ == 317 /* v.ast.LockExpr */) { Array_v__ast__Node _t21 = {0}; Array_v__ast__Stmt _t21_orig = (*(*node._v__ast__Expr)._v__ast__LockExpr).stmts; int _t21_len = _t21_orig.len; @@ -41189,7 +39267,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t20 =_t21; return _t20; } - else if ((*node._v__ast__Expr)._typ == 321 /* v.ast.OrExpr */) { + else if ((*node._v__ast__Expr)._typ == 323 /* v.ast.OrExpr */) { Array_v__ast__Node _t24 = {0}; Array_v__ast__Stmt _t24_orig = (*(*node._v__ast__Expr)._v__ast__OrExpr).stmts; int _t24_len = _t24_orig.len; @@ -41203,7 +39281,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t23 =_t24; return _t23; } - else if ((*node._v__ast__Expr)._typ == 332 /* v.ast.StructInit */) { + else if ((*node._v__ast__Expr)._typ == 334 /* v.ast.StructInit */) { Array_v__ast__Node _t27 = {0}; Array_v__ast__StructInitField _t27_orig = (*(*node._v__ast__Expr)._v__ast__StructInit).fields; int _t27_len = _t27_orig.len; @@ -41217,10 +39295,10 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t26 =_t27; return _t26; } - else if ((*node._v__ast__Expr)._typ == 285 /* v.ast.AnonFn */) { + else if ((*node._v__ast__Expr)._typ == 287 /* v.ast.AnonFn */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Stmt_to_sumtype_v__ast__Node(ADDR(v__ast__Stmt, (v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*(*node._v__ast__Expr)._v__ast__AnonFn).decl)))) })); } - else if ((*node._v__ast__Expr)._typ == 293 /* v.ast.CallExpr */) { + else if ((*node._v__ast__Expr)._typ == 295 /* v.ast.CallExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CallExpr).left) })); Array_v__ast__Node _t32 = {0}; Array_v__ast__CallArg _t32_orig = (*(*node._v__ast__Expr)._v__ast__CallExpr).args; @@ -41235,18 +39313,18 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { _PUSH_MANY(&children, (_t32), _t31, Array_v__ast__Node); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(ADDR(v__ast__Expr, (v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*(*node._v__ast__Expr)._v__ast__CallExpr).or_block)))) })); } - else if ((*node._v__ast__Expr)._typ == 311 /* v.ast.InfixExpr */) { + else if ((*node._v__ast__Expr)._typ == 313 /* v.ast.InfixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__InfixExpr).left) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__InfixExpr).right) })); } - else if ((*node._v__ast__Expr)._typ == 324 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__Expr)._typ == 326 /* v.ast.PrefixExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__PrefixExpr).right) })); } - else if ((*node._v__ast__Expr)._typ == 310 /* v.ast.IndexExpr */) { + else if ((*node._v__ast__Expr)._typ == 312 /* v.ast.IndexExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IndexExpr).left) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IndexExpr).index) })); } - else if ((*node._v__ast__Expr)._typ == 308 /* v.ast.IfExpr */) { + else if ((*node._v__ast__Expr)._typ == 310 /* v.ast.IfExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__IfExpr).left) })); Array_v__ast__Node _t42 = {0}; Array_v__ast__IfBranch _t42_orig = (*(*node._v__ast__Expr)._v__ast__IfExpr).branches; @@ -41260,7 +39338,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t42), _t41, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 317 /* v.ast.MatchExpr */) { + else if ((*node._v__ast__Expr)._typ == 319 /* v.ast.MatchExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__MatchExpr).cond) })); Array_v__ast__Node _t46 = {0}; Array_v__ast__MatchBranch _t46_orig = (*(*node._v__ast__Expr)._v__ast__MatchExpr).branches; @@ -41274,7 +39352,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t46), _t45, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 326 /* v.ast.SelectExpr */) { + else if ((*node._v__ast__Expr)._typ == 328 /* v.ast.SelectExpr */) { Array_v__ast__Node _t49 = {0}; Array_v__ast__SelectBranch _t49_orig = (*(*node._v__ast__Expr)._v__ast__SelectExpr).branches; int _t49_len = _t49_orig.len; @@ -41288,10 +39366,10 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t48 =_t49; return _t48; } - else if ((*node._v__ast__Expr)._typ == 295 /* v.ast.ChanInit */) { + else if ((*node._v__ast__Expr)._typ == 297 /* v.ast.ChanInit */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ChanInit).cap_expr) })); } - else if ((*node._v__ast__Expr)._typ == 316 /* v.ast.MapInit */) { + else if ((*node._v__ast__Expr)._typ == 318 /* v.ast.MapInit */) { Array_v__ast__Node _t53 = {0}; Array_v__ast__Expr _t53_orig = (*(*node._v__ast__Expr)._v__ast__MapInit).keys; int _t53_len = _t53_orig.len; @@ -41315,15 +39393,15 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t56), _t55, Array_v__ast__Node); } - else if ((*node._v__ast__Expr)._typ == 325 /* v.ast.RangeExpr */) { + else if ((*node._v__ast__Expr)._typ == 327 /* v.ast.RangeExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__RangeExpr).low) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__RangeExpr).high) })); } - else if ((*node._v__ast__Expr)._typ == 294 /* v.ast.CastExpr */) { + else if ((*node._v__ast__Expr)._typ == 296 /* v.ast.CastExpr */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CastExpr).expr) })); array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__CastExpr).arg) })); } - else if ((*node._v__ast__Expr)._typ == 301 /* v.ast.ConcatExpr */) { + else if ((*node._v__ast__Expr)._typ == 303 /* v.ast.ConcatExpr */) { Array_v__ast__Node _t63 = {0}; Array_v__ast__Expr _t63_orig = (*(*node._v__ast__Expr)._v__ast__ConcatExpr).vals; int _t63_len = _t63_orig.len; @@ -41337,18 +39415,18 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t62 =_t63; return _t62; } - else if ((*node._v__ast__Expr)._typ == 298 /* v.ast.ComptimeCall */) { + else if ((*node._v__ast__Expr)._typ == 300 /* v.ast.ComptimeCall */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ComptimeCall).left) })); } - else if ((*node._v__ast__Expr)._typ == 299 /* v.ast.ComptimeSelector */) { + else if ((*node._v__ast__Expr)._typ == 301 /* v.ast.ComptimeSelector */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Expr)._v__ast__ComptimeSelector).left) })); } else { } ; - } else if ((node)._typ == 361 /* v.ast.Stmt */) { - if ((*node._v__ast__Stmt)._typ == 340 /* v.ast.Block */) { + } else if ((node)._typ == 363 /* v.ast.Stmt */) { + if ((*node._v__ast__Stmt)._typ == 342 /* v.ast.Block */) { Array_v__ast__Node _t68 = {0}; Array_v__ast__Stmt _t68_orig = (*(*node._v__ast__Stmt)._v__ast__Block).stmts; int _t68_len = _t68_orig.len; @@ -41362,7 +39440,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t67 =_t68; return _t67; } - else if ((*node._v__ast__Stmt)._typ == 344 /* v.ast.DeferStmt */) { + else if ((*node._v__ast__Stmt)._typ == 346 /* v.ast.DeferStmt */) { Array_v__ast__Node _t71 = {0}; Array_v__ast__Stmt _t71_orig = (*(*node._v__ast__Stmt)._v__ast__DeferStmt).stmts; int _t71_len = _t71_orig.len; @@ -41376,7 +39454,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t70 =_t71; return _t70; } - else if ((*node._v__ast__Stmt)._typ == 348 /* v.ast.ForCStmt */) { + else if ((*node._v__ast__Stmt)._typ == 350 /* v.ast.ForCStmt */) { Array_v__ast__Node _t74 = {0}; Array_v__ast__Stmt _t74_orig = (*(*node._v__ast__Stmt)._v__ast__ForCStmt).stmts; int _t74_len = _t74_orig.len; @@ -41390,7 +39468,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t73 =_t74; return _t73; } - else if ((*node._v__ast__Stmt)._typ == 349 /* v.ast.ForInStmt */) { + else if ((*node._v__ast__Stmt)._typ == 351 /* v.ast.ForInStmt */) { Array_v__ast__Node _t77 = {0}; Array_v__ast__Stmt _t77_orig = (*(*node._v__ast__Stmt)._v__ast__ForInStmt).stmts; int _t77_len = _t77_orig.len; @@ -41404,7 +39482,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t76 =_t77; return _t76; } - else if ((*node._v__ast__Stmt)._typ == 350 /* v.ast.ForStmt */) { + else if ((*node._v__ast__Stmt)._typ == 352 /* v.ast.ForStmt */) { Array_v__ast__Node _t80 = {0}; Array_v__ast__Stmt _t80_orig = (*(*node._v__ast__Stmt)._v__ast__ForStmt).stmts; int _t80_len = _t80_orig.len; @@ -41418,7 +39496,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t79 =_t80; return _t79; } - else if ((*node._v__ast__Stmt)._typ == 342 /* v.ast.ComptimeFor */) { + else if ((*node._v__ast__Stmt)._typ == 344 /* v.ast.ComptimeFor */) { Array_v__ast__Node _t83 = {0}; Array_v__ast__Stmt _t83_orig = (*(*node._v__ast__Stmt)._v__ast__ComptimeFor).stmts; int _t83_len = _t83_orig.len; @@ -41432,13 +39510,13 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t82 =_t83; return _t82; } - else if ((*node._v__ast__Stmt)._typ == 347 /* v.ast.ExprStmt */) { + else if ((*node._v__ast__Stmt)._typ == 349 /* v.ast.ExprStmt */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Stmt)._v__ast__ExprStmt).expr) })); } - else if ((*node._v__ast__Stmt)._typ == 338 /* v.ast.AssertStmt */) { + else if ((*node._v__ast__Stmt)._typ == 340 /* v.ast.AssertStmt */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__Stmt)._v__ast__AssertStmt).expr) })); } - else if ((*node._v__ast__Stmt)._typ == 356 /* v.ast.InterfaceDecl */) { + else if ((*node._v__ast__Stmt)._typ == 358 /* v.ast.InterfaceDecl */) { Array_v__ast__Node _t88 = {0}; Array_v__ast__FnDecl _t88_orig = (*(*node._v__ast__Stmt)._v__ast__InterfaceDecl).methods; int _t88_len = _t88_orig.len; @@ -41462,7 +39540,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t91), _t90, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 339 /* v.ast.AssignStmt */) { + else if ((*node._v__ast__Stmt)._typ == 341 /* v.ast.AssignStmt */) { Array_v__ast__Node _t94 = {0}; Array_v__ast__Expr _t94_orig = (*(*node._v__ast__Stmt)._v__ast__AssignStmt).left; int _t94_len = _t94_orig.len; @@ -41486,7 +39564,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t97), _t96, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 358 /* v.ast.Return */) { + else if ((*node._v__ast__Stmt)._typ == 360 /* v.ast.Return */) { Array_v__ast__Node _t100 = {0}; Array_v__ast__Expr _t100_orig = (*(*node._v__ast__Stmt)._v__ast__Return).exprs; int _t100_len = _t100_orig.len; @@ -41500,7 +39578,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t99 =_t100; return _t99; } - else if ((*node._v__ast__Stmt)._typ == 360 /* v.ast.StructDecl */) { + else if ((*node._v__ast__Stmt)._typ == 362 /* v.ast.StructDecl */) { Array_v__ast__Node _t103 = {0}; Array_v__ast__StructField _t103_orig = (*(*node._v__ast__Stmt)._v__ast__StructDecl).fields; int _t103_len = _t103_orig.len; @@ -41514,7 +39592,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t102 =_t103; return _t102; } - else if ((*node._v__ast__Stmt)._typ == 351 /* v.ast.GlobalDecl */) { + else if ((*node._v__ast__Stmt)._typ == 353 /* v.ast.GlobalDecl */) { Array_v__ast__Node _t106 = {0}; Array_v__ast__GlobalField _t106_orig = (*(*node._v__ast__Stmt)._v__ast__GlobalDecl).fields; int _t106_len = _t106_orig.len; @@ -41528,7 +39606,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t105 =_t106; return _t105; } - else if ((*node._v__ast__Stmt)._typ == 343 /* v.ast.ConstDecl */) { + else if ((*node._v__ast__Stmt)._typ == 345 /* v.ast.ConstDecl */) { Array_v__ast__Node _t109 = {0}; Array_v__ast__ConstField _t109_orig = (*(*node._v__ast__Stmt)._v__ast__ConstDecl).fields; int _t109_len = _t109_orig.len; @@ -41542,7 +39620,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t108 =_t109; return _t108; } - else if ((*node._v__ast__Stmt)._typ == 346 /* v.ast.EnumDecl */) { + else if ((*node._v__ast__Stmt)._typ == 348 /* v.ast.EnumDecl */) { Array_v__ast__Node _t112 = {0}; Array_v__ast__EnumField _t112_orig = (*(*node._v__ast__Stmt)._v__ast__EnumDecl).fields; int _t112_len = _t112_orig.len; @@ -41583,8 +39661,8 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t119), _t118, Array_v__ast__Node); } - else if ((*node._v__ast__Stmt)._typ == 284 /* v.ast.TypeDecl */) { - if (((*(*node._v__ast__Stmt)._v__ast__TypeDecl))._typ == 283 /* v.ast.SumTypeDecl */) { + else if ((*node._v__ast__Stmt)._typ == 286 /* v.ast.TypeDecl */) { + if (((*(*node._v__ast__Stmt)._v__ast__TypeDecl))._typ == 285 /* v.ast.SumTypeDecl */) { Array_v__ast__Node _t122 = {0}; Array_v__ast__TypeNode _t122_orig = (*(*(*node._v__ast__Stmt)._v__ast__TypeDecl)._v__ast__SumTypeDecl).variants; int _t122_len = _t122_orig.len; @@ -41602,36 +39680,36 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { else { } ; - } else if ((node)._typ == 366 /* v.ast.ScopeObject */) { - if ((*node._v__ast__ScopeObject)._typ == 364 /* v.ast.GlobalField */) { + } else if ((node)._typ == 368 /* v.ast.ScopeObject */) { + if ((*node._v__ast__ScopeObject)._typ == 366 /* v.ast.GlobalField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__GlobalField).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 363 /* v.ast.ConstField */) { + else if ((*node._v__ast__ScopeObject)._typ == 365 /* v.ast.ConstField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__ConstField).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 365 /* v.ast.Var */) { + else if ((*node._v__ast__ScopeObject)._typ == 367 /* v.ast.Var */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*(*node._v__ast__ScopeObject)._v__ast__Var).expr) })); } - else if ((*node._v__ast__ScopeObject)._typ == 362 /* v.ast.AsmRegister */) { + else if ((*node._v__ast__ScopeObject)._typ == 364 /* v.ast.AsmRegister */) { } ; } else { - if (node._typ == 364 /* v.ast.GlobalField */) { + if (node._typ == 366 /* v.ast.GlobalField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__GlobalField).expr) })); } - else if (node._typ == 363 /* v.ast.ConstField */) { + else if (node._typ == 365 /* v.ast.ConstField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__ConstField).expr) })); } - else if (node._typ == 369 /* v.ast.EnumField */) { + else if (node._typ == 371 /* v.ast.EnumField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__EnumField).expr) })); } - else if (node._typ == 375 /* v.ast.StructInitField */) { + else if (node._typ == 377 /* v.ast.StructInitField */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__StructInitField).expr) })); } - else if (node._typ == 367 /* v.ast.CallArg */) { + else if (node._typ == 369 /* v.ast.CallArg */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Expr_to_sumtype_v__ast__Node(&(*node._v__ast__CallArg).expr) })); } - else if (node._typ == 373 /* v.ast.SelectBranch */) { + else if (node._typ == 375 /* v.ast.SelectBranch */) { array_push((array*)&children, _MOV((v__ast__Node[]){ v__ast__Stmt_to_sumtype_v__ast__Node(&(*node._v__ast__SelectBranch).stmt) })); Array_v__ast__Node _t134 = {0}; Array_v__ast__Stmt _t134_orig = (*node._v__ast__SelectBranch).stmts; @@ -41645,7 +39723,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { } _PUSH_MANY(&children, (_t134), _t133, Array_v__ast__Node); } - else if (node._typ == 370 /* v.ast.IfBranch */) { + else if (node._typ == 372 /* v.ast.IfBranch */) { Array_v__ast__Node _t137 = {0}; Array_v__ast__Stmt _t137_orig = (*node._v__ast__IfBranch).stmts; int _t137_len = _t137_orig.len; @@ -41673,7 +39751,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { Array_v__ast__Node _t139 =_t140; return _t139; } - else if (node._typ == 371 /* v.ast.MatchBranch */) { + else if (node._typ == 373 /* v.ast.MatchBranch */) { Array_v__ast__Node _t143 = {0}; Array_v__ast__Stmt _t143_orig = (*node._v__ast__MatchBranch).stmts; int _t143_len = _t143_orig.len; @@ -41708,7 +39786,7 @@ Array_v__ast__Node v__ast__Node_children(v__ast__Node node) { void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool val) { lx->is_setter = val; - if ((lx->left)._typ == 310 /* v.ast.IndexExpr */) { + if ((lx->left)._typ == 312 /* v.ast.IndexExpr */) { if ((*lx->left._v__ast__IndexExpr).is_map) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*lx->left._v__ast__IndexExpr), val); } @@ -41717,17 +39795,18 @@ void v__ast__IndexExpr_recursive_mapset_is_setter(v__ast__IndexExpr* lx, bool va void v__ast__IndexExpr_recursive_arraymap_set_is_setter(v__ast__IndexExpr* lx) { lx->is_setter = true; - if ((lx->left)._typ == 310 /* v.ast.IndexExpr */) { + if ((lx->left)._typ == 312 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*lx->left._v__ast__IndexExpr)); - } else if ((lx->left)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 310 /* v.ast.IndexExpr */) { + } else if ((lx->left)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*lx->left._v__ast__SelectorExpr).expr)._typ == 312 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_arraymap_set_is_setter(&(*(*lx->left._v__ast__SelectorExpr).expr._v__ast__IndexExpr)); } } } Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__Arch arch) { - Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; switch (arch) { case v__pref__Arch__amd64: case v__pref__Arch__i386: @@ -41882,7 +39961,8 @@ Map_string_v__ast__ScopeObject v__ast__all_registers(v__ast__Table* t, v__pref__ } VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast__Table* t, Array_string without_numbers, Map_string_int with_numbers, int bit_size) { - Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__ScopeObject res = new_map(sizeof(string), sizeof(v__ast__ScopeObject), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < without_numbers.len; ++_t1) { string name = ((string*)without_numbers.data)[_t1]; map_set(&res, &(string[]){name}, &(v__ast__ScopeObject[]) { v__ast__AsmRegister_to_sumtype_v__ast__ScopeObject(ADDR(v__ast__AsmRegister, (((v__ast__AsmRegister){.name = name,.typ = v__ast__Table_bitsize_to_type(t, bit_size),.size = bit_size,})))) }); @@ -41918,43 +39998,43 @@ VV_LOCAL_SYMBOL Map_string_v__ast__ScopeObject v__ast__gen_all_registers(v__ast_ } bool v__ast__Expr_is_literal(v__ast__Expr expr) { - if (expr._typ == 291 /* v.ast.BoolLiteral */) { + if (expr._typ == 293 /* v.ast.BoolLiteral */) { bool _t1 = true; return _t1; } - else if (expr._typ == 296 /* v.ast.CharLiteral */) { + else if (expr._typ == 298 /* v.ast.CharLiteral */) { bool _t2 = true; return _t2; } - else if (expr._typ == 305 /* v.ast.FloatLiteral */) { + else if (expr._typ == 307 /* v.ast.FloatLiteral */) { bool _t3 = true; return _t3; } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { bool _t4 = true; return _t4; } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { bool _t5 = v__ast__Expr_is_literal((*expr._v__ast__PrefixExpr).right); return _t5; } - else if (expr._typ == 311 /* v.ast.InfixExpr */) { + else if (expr._typ == 313 /* v.ast.InfixExpr */) { bool _t6 = v__ast__Expr_is_literal((*expr._v__ast__InfixExpr).left) && v__ast__Expr_is_literal((*expr._v__ast__InfixExpr).right); return _t6; } - else if (expr._typ == 322 /* v.ast.ParExpr */) { + else if (expr._typ == 324 /* v.ast.ParExpr */) { bool _t7 = v__ast__Expr_is_literal((*expr._v__ast__ParExpr).expr); return _t7; } - else if (expr._typ == 294 /* v.ast.CastExpr */) { + else if (expr._typ == 296 /* v.ast.CastExpr */) { bool _t8 = !(*expr._v__ast__CastExpr).has_arg && v__ast__Expr_is_literal((*expr._v__ast__CastExpr).expr) && (v__ast__Type_is_ptr((*expr._v__ast__CastExpr).typ) || v__ast__Type_is_pointer((*expr._v__ast__CastExpr).typ) || (v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i8_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i16_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__int_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__i64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__byte_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u16_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u32_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__u64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f32_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__f64_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__char_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__bool_type) || v__ast__Type_alias_eq((*expr._v__ast__CastExpr).typ, _const_v__ast__rune_type))); return _t8; } - else if (expr._typ == 328 /* v.ast.SizeOf */) { + else if (expr._typ == 330 /* v.ast.SizeOf */) { bool _t9 = (*expr._v__ast__SizeOf).is_type || v__ast__Expr_is_literal((*expr._v__ast__SizeOf).expr); return _t9; } - else if (expr._typ == 313 /* v.ast.IsRefType */) { + else if (expr._typ == 315 /* v.ast.IsRefType */) { bool _t10 = (*expr._v__ast__IsRefType).is_type || v__ast__Expr_is_literal((*expr._v__ast__IsRefType).expr); return _t10; } @@ -41984,7 +40064,8 @@ bool v__ast__type_can_start_with_token(v__token__Token* tok) { } VV_LOCAL_SYMBOL v__token__KeywordsMatcher v__ast__build_builtin_type_names_matcher(void) { - Map_string_int m = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int m = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < _const_v__ast__builtin_type_names.len; ++i) { string name = ((string*)_const_v__ast__builtin_type_names.data)[i]; map_set(&m, &(string[]){name}, &(int[]) { i }); @@ -42146,7 +40227,7 @@ _option_i8 v__ast__ComptTimeConstValue_i8(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_i8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42163,7 +40244,7 @@ _option_i16 v__ast__ComptTimeConstValue_i16(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_i16 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42180,7 +40261,7 @@ _option_int v__ast__ComptTimeConstValue_int(v__ast__ComptTimeConstValue val) { _option_i64 _t1 = v__ast__ComptTimeConstValue_i64(val); if (_t1.state != 0) { /*or block*/ _option_int _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42260,7 +40341,7 @@ _option_i64 v__ast__ComptTimeConstValue_i64(v__ast__ComptTimeConstValue val) { opt_ok2(&(i64[]) { ((int)((*val._rune))) }, (_option*)(&_t12), sizeof(i64)); return _t12; } - else if (val._typ == 303 /* v.ast.EmptyExpr */) { + else if (val._typ == 305 /* v.ast.EmptyExpr */) { } ; return (_option_i64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -42270,7 +40351,7 @@ _option_u8 v__ast__ComptTimeConstValue_u8(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u8 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42287,7 +40368,7 @@ _option_u16 v__ast__ComptTimeConstValue_u16(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u16 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42304,7 +40385,7 @@ _option_u32 v__ast__ComptTimeConstValue_u32(v__ast__ComptTimeConstValue val) { _option_u64 _t1 = v__ast__ComptTimeConstValue_u64(val); if (_t1.state != 0) { /*or block*/ _option_u32 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42387,7 +40468,7 @@ _option_u64 v__ast__ComptTimeConstValue_u64(v__ast__ComptTimeConstValue val) { } else if (val._typ == 21 /* rune */) { } - else if (val._typ == 303 /* v.ast.EmptyExpr */) { + else if (val._typ == 305 /* v.ast.EmptyExpr */) { } ; return (_option_u64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -42397,7 +40478,7 @@ _option_f32 v__ast__ComptTimeConstValue_f32(v__ast__ComptTimeConstValue val) { _option_f64 _t1 = v__ast__ComptTimeConstValue_f64(val); if (_t1.state != 0) { /*or block*/ _option_f32 _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -42465,7 +40546,7 @@ _option_f64 v__ast__ComptTimeConstValue_f64(v__ast__ComptTimeConstValue val) { } else if (val._typ == 21 /* rune */) { } - else if (val._typ == 303 /* v.ast.EmptyExpr */) { + else if (val._typ == 305 /* v.ast.EmptyExpr */) { } ; return (_option_f64){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -42532,14 +40613,14 @@ _option_string v__ast__ComptTimeConstValue_string(v__ast__ComptTimeConstValue va opt_ok2(&(string[]) { (*val._string) }, (_option*)(&_t12), sizeof(string)); return _t12; } - else if (val._typ == 303 /* v.ast.EmptyExpr */) { + else if (val._typ == 305 /* v.ast.EmptyExpr */) { } ; return (_option_string){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } _option_v__ast__ComptTimeConstValue v__ast__ConstField_comptime_expr_value(v__ast__ConstField* obj) { - if ((obj->comptime_expr_value)._typ != 303 /* v.ast.EmptyExpr */) { + if ((obj->comptime_expr_value)._typ != 305 /* v.ast.EmptyExpr */) { _option_v__ast__ComptTimeConstValue _t1; opt_ok2(&(v__ast__ComptTimeConstValue[]) { obj->comptime_expr_value }, (_option*)(&_t1), sizeof(v__ast__ComptTimeConstValue)); return _t1; @@ -42548,12 +40629,12 @@ _option_v__ast__ComptTimeConstValue v__ast__ConstField_comptime_expr_value(v__as } bool v__ast__ConstField_is_simple_define_const(v__ast__ConstField* obj) { - bool _t1 = ((obj->expr._typ == 296 /* v.ast.CharLiteral */)? (true) : (obj->expr._typ == 305 /* v.ast.FloatLiteral */)? (true) : (obj->expr._typ == 312 /* v.ast.IntegerLiteral */)? (true) : (false)); + bool _t1 = ((obj->expr._typ == 298 /* v.ast.CharLiteral */)? (true) : (obj->expr._typ == 307 /* v.ast.FloatLiteral */)? (true) : (obj->expr._typ == 314 /* v.ast.IntegerLiteral */)? (true) : (false)); return _t1; } bool v__ast__ScopeObject_is_simple_define_const(v__ast__ScopeObject obj) { - if ((obj)._typ == 363 /* v.ast.ConstField */) { + if ((obj)._typ == 365 /* v.ast.ConstField */) { bool _t1 = v__ast__ConstField_is_simple_define_const(&(*obj._v__ast__ConstField)); return _t1; } @@ -42569,7 +40650,7 @@ u64 v__ast__EmbeddedFile_hash(v__ast__EmbeddedFile e) { v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ast__Table* t) { v__ast__TypeSymbol* type_sym = v__ast__Table_sym(t, typ); if (type_sym->kind == v__ast__Kind__array) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; bool has_len = false; bool has_cap = false; bool has_default = false; @@ -42619,7 +40700,7 @@ v__ast__Expr v__ast__resolve_init(v__ast__StructInit node, v__ast__Type typ, v__ })))); return _t3; } else if (type_sym->kind == v__ast__Kind__map) { - v__ast__Map map_info = /* as */ *(v__ast__Map*)__as_cast((type_sym->info)._v__ast__Map,(type_sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map map_info = /* as */ *(v__ast__Map*)__as_cast((type_sym->info)._v__ast__Map,(type_sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; Array_v__ast__Expr keys = __new_array_with_default(0, 0, sizeof(v__ast__Expr), 0); 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) { @@ -42695,7 +40776,7 @@ _option_v__ast__Var_ptr v__ast__Scope_find_var(v__ast__Scope* s, string name) { _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { _option_v__ast__Var_ptr _t2; opt_ok2(&(v__ast__Var*[]) { &(*obj._v__ast__Var) }, (_option*)(&_t2), sizeof(v__ast__Var*)); return _t2; @@ -42712,7 +40793,7 @@ _option_v__ast__GlobalField_ptr v__ast__Scope_find_global(v__ast__Scope* s, stri _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 364 /* v.ast.GlobalField */) { + if (obj._typ == 366 /* v.ast.GlobalField */) { _option_v__ast__GlobalField_ptr _t2; opt_ok2(&(v__ast__GlobalField*[]) { &(*obj._v__ast__GlobalField) }, (_option*)(&_t2), sizeof(v__ast__GlobalField*)); return _t2; @@ -42729,7 +40810,7 @@ _option_v__ast__ConstField_ptr v__ast__Scope_find_const(v__ast__Scope* s, string _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(s, name), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 363 /* v.ast.ConstField */) { + if (obj._typ == 365 /* v.ast.ConstField */) { _option_v__ast__ConstField_ptr _t2; opt_ok2(&(v__ast__ConstField*[]) { &(*obj._v__ast__ConstField) }, (_option*)(&_t2), sizeof(v__ast__ConstField*)); return _t2; @@ -42770,7 +40851,7 @@ bool v__ast__Scope_known_const(v__ast__Scope* s, string name) { void v__ast__Scope_update_var_type(v__ast__Scope* s, string name, v__ast__Type typ) { v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)map_get(ADDR(map, s->objects), &(string[]){name}, &(v__ast__ScopeObject[]){ {0} })); - if ((obj)._typ == 365 /* v.ast.Var */) { + if ((obj)._typ == 367 /* v.ast.Var */) { if (!v__ast__Type_alias_eq((*obj._v__ast__Var).typ, typ)) { (*obj._v__ast__Var).typ = typ; } @@ -42848,7 +40929,7 @@ bool v__ast__Scope_has_inherited_vars(v__ast__Scope* s) { } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if ((obj)._typ == 365 /* v.ast.Var */) { + if ((obj)._typ == 367 /* v.ast.Var */) { if ((*obj._v__ast__Var).is_inherited) { bool _t5 = true; return _t5; @@ -42878,10 +40959,10 @@ v__ast__Scope* sc = HEAP(v__ast__Scope, _v_toheap_sc); } if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t2.key_values, _t3)); - if (obj._typ == 363 /* v.ast.ConstField */) { + if (obj._typ == 365 /* v.ast.ConstField */) { out = /*f*/string__plus(out, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = indent}}, {_SLIT(" * const: "), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT(" - "), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*obj._v__ast__ConstField).typ)}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))); } - else if (obj._typ == 365 /* v.ast.Var */) { + else if (obj._typ == 367 /* v.ast.Var */) { out = /*f*/string__plus(out, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = indent}}, {_SLIT(" * var: "), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__Var).name}}, {_SLIT(" - "), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*obj._v__ast__Var).typ)}}, {_SLIT("\n"), 0, { .d_c = 0 }}}))); } @@ -43014,7 +41095,7 @@ VV_LOCAL_SYMBOL void v__ast__stringify_fn_after_name(v__ast__FnDecl* node, strin if (node->generic_names.len > 0) { if (node->is_method) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, (*(v__ast__Param*)/*ee elem_sym */array_get(node->params, 0)).typ); - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*sym->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -43135,24 +41216,24 @@ multi_return_string_bool v__ast__StringInterLiteral_get_fspec_braces(v__ast__Str if (!needs_braces) { v__ast__Expr sub_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(lit->exprs, i)); for (;;) { - if (sub_expr._typ == 307 /* v.ast.Ident */) { + if (sub_expr._typ == 309 /* v.ast.Ident */) { if (string_at((*sub_expr._v__ast__Ident).name, 0) == '@') { needs_braces = true; } break; } - else if (sub_expr._typ == 293 /* v.ast.CallExpr */) { + else if (sub_expr._typ == 295 /* v.ast.CallExpr */) { if ((*sub_expr._v__ast__CallExpr).args.len != 0 || (*sub_expr._v__ast__CallExpr).concrete_types.len != 0 || (*sub_expr._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option || (*sub_expr._v__ast__CallExpr).or_block.stmts.len > 0) { needs_braces = true; - } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 293 /* v.ast.CallExpr */) { + } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 295 /* v.ast.CallExpr */) { sub_expr = (*sub_expr._v__ast__CallExpr).left; continue; - } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 294 /* v.ast.CastExpr */ || ((*sub_expr._v__ast__CallExpr).left)._typ == 310 /* v.ast.IndexExpr */) { + } else if (((*sub_expr._v__ast__CallExpr).left)._typ == 296 /* v.ast.CastExpr */ || ((*sub_expr._v__ast__CallExpr).left)._typ == 312 /* v.ast.IndexExpr */) { needs_braces = true; } break; } - else if (sub_expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (sub_expr._typ == 329 /* v.ast.SelectorExpr */) { if (string_at((*sub_expr._v__ast__SelectorExpr).field_name, 0) == '@') { needs_braces = true; break; @@ -43190,19 +41271,19 @@ multi_return_string_bool v__ast__StringInterLiteral_get_fspec_braces(v__ast__Str } string v__ast__Expr_str(v__ast__Expr x) { - if (x._typ == 285 /* v.ast.AnonFn */) { + if (x._typ == 287 /* v.ast.AnonFn */) { string _t1 = _SLIT("anon_fn"); return _t1; } - else if (x._typ == 300 /* v.ast.ComptimeType */) { + else if (x._typ == 302 /* v.ast.ComptimeType */) { string _t2 = v__ast__ComptimeType_str((*x._v__ast__ComptimeType)); return _t2; } - else if (x._typ == 302 /* v.ast.DumpExpr */) { + else if (x._typ == 304 /* v.ast.DumpExpr */) { string _t3 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("dump("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__DumpExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t3; } - else if (x._typ == 287 /* v.ast.ArrayInit */) { + else if (x._typ == 289 /* v.ast.ArrayInit */) { Array_string fields = __new_array_with_default(0, 0, sizeof(string), 0); if ((*x._v__ast__ArrayInit).has_len) { array_push((array*)&fields, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("len: "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ArrayInit).len_expr)}}, {_SLIT0, 0, { .d_c = 0 }}}))) })); @@ -43221,27 +41302,27 @@ string v__ast__Expr_str(v__ast__Expr x) { return _t8; } } - else if (x._typ == 288 /* v.ast.AsCast */) { + else if (x._typ == 290 /* v.ast.AsCast */) { string _t9 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__AsCast).expr)}}, {_SLIT(" as "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__AsCast).typ)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t9; } - else if (x._typ == 290 /* v.ast.AtExpr */) { + else if (x._typ == 292 /* v.ast.AtExpr */) { string _t10 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__AtExpr).val}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t10; } - else if (x._typ == 292 /* v.ast.CTempVar */) { + else if (x._typ == 294 /* v.ast.CTempVar */) { string _t11 = v__ast__Expr_str((*x._v__ast__CTempVar).orig); return _t11; } - else if (x._typ == 291 /* v.ast.BoolLiteral */) { + else if (x._typ == 293 /* v.ast.BoolLiteral */) { string _t12 = bool_str((*x._v__ast__BoolLiteral).val); return _t12; } - else if (x._typ == 294 /* v.ast.CastExpr */) { + else if (x._typ == 296 /* v.ast.CastExpr */) { string _t13 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CastExpr).typname}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__CastExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t13; } - else if (x._typ == 293 /* v.ast.CallExpr */) { + else if (x._typ == 295 /* v.ast.CallExpr */) { string sargs = v__ast__args2str((*x._v__ast__CallExpr).args); string propagate_suffix = ((*x._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option ? (_SLIT(" ?")) : (_SLIT(""))); if ((*x._v__ast__CallExpr).is_method) { @@ -43263,11 +41344,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t18 = str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CallExpr).name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = sargs}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = propagate_suffix}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t18; } - else if (x._typ == 296 /* v.ast.CharLiteral */) { + else if (x._typ == 298 /* v.ast.CharLiteral */) { string _t19 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__CharLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})); return _t19; } - else if (x._typ == 297 /* v.ast.Comment */) { + else if (x._typ == 299 /* v.ast.Comment */) { if ((*x._v__ast__Comment).is_multi) { Array_string lines = string_split_into_lines((*x._v__ast__Comment).text); string _t20 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* "), /*100 &int*/0xfe07, {.d_i32 = lines.len}}, {_SLIT(" lines comment */"), 0, { .d_c = 0 }}})); @@ -43278,11 +41359,11 @@ string v__ast__Expr_str(v__ast__Expr x) { return _t21; } } - else if (x._typ == 299 /* v.ast.ComptimeSelector */) { + else if (x._typ == 301 /* v.ast.ComptimeSelector */) { string _t22 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ComptimeSelector).left)}}, {_SLIT(".$"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ComptimeSelector).field_expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t22; } - else if (x._typ == 301 /* v.ast.ConcatExpr */) { + else if (x._typ == 303 /* v.ast.ConcatExpr */) { Array_string _t24 = {0}; Array_v__ast__Expr _t24_orig = (*x._v__ast__ConcatExpr).vals; int _t24_len = _t24_orig.len; @@ -43296,27 +41377,27 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t23 = Array_string_join(_t24, _SLIT(",")); return _t23; } - else if (x._typ == 304 /* v.ast.EnumVal */) { + else if (x._typ == 306 /* v.ast.EnumVal */) { string _t26 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__EnumVal).val}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t26; } - else if (x._typ == 305 /* v.ast.FloatLiteral */) { + else if (x._typ == 307 /* v.ast.FloatLiteral */) { string _t27 = (*x._v__ast__FloatLiteral).val; return _t27; } - else if (x._typ == 312 /* v.ast.IntegerLiteral */) { + else if (x._typ == 314 /* v.ast.IntegerLiteral */) { string _t28 = (*x._v__ast__IntegerLiteral).val; return _t28; } - else if (x._typ == 306 /* v.ast.GoExpr */) { + else if (x._typ == 308 /* v.ast.GoExpr */) { string _t29 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("go "), /*115 &v.ast.CallExpr*/0xfe10, {.d_s = v__ast__CallExpr_str((*x._v__ast__GoExpr).call_expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t29; } - else if (x._typ == 307 /* v.ast.Ident */) { + else if (x._typ == 309 /* v.ast.Ident */) { string _t30 = (*x._v__ast__Ident).name; return _t30; } - else if (x._typ == 308 /* v.ast.IfExpr */) { + else if (x._typ == 310 /* v.ast.IfExpr */) { Array_string parts = __new_array_with_default(0, 0, sizeof(string), 0); string dollar = ((*x._v__ast__IfExpr).is_comptime ? (_SLIT("$")) : (_SLIT(""))); for (int i = 0; i < (*x._v__ast__IfExpr).branches.len; ++i) { @@ -43336,15 +41417,15 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t36 = Array_string_join(parts, _SLIT("")); return _t36; } - else if (x._typ == 310 /* v.ast.IndexExpr */) { + else if (x._typ == 312 /* v.ast.IndexExpr */) { string _t37 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__IndexExpr).index)}}, {_SLIT("]"), 0, { .d_c = 0 }}})); return _t37; } - else if (x._typ == 311 /* v.ast.InfixExpr */) { + else if (x._typ == 313 /* v.ast.InfixExpr */) { string _t38 = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).left)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__InfixExpr).op)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__InfixExpr).right)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t38; } - else if (x._typ == 316 /* v.ast.MapInit */) { + else if (x._typ == 318 /* v.ast.MapInit */) { Array_string pairs = __new_array_with_default(0, 0, sizeof(string), 0); for (int ik = 0; ik < (*x._v__ast__MapInit).keys.len; ++ik) { v__ast__Expr kv = ((v__ast__Expr*)(*x._v__ast__MapInit).keys.data)[ik]; @@ -43354,11 +41435,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t40 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("map{ "), /*115 &string*/0xfe10, {.d_s = Array_string_join(pairs, _SLIT(" "))}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t40; } - else if (x._typ == 322 /* v.ast.ParExpr */) { + else if (x._typ == 324 /* v.ast.ParExpr */) { string _t41 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__ParExpr).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t41; } - else if (x._typ == 323 /* v.ast.PostfixExpr */) { + else if (x._typ == 325 /* v.ast.PostfixExpr */) { if ((*x._v__ast__PostfixExpr).op == v__token__Kind__question) { string _t42 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT(" ?"), 0, { .d_c = 0 }}})); return _t42; @@ -43366,11 +41447,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t43 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__PostfixExpr).expr)}}, {_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*x._v__ast__PostfixExpr).op)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t43; } - else if (x._typ == 324 /* v.ast.PrefixExpr */) { + else if (x._typ == 326 /* v.ast.PrefixExpr */) { string _t44 = string__plus(v__token__Kind_str((*x._v__ast__PrefixExpr).op), v__ast__Expr_str((*x._v__ast__PrefixExpr).right)); return _t44; } - else if (x._typ == 325 /* v.ast.RangeExpr */) { + else if (x._typ == 327 /* v.ast.RangeExpr */) { string s = _SLIT(".."); if ((*x._v__ast__RangeExpr).has_low) { s = string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__RangeExpr).low)}}, {_SLIT(" "), 0, { .d_c = 0 }}})), s); @@ -43381,15 +41462,15 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t45 = s; return _t45; } - else if (x._typ == 326 /* v.ast.SelectExpr */) { + else if (x._typ == 328 /* v.ast.SelectExpr */) { string _t46 = _SLIT("ast.SelectExpr"); return _t46; } - else if (x._typ == 327 /* v.ast.SelectorExpr */) { + else if (x._typ == 329 /* v.ast.SelectorExpr */) { string _t47 = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t47; } - else if (x._typ == 328 /* v.ast.SizeOf */) { + else if (x._typ == 330 /* v.ast.SizeOf */) { if ((*x._v__ast__SizeOf).is_type) { string _t48 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__SizeOf).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t48; @@ -43397,11 +41478,11 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t49 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__SizeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t49; } - else if (x._typ == 320 /* v.ast.OffsetOf */) { + else if (x._typ == 322 /* v.ast.OffsetOf */) { string _t50 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("__offsetof("), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_to_str(global_table, (*x._v__ast__OffsetOf).struct_type)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__OffsetOf).field}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t50; } - else if (x._typ == 330 /* v.ast.StringInterLiteral */) { + else if (x._typ == 332 /* v.ast.StringInterLiteral */) { strings__Builder res = strings__new_builder(50); strings__Builder_write_string(&res, _SLIT("'")); for (int i = 0; i < (*x._v__ast__StringInterLiteral).vals.len; ++i) { @@ -43427,35 +41508,35 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t51 = strings__Builder_str(&res); return _t51; } - else if (x._typ == 331 /* v.ast.StringLiteral */) { + else if (x._typ == 333 /* v.ast.StringLiteral */) { string _t52 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*x._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}})); return _t52; } - else if (x._typ == 333 /* v.ast.TypeNode */) { + else if (x._typ == 335 /* v.ast.TypeNode */) { string _t53 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("TypeNode("), /*115 &v.ast.Type*/0xfe10, {.d_s = v__ast__Type_str((*x._v__ast__TypeNode).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t53; } - else if (x._typ == 334 /* v.ast.TypeOf */) { + else if (x._typ == 336 /* v.ast.TypeOf */) { string _t54 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("typeof("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__TypeOf).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t54; } - else if (x._typ == 314 /* v.ast.Likely */) { + else if (x._typ == 316 /* v.ast.Likely */) { string _t55 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("_likely_("), /*115 &string*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__Likely).expr)}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t55; } - else if (x._typ == 335 /* v.ast.UnsafeExpr */) { + else if (x._typ == 337 /* v.ast.UnsafeExpr */) { string _t56 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("unsafe { "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*x._v__ast__UnsafeExpr).expr)}}, {_SLIT(" }"), 0, { .d_c = 0 }}})); return _t56; } - else if (x._typ == 319 /* v.ast.None */) { + else if (x._typ == 321 /* v.ast.None */) { string _t57 = _SLIT("none"); return _t57; } - else if (x._typ == 313 /* v.ast.IsRefType */) { + else if (x._typ == 315 /* v.ast.IsRefType */) { string _t58 = string__plus(string__plus(_SLIT("isreftype("), ((*x._v__ast__IsRefType).is_type ? (v__ast__Table_type_to_str(global_table, (*x._v__ast__IsRefType).typ)) : (v__ast__Expr_str((*x._v__ast__IsRefType).expr)))), _SLIT(")")); return _t58; } - else if (x._typ == 309 /* v.ast.IfGuardExpr */) { + else if (x._typ == 311 /* v.ast.IfGuardExpr */) { string s = _SLIT(""); for (int i = 0; i < (*x._v__ast__IfGuardExpr).vars.len; ++i) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*x._v__ast__IfGuardExpr).vars.data)[i]; @@ -43467,48 +41548,48 @@ string v__ast__Expr_str(v__ast__Expr x) { string _t59 = string__plus(string__plus(s, _SLIT(" := ")), v__ast__Expr_str((*x._v__ast__IfGuardExpr).expr)); return _t59; } - else if (x._typ == 332 /* v.ast.StructInit */) { + else if (x._typ == 334 /* v.ast.StructInit */) { string sname = v__ast__Table_sym(global_table, (*x._v__ast__StructInit).typ)->name; string _t60 = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sname}}, {_SLIT("{....}"), 0, { .d_c = 0 }}})); return _t60; } - else if (x._typ == 286 /* v.ast.ArrayDecompose */) { + else if (x._typ == 288 /* v.ast.ArrayDecompose */) { string _t61 = _SLIT("ast.ArrayDecompose"); return _t61; } - else if (x._typ == 289 /* v.ast.Assoc */) { + else if (x._typ == 291 /* v.ast.Assoc */) { string _t62 = _SLIT("ast.Assoc"); return _t62; } - else if (x._typ == 295 /* v.ast.ChanInit */) { + else if (x._typ == 297 /* v.ast.ChanInit */) { string _t63 = _SLIT("ast.ChanInit"); return _t63; } - else if (x._typ == 298 /* v.ast.ComptimeCall */) { + else if (x._typ == 300 /* v.ast.ComptimeCall */) { string _t64 = _SLIT("ast.ComptimeCall"); return _t64; } - else if (x._typ == 303 /* v.ast.EmptyExpr */) { + else if (x._typ == 305 /* v.ast.EmptyExpr */) { string _t65 = _SLIT("ast.EmptyExpr"); return _t65; } - else if (x._typ == 315 /* v.ast.LockExpr */) { + else if (x._typ == 317 /* v.ast.LockExpr */) { string _t66 = _SLIT("ast.LockExpr"); return _t66; } - else if (x._typ == 317 /* v.ast.MatchExpr */) { + else if (x._typ == 319 /* v.ast.MatchExpr */) { string _t67 = _SLIT("ast.MatchExpr"); return _t67; } - else if (x._typ == 318 /* v.ast.NodeError */) { + else if (x._typ == 320 /* v.ast.NodeError */) { string _t68 = _SLIT("ast.NodeError"); return _t68; } - else if (x._typ == 321 /* v.ast.OrExpr */) { + else if (x._typ == 323 /* v.ast.OrExpr */) { string _t69 = _SLIT("ast.OrExpr"); return _t69; } - else if (x._typ == 329 /* v.ast.SqlExpr */) { + else if (x._typ == 331 /* v.ast.SqlExpr */) { string _t70 = _SLIT("ast.SqlExpr"); return _t70; } @@ -43546,15 +41627,15 @@ string v__ast__BranchStmt_str(v__ast__BranchStmt* node) { } string v__ast__Stmt_str(v__ast__Stmt node) { - if (node._typ == 338 /* v.ast.AssertStmt */) { + if (node._typ == 340 /* v.ast.AssertStmt */) { string _t1 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("assert "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*node._v__ast__AssertStmt).expr)}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t1; } - else if (node._typ == 339 /* v.ast.AssignStmt */) { + else if (node._typ == 341 /* v.ast.AssignStmt */) { string out = _SLIT(""); for (int i = 0; i < (*node._v__ast__AssignStmt).left.len; ++i) { v__ast__Expr left = ((v__ast__Expr*)(*node._v__ast__AssignStmt).left.data)[i]; - if ((left)._typ == 307 /* v.ast.Ident */) { + if ((left)._typ == 309 /* v.ast.Ident */) { v__ast__IdentVar var_info = v__ast__Ident_var_info(&(*left._v__ast__Ident)); if (var_info.is_mut) { out = /*f*/string__plus(out, _SLIT("mut ")); @@ -43576,11 +41657,11 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t2 = out; return _t2; } - else if (node._typ == 341 /* v.ast.BranchStmt */) { + else if (node._typ == 343 /* v.ast.BranchStmt */) { string _t3 = v__ast__BranchStmt_str(&(*node._v__ast__BranchStmt)); return _t3; } - else if (node._typ == 343 /* v.ast.ConstDecl */) { + else if (node._typ == 345 /* v.ast.ConstDecl */) { Array_string _t4 = {0}; Array_v__ast__ConstField _t4_orig = (*node._v__ast__ConstDecl).fields; int _t4_len = _t4_orig.len; @@ -43595,7 +41676,7 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t6 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("const ("), /*115 &string*/0xfe10, {.d_s = Array_string_join(fields, _SLIT(" "))}}, {_SLIT(")"), 0, { .d_c = 0 }}})); return _t6; } - else if (node._typ == 347 /* v.ast.ExprStmt */) { + else if (node._typ == 349 /* v.ast.ExprStmt */) { string _t7 = v__ast__Expr_str((*node._v__ast__ExprStmt).expr); return _t7; } @@ -43603,15 +41684,15 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t8 = str_intp(4, _MOV((StrIntpData[]){{_SLIT("fn "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__FnDecl).name}}, {_SLIT("( "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__FnDecl).params.len}}, {_SLIT(" params ) { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__FnDecl).stmts.len}}, {_SLIT(" stmts }"), 0, { .d_c = 0 }}})); return _t8; } - else if (node._typ == 346 /* v.ast.EnumDecl */) { + else if (node._typ == 348 /* v.ast.EnumDecl */) { string _t9 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("enum "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__EnumDecl).name}}, {_SLIT(" { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__EnumDecl).fields.len}}, {_SLIT(" fields }"), 0, { .d_c = 0 }}})); return _t9; } - else if (node._typ == 357 /* v.ast.Module */) { + else if (node._typ == 359 /* v.ast.Module */) { string _t10 = str_intp(2, _MOV((StrIntpData[]){{_SLIT("module "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Module).name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t10; } - else if (node._typ == 355 /* v.ast.Import */) { + else if (node._typ == 357 /* v.ast.Import */) { string out = str_intp(2, _MOV((StrIntpData[]){{_SLIT("import "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Import).mod}}, {_SLIT0, 0, { .d_c = 0 }}})); if ((*node._v__ast__Import).alias.len > 0) { out = /*f*/string__plus(out, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" as "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__Import).alias}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -43619,7 +41700,7 @@ string v__ast__Stmt_str(v__ast__Stmt node) { string _t11 = out; return _t11; } - else if (node._typ == 360 /* v.ast.StructDecl */) { + else if (node._typ == 362 /* v.ast.StructDecl */) { string _t12 = str_intp(3, _MOV((StrIntpData[]){{_SLIT("struct "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__StructDecl).name}}, {_SLIT(" { "), /*100 &int*/0xfe07, {.d_i32 = (*node._v__ast__StructDecl).fields.len}}, {_SLIT(" fields }"), 0, { .d_c = 0 }}})); return _t12; } @@ -43931,7 +42012,7 @@ _option_v__ast__Fn v__ast__Table_register_aggregate_method(v__ast__Table* t, v__ if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__Fn new_fn = ((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -43994,8 +42075,8 @@ _option_v__ast__Fn v__ast__Table_find_method(v__ast__Table* t, v__ast__TypeSymbo Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, v__ast__GetEmbedsOptions options) { Array_Array_v__ast__Type embeds = __new_array_with_default(0, 0, sizeof(Array_v__ast__Type), 0); - v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 472 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); - if ((unalias_sym->info)._typ == 457 /* v.ast.Struct */) { + v__ast__TypeSymbol* unalias_sym = ((sym->info)._typ == 474 /* v.ast.Alias */ ? (v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type)) : (sym)); + if ((unalias_sym->info)._typ == 459 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*unalias_sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*unalias_sym->info._v__ast__Struct).embeds.data)[_t1]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(t, embed); @@ -44012,7 +42093,7 @@ Array_Array_v__ast__Type v__ast__Table_get_embeds(v__ast__Table* t, v__ast__Type } _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_from_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, string method_name) { - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { @@ -44046,7 +42127,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 475 /* v.ast.Interface */) { + } else if ((sym->info)._typ == 477 /* v.ast.Interface */) { Array_v__ast__Fn found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); Array_v__ast__Type embed_of_found_methods = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t11 = 0; _t11 < (*sym->info._v__ast__Interface).embeds.len; ++_t11) { @@ -44080,7 +42161,7 @@ _option_multi_return_v__ast__Fn_Array_v__ast__Type v__ast__Table_find_method_fro } else if (found_methods.len > 1) { return (_option_multi_return_v__ast__Fn_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous method `"), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 470 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 472 /* v.ast.Aggregate */) { for (int _t21 = 0; _t21 < (*sym->info._v__ast__Aggregate).types.len; ++_t21) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t21]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -44130,7 +42211,7 @@ _option_v__ast__Fn v__ast__Table_find_method_with_embeds(v__ast__Table* t, v__as Array_v__ast__Fn v__ast__Table_get_embed_methods(v__ast__Table* t, v__ast__TypeSymbol* sym) { Array_v__ast__Fn methods = __new_array_with_default(0, 0, sizeof(v__ast__Fn), 0); - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t1]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(t, embed); @@ -44146,7 +42227,7 @@ VV_LOCAL_SYMBOL _option_v__ast__StructField v__ast__Table_register_aggregate_fie if (sym->kind != v__ast__Kind__aggregate) { v__ast__Table_panic(t, str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unexpected type symbol: "), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(sym->kind)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ; + v__ast__Aggregate agg_info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; bool found_once = false; v__ast__StructField new_field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); for (int _t1 = 0; _t1 < agg_info.types.len; ++_t1) { @@ -44188,7 +42269,7 @@ bool v__ast__Table_struct_has_field(v__ast__Table* t, v__ast__TypeSymbol* struct Array_v__ast__StructField v__ast__Table_struct_fields(v__ast__Table* t, v__ast__TypeSymbol* sym) { Array_v__ast__StructField fields = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { _PUSH_MANY(&fields, ((*sym->info._v__ast__Struct).fields), _t1, Array_v__ast__StructField); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Struct).embeds.len; ++_t2) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t2]; @@ -44203,7 +42284,7 @@ Array_v__ast__StructField v__ast__Table_struct_fields(v__ast__Table* t, v__ast__ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__TypeSymbol* s, string name) { v__ast__TypeSymbol* ts = s; for (;;) { - if (ts->info._typ == 457 /* v.ast.Struct */) { + if (ts->info._typ == 459 /* v.ast.Struct */) { _option_v__ast__StructField _t1; if (_t1 = v__ast__Struct_find_field(&(*ts->info._v__ast__Struct), name), _t1.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t1.data; @@ -44212,7 +42293,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t2; } } - else if (ts->info._typ == 470 /* v.ast.Aggregate */) { + else if (ts->info._typ == 472 /* v.ast.Aggregate */) { _option_v__ast__StructField _t3; if (_t3 = v__ast__Aggregate_find_field(&(*ts->info._v__ast__Aggregate), name), _t3.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t3.data; @@ -44231,7 +42312,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T opt_ok2(&(v__ast__StructField[]) { field }, (_option*)(&_t7), sizeof(v__ast__StructField)); return _t7; } - else if (ts->info._typ == 475 /* v.ast.Interface */) { + else if (ts->info._typ == 477 /* v.ast.Interface */) { _option_v__ast__StructField _t8; if (_t8 = v__ast__Interface_find_field(&(*ts->info._v__ast__Interface), name), _t8.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t8.data; @@ -44240,7 +42321,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T return _t9; } } - else if (ts->info._typ == 476 /* v.ast.SumType */) { + else if (ts->info._typ == 478 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, ts); _option_v__ast__StructField _t10; if (_t10 = v__ast__SumType_find_field(&(*ts->info._v__ast__SumType), name), _t10.state == 0) { @@ -44264,7 +42345,7 @@ _option_v__ast__StructField v__ast__Table_find_field(v__ast__Table* t, v__ast__T } _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_field_from_embeds(v__ast__Table* t, v__ast__TypeSymbol* sym, string field_name) { - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { Array_v__ast__StructField found_fields = __new_array_with_default(0, 0, sizeof(v__ast__StructField), 0); Array_v__ast__Type embeds_of_found_fields = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).embeds.len; ++_t1) { @@ -44298,7 +42379,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f } else if (found_fields.len > 1) { return (_option_multi_return_v__ast__StructField_Array_v__ast__Type){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("ambiguous field `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - } else if ((sym->info)._typ == 470 /* v.ast.Aggregate */) { + } else if ((sym->info)._typ == 472 /* v.ast.Aggregate */) { for (int _t11 = 0; _t11 < (*sym->info._v__ast__Aggregate).types.len; ++_t11) { v__ast__Type typ = ((v__ast__Type*)(*sym->info._v__ast__Aggregate).types.data)[_t11]; v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(t, typ); @@ -44317,7 +42398,7 @@ _option_multi_return_v__ast__StructField_Array_v__ast__Type v__ast__Table_find_f return _t13; } } - } else if ((sym->info)._typ == 472 /* v.ast.Alias */) { + } else if ((sym->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* unalias_sym = v__ast__Table_sym(t, (*sym->info._v__ast__Alias).parent_type); _option_multi_return_v__ast__StructField_Array_v__ast__Type _t14 = v__ast__Table_find_field_from_embeds(t, unalias_sym, field_name); return _t14; @@ -44352,20 +42433,22 @@ _option_v__ast__StructField v__ast__Table_find_field_with_embeds(v__ast__Table* void v__ast__Table_resolve_common_sumtype_fields(v__ast__Table* t, v__ast__TypeSymbol* sym_) { v__ast__TypeSymbol* sym = sym_; - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; if (info.found_fields) { return; } - Map_string_v__ast__StructField field_map = new_map(sizeof(string), sizeof(v__ast__StructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int field_usages = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__StructField field_map = new_map(sizeof(string), sizeof(v__ast__StructField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int field_usages = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < info.variants.len; ++_t1) { v__ast__Type variant = ((v__ast__Type*)info.variants.data)[_t1]; v__ast__TypeSymbol* v_sym = v__ast__Table_final_sym(t, variant); Array_v__ast__StructField _t2 = __new_array(0, 0, sizeof(v__ast__StructField)); - if (v_sym->info._typ == 457 /* v.ast.Struct */) { + if (v_sym->info._typ == 459 /* v.ast.Struct */) { _t2 = v__ast__Table_struct_fields(t, v_sym); } - else if (v_sym->info._typ == 476 /* v.ast.SumType */) { + else if (v_sym->info._typ == 478 /* v.ast.SumType */) { v__ast__Table_resolve_common_sumtype_fields(t, v_sym); _t2 = (*v_sym->info._v__ast__SumType).fields; } @@ -44453,7 +42536,7 @@ inline v__ast__TypeSymbol* v__ast__Table_final_sym(v__ast__Table* t, v__ast__Typ if (idx > 0) { v__ast__TypeSymbol* current_symbol = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); if (current_symbol->kind == v__ast__Kind__alias) { - idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + idx = v__ast__Type_idx((/* as */ *(v__ast__Alias*)__as_cast((current_symbol->info)._v__ast__Alias,(current_symbol->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); } v__ast__TypeSymbol* _t1 = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, idx)); return _t1; @@ -44474,7 +42557,7 @@ inline string v__ast__Table_get_type_name(v__ast__Table* t, v__ast__Type typ) { inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; if (pt <= _const_v__ast__char_type && pt >= _const_v__ast__void_type) { v__ast__Type _t1 = pt; return _t1; @@ -44488,7 +42571,7 @@ inline v__ast__Type v__ast__Table_unalias_num_type(v__ast__Table* t, v__ast__Typ inline v__ast__Type v__ast__Table_unaliased_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_sym(t, typ); if (sym->kind == v__ast__Kind__alias) { - v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + v__ast__Type pt = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; v__ast__Type _t1 = pt; return _t1; } @@ -44577,15 +42660,15 @@ bool v__ast__Table_known_type_idx(v__ast__Table* t, v__ast__Type typ) { return _t2; } else if (sym->kind == (v__ast__Kind__array)) { - bool _t3 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type); + bool _t3 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type); return _t3; } else if (sym->kind == (v__ast__Kind__array_fixed)) { - bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type); + bool _t4 = v__ast__Table_known_type_idx(t, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type); return _t4; } else if (sym->kind == (v__ast__Kind__map)) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; bool _t5 = v__ast__Table_known_type_idx(t, info.key_type) && v__ast__Table_known_type_idx(t, info.value_type); return _t5; } @@ -44625,7 +42708,7 @@ inline string v__ast__Table_array_cname(v__ast__Table* t, v__ast__Type elem_type inline string v__ast__Table_array_fixed_name(v__ast__Table* t, v__ast__Type elem_type, int size, v__ast__Expr size_expr) { v__ast__TypeSymbol* elem_type_sym = v__ast__Table_sym(t, elem_type); string ptr = (v__ast__Type_is_ptr(elem_type) ? (string_repeat(_SLIT("&"), v__ast__Type_nr_muls(elem_type))) : (_SLIT(""))); - string size_str = ((size_expr)._typ == 303 /* v.ast.EmptyExpr */ || size != 987654321 ? (int_str(size)) : (v__ast__Expr_str(size_expr))); + string size_str = ((size_expr)._typ == 305 /* v.ast.EmptyExpr */ || size != 987654321 ? (int_str(size)) : (v__ast__Expr_str(size_expr))); string _t1 = str_intp(4, _MOV((StrIntpData[]){{_SLIT("["), /*115 &string*/0xfe10, {.d_s = size_str}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = ptr}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})); return _t1; } @@ -44883,22 +42966,22 @@ int v__ast__Table_add_placeholder_type(v__ast__Table* t, string name, v__ast__La inline v__ast__Type v__ast__Table_value_type(v__ast__Table* t, v__ast__Type typ) { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(t, typ); if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type _t1 = array_info.elem_type; return _t1; } if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type _t2 = info.elem_type; return _t2; } if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__ast__Type _t3 = info.elem_type; return _t3; } if (sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; v__ast__Type _t4 = info.value_type; return _t4; } @@ -44951,7 +43034,7 @@ bool v__ast__Table_register_fn_concrete_types(v__ast__Table* t, string fn_name, bool v__ast__Table_sumtype_has_variant(v__ast__Table* t, v__ast__Type parent, v__ast__Type variant, bool is_as) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(t, parent); if (parent_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType parent_info = /* as */ *(v__ast__SumType*)__as_cast((parent_sym->info)._v__ast__SumType,(parent_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; v__ast__TypeSymbol* var_sym = v__ast__Table_sym(t, variant); if (var_sym->kind == (v__ast__Kind__aggregate)) { @@ -44984,7 +43067,7 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_variant_in_type(v__ast__Table* } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type* aggregate_type, bool is_as) { - v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ; + v__ast__Aggregate aggregate_sym = /* as */ *(v__ast__Aggregate*)__as_cast((v__ast__Table_sym(t, *aggregate_type)->info)._v__ast__Aggregate,(v__ast__Table_sym(t, *aggregate_type)->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; for (int _t1 = 0; _t1 < aggregate_sym.types.len; ++_t1) { v__ast__Type var_type = ((v__ast__Type*)aggregate_sym.types.data)[_t1]; if (!v__ast__Table_sumtype_has_variant(t, parent_type, var_type, is_as)) { @@ -44997,9 +43080,9 @@ VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_aggregate_variant(v__ast__Table } VV_LOCAL_SYMBOL bool v__ast__Table_sumtype_check_alias_variant(v__ast__Table* t, v__ast__Type parent_type, v__ast__Type alias_type, bool is_as) { - v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType parent_sym = /* as */ *(v__ast__SumType*)__as_cast((v__ast__Table_sym(t, parent_type)->info)._v__ast__SumType,(v__ast__Table_sym(t, parent_type)->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; if (!v__ast__Table_sumtype_check_variant_in_type(t, parent_sym, alias_type, is_as)) { - v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias alias_info = /* as */ *(v__ast__Alias*)__as_cast((v__ast__Table_sym(t, alias_type)->info)._v__ast__Alias,(v__ast__Table_sym(t, alias_type)->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; bool _t1 = v__ast__Type_alias_eq(parent_type, alias_info.parent_type) || v__ast__Table_sumtype_has_variant(t, parent_type, alias_info.parent_type, is_as); return _t1; } @@ -45042,7 +43125,7 @@ Array_string v__ast__Table_known_type_names(v__ast__Table* t) { } bool v__ast__Table_has_deep_child_no_ref(v__ast__Table* t, v__ast__TypeSymbol* ts, string name) { - if ((ts->info)._typ == 457 /* v.ast.Struct */) { + if ((ts->info)._typ == 459 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < (*ts->info._v__ast__Struct).fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)(*ts->info._v__ast__Struct).fields.data)[_t1]; v__ast__TypeSymbol* sym = v__ast__Table_sym(t, field.typ); @@ -45136,7 +43219,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t3 = false; return _t3; } - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { bool _t4 = false; return _t4; @@ -45147,7 +43230,7 @@ bool v__ast__Table_does_type_implement_interface(v__ast__Table* t, v__ast__Type bool _t5 = false; return _t5; } - if ((inter_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { Array_v__ast__Attr attrs = (*(v__ast__InterfaceDecl*)map_get(ADDR(map, t->interfaces), &(int[]){inter_typ}, &(v__ast__InterfaceDecl[]){ (v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.is_pub = 0,.are_embeds_expanded = 0,} })).attrs; for (int _t6 = 0; _t6 < attrs.len; ++_t6) { v__ast__Attr attr = ((v__ast__Attr*)attrs.data)[_t6]; @@ -45238,12 +43321,12 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t5; } } - if (sym->info._typ == 452 /* v.ast.Array */) { + if (sym->info._typ == 454 /* v.ast.Array */) { v__ast__Type elem_type = (*sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 452 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 454 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; @@ -45263,7 +43346,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { _option_v__ast__Type _t9; if (_t9 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types), _t9.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t9.data; @@ -45279,7 +43362,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 481 /* v.ast.Chan */) { + else if (sym->info._typ == 483 /* v.ast.Chan */) { _option_v__ast__Type _t12; if (_t12 = v__ast__Table_resolve_generic_to_concrete(t, (*sym->info._v__ast__Chan).elem_type, generic_names, concrete_types), _t12.state == 0) { v__ast__Type typ = *(v__ast__Type*)_t12.data; @@ -45295,7 +43378,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 484 /* v.ast.FnType */) { + else if (sym->info._typ == 486 /* v.ast.FnType */) { v__ast__Fn func = (*sym->info._v__ast__FnType).func; bool has_generic = false; if (v__ast__Type_has_flag(func.return_type, v__ast__TypeFlag__generic)) { @@ -45334,7 +43417,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t19; } } - else if (sym->info._typ == 483 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 485 /* v.ast.MultiReturn */) { Array_v__ast__Type types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool type_changed = false; for (int _t20 = 0; _t20 < (*sym->info._v__ast__MultiReturn).types.len; ++_t20) { @@ -45372,7 +43455,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 453 /* v.ast.Map */) { + else if (sym->info._typ == 455 /* v.ast.Map */) { bool type_changed = false; v__ast__Type unwrapped_key_type = (*sym->info._v__ast__Map).key_type; v__ast__Type unwrapped_value_type = (*sym->info._v__ast__Map).value_type; @@ -45401,7 +43484,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, } } } - else if (sym->info._typ == 457 /* v.ast.Struct */) { + else if (sym->info._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Struct).generic_types.len; ++i) { @@ -45425,7 +43508,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t33; } } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { @@ -45449,7 +43532,7 @@ _option_v__ast__Type v__ast__Table_resolve_generic_to_concrete(v__ast__Table* t, return _t35; } } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string nrt = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("<"), 0, { .d_c = 0 }}})); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { @@ -45487,12 +43570,12 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty string nrt = _SLIT(""); string c_nrt = _SLIT(""); v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); - if (ts->info._typ == 452 /* v.ast.Array */) { + if (ts->info._typ == 454 /* v.ast.Array */) { v__ast__Type elem_type = (*ts->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 452 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 454 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; @@ -45502,26 +43585,26 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t1 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t1; } - else if (ts->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 482 /* v.ast.ArrayFixed */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_array_fixed(t, unwrap_typ, (*ts->info._v__ast__ArrayFixed).size, v__ast__None_to_sumtype_v__ast__Expr(ADDR(v__ast__None, (((v__ast__None){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},}))))); v__ast__Type _t2 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t2; } - else if (ts->info._typ == 481 /* v.ast.Chan */) { + else if (ts->info._typ == 483 /* v.ast.Chan */) { v__ast__Type unwrap_typ = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_chan(t, unwrap_typ, v__ast__Type_nr_muls(unwrap_typ) > 0); v__ast__Type _t3 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t3; } - else if (ts->info._typ == 453 /* v.ast.Map */) { + else if (ts->info._typ == 455 /* v.ast.Map */) { v__ast__Type unwrap_key_type = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Map).key_type, generic_names, concrete_types); v__ast__Type unwrap_value_type = v__ast__Table_unwrap_generic_type(t, (*ts->info._v__ast__Map).value_type, generic_names, concrete_types); int idx = v__ast__Table_find_or_register_map(t, unwrap_key_type, unwrap_value_type); v__ast__Type _t4 = v__ast__Type_clear_flag(v__ast__Type_derive_add_muls(v__ast__new_type(idx), typ), v__ast__TypeFlag__generic); return _t4; } - else if (ts->info._typ == 457 /* v.ast.Struct */) { + else if (ts->info._typ == 459 /* v.ast.Struct */) { if (!(*ts->info._v__ast__Struct).is_generic) { v__ast__Type _t5 = typ; return _t5; @@ -45589,7 +43672,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 475 /* v.ast.Interface */) { + else if (ts->info._typ == 477 /* v.ast.Interface */) { if (!(*ts->info._v__ast__Interface).is_generic) { v__ast__Type _t14 = typ; return _t14; @@ -45657,7 +43740,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty } } } - else if (ts->info._typ == 476 /* v.ast.SumType */) { + else if (ts->info._typ == 478 /* v.ast.SumType */) { if (!(*ts->info._v__ast__SumType).is_generic) { v__ast__Type _t23 = typ; return _t23; @@ -45729,7 +43812,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty else { } ; - if (ts->info._typ == 457 /* v.ast.Struct */) { + if (ts->info._typ == 459 /* v.ast.Struct */) { v__ast__Struct info = (*ts->info._v__ast__Struct); info.is_generic = false; info.concrete_types = final_concrete_types; @@ -45743,7 +43826,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t33 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t33; } - else if (ts->info._typ == 476 /* v.ast.SumType */) { + else if (ts->info._typ == 478 /* v.ast.SumType */) { Array_v__ast__Type variants = array_clone_to_depth(&(*ts->info._v__ast__SumType).variants, 0); for (int i = 0; i < variants.len; ++i) { if (v__ast__Type_has_flag((*(v__ast__Type*)/*ee elem_sym */array_get(variants, i)), v__ast__TypeFlag__generic)) { @@ -45773,7 +43856,7 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty v__ast__Type _t36 = v__ast__Type_clear_flag(v__ast__Type_derive(v__ast__new_type(new_idx), typ), v__ast__TypeFlag__generic); return _t36; } - else if (ts->info._typ == 475 /* v.ast.Interface */) { + else if (ts->info._typ == 477 /* v.ast.Interface */) { Array_v__ast__Fn imethods = array_clone_to_depth(&(*ts->info._v__ast__Interface).methods, 0); for (int _t37 = 0; _t37 < imethods.len; ++_t37) { v__ast__Fn* method = ((v__ast__Fn*)imethods.data) + _t37; @@ -45826,29 +43909,29 @@ v__ast__Type v__ast__Table_unwrap_generic_type(v__ast__Table* t, v__ast__Type ty void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Array_v__ast__Type generic_types) { v__ast__TypeSymbol* ts = v__ast__Table_sym(t, typ); - if (ts->info._typ == 452 /* v.ast.Array */) { + if (ts->info._typ == 454 /* v.ast.Array */) { v__ast__Type elem_type = (*ts->info._v__ast__Array).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(t, elem_type); int dims = 1; for (;;) { - if (!((elem_sym->info)._typ == 452 /* v.ast.Array */)) break; + if (!((elem_sym->info)._typ == 454 /* v.ast.Array */)) break; elem_type = (*elem_sym->info._v__ast__Array).elem_type; elem_sym = v__ast__Table_sym(t, elem_type); dims++; } v__ast__Table_replace_generic_type(t, elem_type, generic_types); } - else if (ts->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (ts->info._typ == 482 /* v.ast.ArrayFixed */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__ArrayFixed).elem_type, generic_types); } - else if (ts->info._typ == 481 /* v.ast.Chan */) { + else if (ts->info._typ == 483 /* v.ast.Chan */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Chan).elem_type, generic_types); } - else if (ts->info._typ == 453 /* v.ast.Map */) { + else if (ts->info._typ == 455 /* v.ast.Map */) { v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Map).key_type, generic_types); v__ast__Table_replace_generic_type(t, (*ts->info._v__ast__Map).value_type, generic_types); } - else if (ts->info._typ == 457 /* v.ast.Struct */) { + else if (ts->info._typ == 459 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*ts->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -45871,7 +43954,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Struct).generic_types = generic_types; } - else if (ts->info._typ == 475 /* v.ast.Interface */) { + else if (ts->info._typ == 477 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*ts->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -45894,7 +43977,7 @@ void v__ast__Table_replace_generic_type(v__ast__Table* t, v__ast__Type typ, Arra } (*ts->info._v__ast__Interface).generic_types = generic_types; } - else if (ts->info._typ == 476 /* v.ast.SumType */) { + else if (ts->info._typ == 478 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*ts->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -45927,13 +44010,13 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { for (int _t1 = 0; _t1 < t->type_symbols.len; ++_t1) { v__ast__TypeSymbol** typ = ((v__ast__TypeSymbol**)t->type_symbols.data) + _t1; if ((*typ)->kind == v__ast__Kind__generic_inst) { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 485) /*expected idx: 485, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast(((*typ)->info)._v__ast__GenericInst,((*typ)->info)._typ, 487) /*expected idx: 487, name: v.ast.GenericInst */ ; v__ast__TypeSymbol* parent = (*(v__ast__TypeSymbol**)/*ee elem_sym */array_get(t->type_symbols, info.parent_idx)); if (parent->kind == v__ast__Kind__placeholder) { (*typ)->kind = v__ast__Kind__placeholder; continue; } - if (parent->info._typ == 457 /* v.ast.Struct */) { + if (parent->info._typ == 459 /* v.ast.Struct */) { v__ast__Struct parent_info = (*parent->info._v__ast__Struct); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic struct, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -45984,7 +44067,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 475 /* v.ast.Interface */) { + else if (parent->info._typ == 477 /* v.ast.Interface */) { v__ast__Interface parent_info = (*parent->info._v__ast__Interface); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -46050,7 +44133,7 @@ void v__ast__Table_generic_insts_to_concrete(v__ast__Table* t) { VUNREACHABLE(); } } - else if (parent->info._typ == 476 /* v.ast.SumType */) { + else if (parent->info._typ == 478 /* v.ast.SumType */) { v__ast__SumType parent_info = (*parent->info._v__ast__SumType); if (!parent_info.is_generic) { v__util__verror(_SLIT("generic error"), str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}}))); @@ -46582,6 +44665,18 @@ v__ast__Kind v__ast__Table_type_kind(v__ast__Table* t, v__ast__Type typ) { return _t2; } +bool v__ast__Table_type_is_for_pointer_arithmetic(v__ast__Table* t, v__ast__Type typ) { + v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(t, typ); + if (typ_sym->kind == v__ast__Kind__struct_) { + bool _t1 = false; + return _t1; + } else { + bool _t2 = v__ast__Type_is_any_kind_of_pointer(typ) || v__ast__Type_is_int_valptr(typ); + return _t2; + } + return 0; +} + string v__ast__TypeSymbol_str(v__ast__TypeSymbol* t) { string _t1 = t->name; return _t1; @@ -46596,13 +44691,13 @@ VNORETURN VV_LOCAL_SYMBOL void v__ast__TypeSymbol_no_info_panic(v__ast__TypeSymb // Attr: [inline] inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 486 /* v.ast.Enum */) { + if ((t->info)._typ == 488 /* v.ast.Enum */) { v__ast__Enum _t1 = (*t->info._v__ast__Enum); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 486 /* v.ast.Enum */) { + if ((fsym->info)._typ == 488 /* v.ast.Enum */) { v__ast__Enum _t2 = (*fsym->info._v__ast__Enum); return _t2; } @@ -46614,13 +44709,13 @@ inline v__ast__Enum v__ast__TypeSymbol_enum_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 483 /* v.ast.MultiReturn */) { + if ((t->info)._typ == 485 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t1 = (*t->info._v__ast__MultiReturn); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 483 /* v.ast.MultiReturn */) { + if ((fsym->info)._typ == 485 /* v.ast.MultiReturn */) { v__ast__MultiReturn _t2 = (*fsym->info._v__ast__MultiReturn); return _t2; } @@ -46632,13 +44727,13 @@ inline v__ast__MultiReturn v__ast__TypeSymbol_mr_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 452 /* v.ast.Array */) { + if ((t->info)._typ == 454 /* v.ast.Array */) { v__ast__Array _t1 = (*t->info._v__ast__Array); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 452 /* v.ast.Array */) { + if ((fsym->info)._typ == 454 /* v.ast.Array */) { v__ast__Array _t2 = (*fsym->info._v__ast__Array); return _t2; } @@ -46650,13 +44745,13 @@ inline v__ast__Array v__ast__TypeSymbol_array_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 480 /* v.ast.ArrayFixed */) { + if ((t->info)._typ == 482 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t1 = (*t->info._v__ast__ArrayFixed); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 480 /* v.ast.ArrayFixed */) { + if ((fsym->info)._typ == 482 /* v.ast.ArrayFixed */) { v__ast__ArrayFixed _t2 = (*fsym->info._v__ast__ArrayFixed); return _t2; } @@ -46668,13 +44763,13 @@ inline v__ast__ArrayFixed v__ast__TypeSymbol_array_fixed_info(v__ast__TypeSymbol // Attr: [inline] inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 481 /* v.ast.Chan */) { + if ((t->info)._typ == 483 /* v.ast.Chan */) { v__ast__Chan _t1 = (*t->info._v__ast__Chan); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 481 /* v.ast.Chan */) { + if ((fsym->info)._typ == 483 /* v.ast.Chan */) { v__ast__Chan _t2 = (*fsym->info._v__ast__Chan); return _t2; } @@ -46686,13 +44781,13 @@ inline v__ast__Chan v__ast__TypeSymbol_chan_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 482 /* v.ast.Thread */) { + if ((t->info)._typ == 484 /* v.ast.Thread */) { v__ast__Thread _t1 = (*t->info._v__ast__Thread); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 482 /* v.ast.Thread */) { + if ((fsym->info)._typ == 484 /* v.ast.Thread */) { v__ast__Thread _t2 = (*fsym->info._v__ast__Thread); return _t2; } @@ -46704,13 +44799,13 @@ inline v__ast__Thread v__ast__TypeSymbol_thread_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 453 /* v.ast.Map */) { + if ((t->info)._typ == 455 /* v.ast.Map */) { v__ast__Map _t1 = (*t->info._v__ast__Map); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 453 /* v.ast.Map */) { + if ((fsym->info)._typ == 455 /* v.ast.Map */) { v__ast__Map _t2 = (*fsym->info._v__ast__Map); return _t2; } @@ -46722,13 +44817,13 @@ inline v__ast__Map v__ast__TypeSymbol_map_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 457 /* v.ast.Struct */) { + if ((t->info)._typ == 459 /* v.ast.Struct */) { v__ast__Struct _t1 = (*t->info._v__ast__Struct); return _t1; } - if ((t->info)._typ == 472 /* v.ast.Alias */) { + if ((t->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__Alias).parent_type); - if ((fsym->info)._typ == 457 /* v.ast.Struct */) { + if ((fsym->info)._typ == 459 /* v.ast.Struct */) { v__ast__Struct _t2 = (*fsym->info._v__ast__Struct); return _t2; } @@ -46740,13 +44835,13 @@ inline v__ast__Struct v__ast__TypeSymbol_struct_info(v__ast__TypeSymbol* t) { // Attr: [inline] inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { - if ((t->info)._typ == 476 /* v.ast.SumType */) { + if ((t->info)._typ == 478 /* v.ast.SumType */) { v__ast__SumType _t1 = (*t->info._v__ast__SumType); return _t1; } - if ((t->info)._typ == 476 /* v.ast.SumType */) { + if ((t->info)._typ == 478 /* v.ast.SumType */) { v__ast__TypeSymbol* fsym = v__ast__Table_final_sym(global_table, (*t->info._v__ast__SumType).parent_type); - if ((fsym->info)._typ == 476 /* v.ast.SumType */) { + if ((fsym->info)._typ == 478 /* v.ast.SumType */) { v__ast__SumType _t2 = (*fsym->info._v__ast__SumType); return _t2; } @@ -46758,7 +44853,7 @@ inline v__ast__SumType v__ast__TypeSymbol_sumtype_info(v__ast__TypeSymbol* t) { bool v__ast__TypeSymbol_is_heap(v__ast__TypeSymbol* t) { if (t->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((t->info)._v__ast__Struct,(t->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((t->info)._v__ast__Struct,(t->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; bool _t1 = info.is_heap; return _t1; } else { @@ -46812,7 +44907,7 @@ inline bool v__ast__TypeSymbol_is_pointer(v__ast__TypeSymbol* t) { inline bool v__ast__TypeSymbol_is_int(v__ast__TypeSymbol* t) { bool res = (t->kind == v__ast__Kind__i8 || t->kind == v__ast__Kind__i16 || t->kind == v__ast__Kind__int || t->kind == v__ast__Kind__i64 || t->kind == v__ast__Kind__isize || t->kind == v__ast__Kind__u8 || t->kind == v__ast__Kind__u16 || t->kind == v__ast__Kind__u32 || t->kind == v__ast__Kind__u64 || t->kind == v__ast__Kind__usize || t->kind == v__ast__Kind__int_literal || t->kind == v__ast__Kind__rune); if (!res && t->kind == v__ast__Kind__alias) { - bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + bool _t1 = v__ast__Type_is_number((/* as */ *(v__ast__Alias*)__as_cast((t->info)._v__ast__Alias,(t->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); return _t1; } bool _t2 = res; @@ -46922,9 +45017,9 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__alias: { - multi_return_int_int mr_21154 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); - size = mr_21154.arg0; - align = mr_21154.arg1; + multi_return_int_int mr_21365 = v__ast__Table_type_size(t, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); + size = mr_21365.arg0; + align = mr_21365.arg1; break; } case v__ast__Kind__struct_: @@ -46934,7 +45029,7 @@ multi_return_int_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 _t4; /* if prepend */ - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { Array_v__ast__Type _t5 = {0}; Array_v__ast__StructField _t5_orig = (*sym->info._v__ast__Struct).fields; int _t5_len = _t5_orig.len; @@ -46947,14 +45042,14 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } _t4 =_t5; } else { - _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ).types; + _t4 = (/* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ).types; } 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_21465 = v__ast__Table_type_size(t, ftyp); - int field_size = mr_21465.arg0; - int alignment = mr_21465.arg1; + multi_return_int_int mr_21676 = v__ast__Table_type_size(t, ftyp); + int field_size = mr_21676.arg0; + int alignment = mr_21676.arg1; if (alignment > max_alignment) { max_alignment = alignment; } @@ -46968,21 +45063,21 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) case v__ast__Kind__interface_: case v__ast__Kind__aggregate: { - if (sym->info._typ == 476 /* v.ast.SumType */) { + if (sym->info._typ == 478 /* v.ast.SumType */) { size = ((*sym->info._v__ast__SumType).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 470 /* v.ast.Aggregate */) { + else if (sym->info._typ == 472 /* v.ast.Aggregate */) { size = ((*sym->info._v__ast__Aggregate).fields.len + 2) * t->pointer_size; align = t->pointer_size; } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { size = ((*sym->info._v__ast__Interface).fields.len + 2) * t->pointer_size; align = t->pointer_size; for (int _t8 = 0; _t8 < (*sym->info._v__ast__Interface).embeds.len; ++_t8) { v__ast__Type etyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).embeds.data)[_t8]; - multi_return_int_int mr_22026 = v__ast__Table_type_size(t, etyp); - int esize = mr_22026.arg0; + multi_return_int_int mr_22237 = v__ast__Table_type_size(t, etyp); + int esize = mr_22237.arg0; size += esize - 2 * t->pointer_size; } } @@ -46994,10 +45089,10 @@ multi_return_int_int v__ast__Table_type_size(v__ast__Table* t, v__ast__Type typ) } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; - multi_return_int_int mr_22223 = v__ast__Table_type_size(t, info.elem_type); - int elem_size = mr_22223.arg0; - int elem_align = mr_22223.arg1; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + multi_return_int_int mr_22434 = v__ast__Table_type_size(t, info.elem_type); + int elem_size = mr_22434.arg0; + int elem_align = mr_22434.arg1; size = info.size * elem_size; align = elem_align; break; @@ -47244,7 +45339,8 @@ string Array_v__ast__Kind_str(Array_v__ast__Kind kinds) { } string v__ast__Table_type_to_str(v__ast__Table* t, v__ast__Type typ) { - string _t1 = v__ast__Table_type_to_str_using_aliases(t, typ, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string _t1 = v__ast__Table_type_to_str_using_aliases(t, typ, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); return _t1; } @@ -47255,7 +45351,8 @@ string v__ast__Table_type_to_code(v__ast__Table* mytable, v__ast__Type t) { return _t1; } else { - string _t2 = v__ast__Table_type_to_str_using_aliases(mytable, t, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string _t2 = v__ast__Table_type_to_str_using_aliases(mytable, t, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); return _t2; }; return (string){.str=(byteptr)"", .is_lit=1}; @@ -47309,7 +45406,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { res = v__ast__Table_type_to_str_using_aliases(t, v__ast__Table_value_type(t, typ), import_aliases); } else { - if ((sym->info)._typ == 452 /* v.ast.Array */) { + if ((sym->info)._typ == 454 /* v.ast.Array */) { string elem_str = v__ast__Table_type_to_str_using_aliases(t, (*sym->info._v__ast__Array).elem_type, import_aliases); res = str_intp(2, _MOV((StrIntpData[]){{_SLIT("[]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { @@ -47320,9 +45417,9 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; string elem_str = v__ast__Table_type_to_str_using_aliases(t, info.elem_type, import_aliases); - if ((info.size_expr)._typ == 303 /* v.ast.EmptyExpr */) { + if ((info.size_expr)._typ == 305 /* v.ast.EmptyExpr */) { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); } else { res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("["), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(info.size_expr)}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = elem_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -47332,7 +45429,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__chan: { if (!string__eq(sym->mod, _SLIT("builtin")) && !string__eq(sym->name, _SLIT("chan"))) { - v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 481) /*expected idx: 481, name: v.ast.Chan */ ; + v__ast__Chan info = /* as */ *(v__ast__Chan*)__as_cast((sym->info)._v__ast__Chan,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ; v__ast__Type elem_type = info.elem_type; string mut_str = _SLIT(""); if (info.is_mut) { @@ -47346,7 +45443,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__function: { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; if (!t->is_fmt) { res = v__ast__Table_fn_signature(t, (voidptr)&/*qq*/info.func, ((v__ast__FnSignatureOpts){.skip_receiver = 0,.type_only = true,})); } else { @@ -47375,7 +45472,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty string _t4 = _SLIT("map"); return _t4; } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; string key_str = v__ast__Table_type_to_str_using_aliases(t, info.key_type, import_aliases); string val_str = v__ast__Table_type_to_str_using_aliases(t, info.value_type, import_aliases); res = str_intp(3, _MOV((StrIntpData[]){{_SLIT("map["), /*115 &string*/0xfe10, {.d_s = key_str}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = val_str}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -47384,7 +45481,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__multi_return: { res = _SLIT("("); - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; for (int i = 0; i < info.types.len; ++i) { v__ast__Type typ2 = ((v__ast__Type*)info.types.data)[i]; if (i > 0) { @@ -47400,7 +45497,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty case v__ast__Kind__sum_type: { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Struct).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Struct).generic_types.data)[i]; @@ -47411,7 +45508,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__Interface).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__Interface).generic_types.data)[i]; @@ -47422,7 +45519,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } res = /*f*/string__plus(res, _SLIT(">")); } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < (*sym->info._v__ast__SumType).generic_types.len; ++i) { v__ast__Type gtyp = ((v__ast__Type*)(*sym->info._v__ast__SumType).generic_types.data)[i]; @@ -47437,7 +45534,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty else { } ; - } else if ((sym->info)._typ == 476 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ).is_anon) { + } else if ((sym->info)._typ == 478 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).is_anon) { Array_string _t5 = {0}; Array_v__ast__Type _t5_orig = (*sym->info._v__ast__SumType).variants; int _t5_len = _t5_orig.len; @@ -47457,7 +45554,7 @@ string v__ast__Table_type_to_str_using_aliases(v__ast__Table* t, v__ast__Type ty } case v__ast__Kind__generic_inst: { - v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.GenericInst */ ; + v__ast__GenericInst info = /* as */ *(v__ast__GenericInst*)__as_cast((sym->info)._v__ast__GenericInst,(sym->info)._typ, 487) /*expected idx: 487, name: v.ast.GenericInst */ ; res = v__ast__Table_shorten_user_defined_typenames(t, string_all_before(sym->name, _SLIT("<")), import_aliases); res = /*f*/string__plus(res, _SLIT("<")); for (int i = 0; i < info.concrete_types.len; ++i) { @@ -47566,7 +45663,8 @@ VV_LOCAL_SYMBOL string v__ast__Table_shorten_user_defined_typenames(v__ast__Tabl } string v__ast__Table_fn_signature(v__ast__Table* t, v__ast__Fn* func, v__ast__FnSignatureOpts opts) { - string _t1 = v__ast__Table_fn_signature_using_aliases(t, func, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string), opts); + string _t1 = v__ast__Table_fn_signature_using_aliases(t, func, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + , opts); return _t1; } @@ -47679,13 +45777,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty return _t2; } v__ast__Table* table = global_table; - if (t->info._typ == 457 /* v.ast.Struct */) { + if (t->info._typ == 459 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*t->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Struct).parent_type); _option_v__ast__Fn _t3; if (_t3 = v__ast__TypeSymbol_find_method(parent_sym, name), _t3.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t3.data; - if (parent_sym->info._typ == 457 /* v.ast.Struct */) { + if (parent_sym->info._typ == 459 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -47721,7 +45819,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t9), sizeof(v__ast__Fn)); return _t9; } - else if (parent_sym->info._typ == 475 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t10 = {0}; Array_v__ast__Type _t10_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -47757,7 +45855,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t15), sizeof(v__ast__Fn)); return _t15; } - else if (parent_sym->info._typ == 476 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t16 = {0}; Array_v__ast__Type _t16_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -47800,13 +45898,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 475 /* v.ast.Interface */) { + else if (t->info._typ == 477 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*t->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__Interface).parent_type); _option_v__ast__Fn _t22; if (_t22 = v__ast__TypeSymbol_find_method(parent_sym, name), _t22.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t22.data; - if (parent_sym->info._typ == 457 /* v.ast.Struct */) { + if (parent_sym->info._typ == 459 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t23 = {0}; Array_v__ast__Type _t23_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -47842,7 +45940,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t28), sizeof(v__ast__Fn)); return _t28; } - else if (parent_sym->info._typ == 475 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t29 = {0}; Array_v__ast__Type _t29_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -47878,7 +45976,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t34), sizeof(v__ast__Fn)); return _t34; } - else if (parent_sym->info._typ == 476 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t35 = {0}; Array_v__ast__Type _t35_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -47921,13 +46019,13 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty } } } - else if (t->info._typ == 476 /* v.ast.SumType */) { + else if (t->info._typ == 478 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*t->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(table, (*t->info._v__ast__SumType).parent_type); _option_v__ast__Fn _t41; if (_t41 = v__ast__TypeSymbol_find_method(parent_sym, name), _t41.state == 0) { v__ast__Fn x = *(v__ast__Fn*)_t41.data; - if (parent_sym->info._typ == 457 /* v.ast.Struct */) { + if (parent_sym->info._typ == 459 /* v.ast.Struct */) { v__ast__Fn method = x; Array_string _t42 = {0}; Array_v__ast__Type _t42_orig = (*parent_sym->info._v__ast__Struct).generic_types; @@ -47963,7 +46061,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t47), sizeof(v__ast__Fn)); return _t47; } - else if (parent_sym->info._typ == 475 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { v__ast__Fn method = x; Array_string _t48 = {0}; Array_v__ast__Type _t48_orig = (*parent_sym->info._v__ast__Interface).generic_types; @@ -47999,7 +46097,7 @@ _option_v__ast__Fn v__ast__TypeSymbol_find_method_with_generic_parent(v__ast__Ty opt_ok2(&(v__ast__Fn[]) { method }, (_option*)(&_t53), sizeof(v__ast__Fn)); return _t53; } - else if (parent_sym->info._typ == 476 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { v__ast__Fn method = x; Array_string _t54 = {0}; Array_v__ast__Type _t54_orig = (*parent_sym->info._v__ast__SumType).generic_types; @@ -48063,7 +46161,7 @@ bool v__ast__TypeSymbol_is_js_compatible(v__ast__TypeSymbol* t) { bool _t3 = true; return _t3; } - if (t->info._typ == 476 /* v.ast.SumType */) { + if (t->info._typ == 478 /* v.ast.SumType */) { for (int _t4 = 0; _t4 < (*t->info._v__ast__SumType).variants.len; ++_t4) { v__ast__Type variant = ((v__ast__Type*)(*t->info._v__ast__SumType).variants.data)[_t4]; v__ast__TypeSymbol* sym = v__ast__Table_final_sym(table, variant); @@ -48101,19 +46199,19 @@ multi_return_bool_bool_int v__ast__TypeSymbol_str_method_info(v__ast__TypeSymbol } _option_v__ast__StructField v__ast__TypeSymbol_find_field(v__ast__TypeSymbol* t, string name) { - if (t->info._typ == 470 /* v.ast.Aggregate */) { + if (t->info._typ == 472 /* v.ast.Aggregate */) { _option_v__ast__StructField _t1 = v__ast__Aggregate_find_field(&(*t->info._v__ast__Aggregate), name); return _t1; } - else if (t->info._typ == 457 /* v.ast.Struct */) { + else if (t->info._typ == 459 /* v.ast.Struct */) { _option_v__ast__StructField _t2 = v__ast__Struct_find_field(&(*t->info._v__ast__Struct), name); return _t2; } - else if (t->info._typ == 475 /* v.ast.Interface */) { + else if (t->info._typ == 477 /* v.ast.Interface */) { _option_v__ast__StructField _t3 = v__ast__Interface_find_field(&(*t->info._v__ast__Interface), name); return _t3; } - else if (t->info._typ == 476 /* v.ast.SumType */) { + else if (t->info._typ == 478 /* v.ast.SumType */) { _option_v__ast__StructField _t4 = v__ast__SumType_find_field(&(*t->info._v__ast__SumType), name); return _t4; } @@ -48239,8 +46337,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__ast__Type right_type0 = _const_v__ast__void_type; for (int i = 0; i < node->right.len; ++i) { v__ast__Expr* right = ((v__ast__Expr*)node->right.data) + i; - if ((right)->_typ == 293 /* v.ast.CallExpr */ || (right)->_typ == 308 /* v.ast.IfExpr */ || (right)->_typ == 315 /* v.ast.LockExpr */ || (right)->_typ == 317 /* v.ast.MatchExpr */) { - if (((right)->_typ == 308 /* v.ast.IfExpr */ || (right)->_typ == 317 /* v.ast.MatchExpr */) && node->left.len == node->right.len && !is_decl && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 307 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 327 /* v.ast.SelectorExpr */) && !v__ast__Expr_is_blank_ident((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))) { + if ((right)->_typ == 295 /* v.ast.CallExpr */ || (right)->_typ == 310 /* v.ast.IfExpr */ || (right)->_typ == 317 /* v.ast.LockExpr */ || (right)->_typ == 319 /* v.ast.MatchExpr */) { + if (((right)->_typ == 310 /* v.ast.IfExpr */ || (right)->_typ == 319 /* v.ast.MatchExpr */) && node->left.len == node->right.len && !is_decl && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 309 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))._typ == 329 /* v.ast.SelectorExpr */) && !v__ast__Expr_is_blank_ident((*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i)))) { c->expected_type = v__checker__Checker_expr(c, (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, i))); } v__ast__Type right_type = v__checker__Checker_expr(c, *right); @@ -48260,22 +46358,22 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; right_len = 0; } } - if ((right)->_typ == 311 /* v.ast.InfixExpr */) { + if ((right)->_typ == 313 /* v.ast.InfixExpr */) { if ((*right->_v__ast__InfixExpr).op == v__token__Kind__arrow) { v__checker__Checker_error(c, _SLIT("cannot use `<-` on the right-hand side of an assignment, as it does not return any values"), (*right->_v__ast__InfixExpr).pos); } } - if ((right)->_typ == 307 /* v.ast.Ident */) { + if ((right)->_typ == 309 /* v.ast.Ident */) { if ((*right->_v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("unexpected `mut` on right-hand side of assignment"), (*right->_v__ast__Ident).mut_pos); } } - if ((right)->_typ == 319 /* v.ast.None */) { + if ((right)->_typ == 321 /* v.ast.None */) { v__checker__Checker_error(c, _SLIT("you can not assign a `none` value to a variable"), (*right->_v__ast__None).pos); } } if (node->left.len != right_len) { - if ((right_first)._typ == 293 /* v.ast.CallExpr */) { + if ((right_first)._typ == 295 /* v.ast.CallExpr */) { if (node->left_types.len > 0 && v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, 0)), _const_v__ast__void_type)) { // Defer begin if (v__checker__Checker_assign_stmt_defer_0) { @@ -48297,21 +46395,21 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } for (int i = 0; i < node->left.len; ++i) { v__ast__Expr* left = ((v__ast__Expr*)node->left.data) + i; - if ((left)->_typ == 293 /* v.ast.CallExpr */) { + if ((left)->_typ == 295 /* v.ast.CallExpr */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot call function `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__CallExpr).name}}, {_SLIT("()` on the left side of an assignment"), 0, { .d_c = 0 }}})), (*left->_v__ast__CallExpr).pos); - } else if ((left)->_typ == 324 /* v.ast.PrefixExpr */) { - if (((*left->_v__ast__PrefixExpr).right)._typ == 293 /* v.ast.CallExpr */ && (*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { + } else if ((left)->_typ == 326 /* v.ast.PrefixExpr */) { + if (((*left->_v__ast__PrefixExpr).right)._typ == 295 /* v.ast.CallExpr */ && (*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { v__checker__Checker_error(c, _SLIT("cannot dereference a function call on the left side of an assignment, use a temporary variable"), (*left->_v__ast__PrefixExpr).pos); } - } else if ((left)->_typ == 310 /* v.ast.IndexExpr */) { - if (((*left->_v__ast__IndexExpr).index)._typ == 325 /* v.ast.RangeExpr */) { + } else if ((left)->_typ == 312 /* v.ast.IndexExpr */) { + if (((*left->_v__ast__IndexExpr).index)._typ == 327 /* v.ast.RangeExpr */) { v__checker__Checker_error(c, _SLIT("cannot reassign using range expression on the left side of an assignment"), (*left->_v__ast__IndexExpr).pos); } } bool is_blank_ident = v__ast__Expr_is_blank_ident(/*rec*/*left); v__ast__Type left_type = _const_v__ast__void_type; if (!is_decl && !is_blank_ident) { - if ((left)->_typ == 307 /* v.ast.Ident */ || (left)->_typ == 327 /* v.ast.SelectorExpr */) { + if ((left)->_typ == 309 /* v.ast.Ident */ || (left)->_typ == 329 /* v.ast.SelectorExpr */) { c->prevent_sum_type_unwrapping_once = true; } left_type = v__checker__Checker_expr(c, *left); @@ -48319,8 +46417,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } if (node->right_types.len < node->left.len) { bool old_inside_ref_lit = c->inside_ref_lit; - if ((left)->_typ == 307 /* v.ast.Ident */) { - if (((*left->_v__ast__Ident).info)._typ == 417 /* v.ast.IdentVar */) { + if ((left)->_typ == 309 /* v.ast.Ident */) { + if (((*left->_v__ast__Ident).info)._typ == 419 /* v.ast.IdentVar */) { c->inside_ref_lit = c->inside_ref_lit || (*(*left->_v__ast__Ident).info._v__ast__IdentVar).share == v__ast__ShareType__shared_t; } } @@ -48334,9 +46432,9 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } v__ast__Expr right = (i < node->right.len ? ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, i))) : ((*(v__ast__Expr*)/*ee elem_sym */array_get(node->right, 0)))); v__ast__Type right_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->right_types, i)); - if ((right)._typ == 307 /* v.ast.Ident */) { + if ((right)._typ == 309 /* v.ast.Ident */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); - if ((right_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((right_sym->info)._typ == 459 /* v.ast.Struct */) { if ((*right_sym->info._v__ast__Struct).generic_types.len > 0) { _option_v__ast__ScopeObject _t2; if (_t2 = v__ast__Scope_find((*right._v__ast__Ident).scope, (*right._v__ast__Ident).name), _t2.state == 0) { @@ -48345,17 +46443,17 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - } else if ((right)._typ == 299 /* v.ast.ComptimeSelector */) { + } else if ((right)._typ == 301 /* v.ast.ComptimeSelector */) { right_type = c->comptime_fields_default_type; } if (is_decl) { - if ((right)._typ == 332 /* v.ast.StructInit */) { + if ((right)._typ == 334 /* v.ast.StructInit */) { if (v__ast__Type_has_flag((*right._v__ast__StructInit).typ, v__ast__TypeFlag__generic)) { v__checker__Checker_expr(c, right); right_type = (*right._v__ast__StructInit).typ; } - } else if ((right)._typ == 324 /* v.ast.PrefixExpr */) { - if ((*right._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*right._v__ast__PrefixExpr).right)._typ == 332 /* v.ast.StructInit */) { + } else if ((right)._typ == 326 /* v.ast.PrefixExpr */) { + if ((*right._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*right._v__ast__PrefixExpr).right)._typ == 334 /* v.ast.StructInit */) { right_type = v__checker__Checker_expr(c, right); } } @@ -48365,7 +46463,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; left_type = v__ast__mktyp(right_type); } if (v__ast__Type_alias_eq(left_type, _const_v__ast__int_type)) { - if ((right)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((right)._typ == 314 /* v.ast.IntegerLiteral */) { bool is_large = (*right._v__ast__IntegerLiteral).val.len > 13; if (!is_large && (*right._v__ast__IntegerLiteral).val.len > 8) { i64 val = string_i64((*right._v__ast__IntegerLiteral).val); @@ -48380,8 +46478,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_fail_if_immutable(c, *left); } if (v__ast__Type_is_ptr(right_type) && v__ast__Type_is_ptr(left_type)) { - if ((right)._typ == 307 /* v.ast.Ident */) { - if (((*right._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((right)._typ == 309 /* v.ast.Ident */) { + if (((*right._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Var* obj = &(*(*right._v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t3 = v__ast__Scope_find_var(c->fn_scope, (*(*right._v__ast__Ident).obj._v__ast__Var).name); @@ -48402,21 +46500,21 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - if (!is_decl && (left)->_typ == 307 /* v.ast.Ident */ && !is_blank_ident && !v__ast__Type_is_real_pointer(left_type) && v__ast__Type_is_real_pointer(right_type) && !v__ast__Type_has_flag(right_type, v__ast__TypeFlag__shared_f)) { + if (!is_decl && (left)->_typ == 309 /* v.ast.Ident */ && !is_blank_ident && !v__ast__Type_is_real_pointer(left_type) && v__ast__Type_is_real_pointer(right_type) && !v__ast__Type_has_flag(right_type, v__ast__TypeFlag__shared_f)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); if (left_sym->kind != v__ast__Kind__function) { v__checker__Checker_warn(c, string__plus( str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot assign a reference to a value (this will be an error soon) left="), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_str(c->table, left_type)}}, {_SLIT(" "), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_ptr(left_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" "), 0, { .d_c = 0 }}})), str_intp(4, _MOV((StrIntpData[]){{_SLIT("right="), /*115 &string*/0xfe10, {.d_s = v__ast__Table_type_str(c->table, right_type)}}, {_SLIT(" "), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_real_pointer(right_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT(" ptr="), /*115 &bool*/0xfe10, {.d_s = v__ast__Type_is_ptr(right_type) ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))), node->pos); } } array_push((array*)&node->left_types, _MOV((v__ast__Type[]){ left_type })); - if (left->_typ == 307 /* v.ast.Ident */) { + if (left->_typ == 309 /* v.ast.Ident */) { if ((*left->_v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { left_type = right_type; array_set(&node->left_types, i, &(v__ast__Type[]) { right_type }); if (!(node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign)) { v__checker__Checker_error(c, _SLIT("cannot modify blank `_` identifier"), (*left->_v__ast__Ident).pos); } - } else if (((*left->_v__ast__Ident).info)._typ != 417 /* v.ast.IdentVar */) { + } else if (((*left->_v__ast__Ident).info)._typ != 419 /* v.ast.IdentVar */) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot assign to "), /*115 &v.ast.IdentKind*/0xfe10, {.d_s = v__ast__IdentKind_str((*left->_v__ast__Ident).kind)}}, {_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } else { if (is_decl) { @@ -48425,7 +46523,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid use of reserved type `"), /*115 &string*/0xfe10, {.d_s = (*left->_v__ast__Ident).name}}, {_SLIT("` as a variable name"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } } - v__ast__IdentVar ident_var_info = /* as */ *(v__ast__IdentVar*)__as_cast(((*left->_v__ast__Ident).info)._v__ast__IdentVar,((*left->_v__ast__Ident).info)._typ, 417) /*expected idx: 417, name: v.ast.IdentVar */ ; + v__ast__IdentVar ident_var_info = /* as */ *(v__ast__IdentVar*)__as_cast(((*left->_v__ast__Ident).info)._v__ast__IdentVar,((*left->_v__ast__Ident).info)._typ, 419) /*expected idx: 419, name: v.ast.IdentVar */ ; if (ident_var_info.share == v__ast__ShareType__shared_t) { left_type = v__ast__Type_set_flag(left_type, v__ast__TypeFlag__shared_f); if (is_decl) { @@ -48435,7 +46533,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; left_type = v__ast__Type_set_nr_muls(left_type, 1); } } else if (v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f)) { - left_type = v__ast__Type_clear_flag(left_type, v__ast__TypeFlag__shared_f); + left_type = v__ast__Type_deref(v__ast__Type_clear_flag(left_type, v__ast__TypeFlag__shared_f)); } if (ident_var_info.share == v__ast__ShareType__atomic_t) { left_type = v__ast__Type_set_flag(left_type, v__ast__TypeFlag__atomic_f); @@ -48444,7 +46542,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; ident_var_info.typ = left_type; (*left->_v__ast__Ident).info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(&ident_var_info); if (left_type != 0) { - if ((*left->_v__ast__Ident).obj._typ == 365 /* v.ast.Var */) { + if ((*left->_v__ast__Ident).obj._typ == 367 /* v.ast.Var */) { (*(*left->_v__ast__Ident).obj._v__ast__Var).typ = left_type; if ((*(*left->_v__ast__Ident).obj._v__ast__Var).is_auto_deref) { (*(*left->_v__ast__Ident).obj._v__ast__Var).is_used = true; @@ -48455,14 +46553,14 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } if (Array_int_contains(_const_v__ast__unsigned_integer_type_idxs, left_type)) { - if ((right)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((right)._typ == 314 /* v.ast.IntegerLiteral */) { if (string_at((*right._v__ast__IntegerLiteral).val, 0) == '-') { v__checker__Checker_error(c, _SLIT("Cannot assign negative value to unsigned integer type"), (*right._v__ast__IntegerLiteral).pos); } } } } - else if ((*left->_v__ast__Ident).obj._typ == 364 /* v.ast.GlobalField */) { + else if ((*left->_v__ast__Ident).obj._typ == 366 /* v.ast.GlobalField */) { (*(*left->_v__ast__Ident).obj._v__ast__GlobalField).typ = left_type; } @@ -48475,19 +46573,19 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; _option_v__ast__ScopeObject _t5; if (_t5 = v__ast__Scope_find(c->file->global_scope, full_name), _t5.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t5.data; - if ((obj)._typ == 363 /* v.ast.ConstField */) { + if ((obj)._typ == 365 /* v.ast.ConstField */) { v__checker__Checker_warn(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate of a const name `"), /*115 &string*/0xfe10, {.d_s = full_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*left->_v__ast__Ident).pos); } } } } } - else if (left->_typ == 324 /* v.ast.PrefixExpr */) { + else if (left->_typ == 326 /* v.ast.PrefixExpr */) { if ((*left->_v__ast__PrefixExpr).op == v__token__Kind__mul) { if (!c->inside_unsafe && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("modifying variables via dereferencing can only be done in `unsafe` blocks"), node->pos); - } else if (((*left->_v__ast__PrefixExpr).right)._typ == 307 /* v.ast.Ident */) { - if (((*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + } else if (((*left->_v__ast__PrefixExpr).right)._typ == 309 /* v.ast.Ident */) { + if (((*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { (*(*(*left->_v__ast__PrefixExpr).right._v__ast__Ident).obj._v__ast__Var).is_used = true; } } @@ -48496,8 +46594,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_error(c, _SLIT("non-name on the left side of `:=`"), (*left->_v__ast__PrefixExpr).pos); } } - else if (left->_typ == 327 /* v.ast.SelectorExpr */) { - if (((*left->_v__ast__SelectorExpr).expr)._typ == 310 /* v.ast.IndexExpr */) { + else if (left->_typ == 329 /* v.ast.SelectorExpr */) { + if (((*left->_v__ast__SelectorExpr).expr)._typ == 312 /* v.ast.IndexExpr */) { if ((*(*left->_v__ast__SelectorExpr).expr._v__ast__IndexExpr).is_map) { (*(*left->_v__ast__SelectorExpr).expr._v__ast__IndexExpr).is_setter = true; } @@ -48505,7 +46603,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } else { - if ((left)->_typ == 310 /* v.ast.IndexExpr */) { + if ((left)->_typ == 312 /* v.ast.IndexExpr */) { if ((*left->_v__ast__IndexExpr).is_map && (*left->_v__ast__IndexExpr).is_setter) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*left->_v__ast__IndexExpr), true); } @@ -48528,26 +46626,26 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type_unwrapped); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type_unwrapped); - if (left_sym->kind == v__ast__Kind__array && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array && (left)->_typ == 307 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 307 /* v.ast.Ident */) { + if (left_sym->kind == v__ast__Kind__array && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array && (left)->_typ == 309 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 309 /* v.ast.Ident */) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("use `array2 "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" array1.clone()` instead of `array2 "), /*115 &string*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT(" array1` (or use `unsafe`)"), 0, { .d_c = 0 }}})), node->pos); } if (left_sym->kind == v__ast__Kind__array && right_sym->kind == v__ast__Kind__array) { - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type left_elem_type = v__ast__Table_unaliased_type(c->table, left_info.elem_type); - v__ast__Array right_info = /* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array right_info = /* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type right_elem_type = v__ast__Table_unaliased_type(c->table, right_info.elem_type); if (v__ast__Type_nr_muls(left_type_unwrapped) == v__ast__Type_nr_muls(right_type_unwrapped) && left_info.nr_dims == right_info.nr_dims && v__ast__Type_alias_eq(left_elem_type, right_elem_type)) { continue; } } - if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 307 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 307 /* v.ast.Ident */) { - if ((right_sym->info)._typ == 480 /* v.ast.ArrayFixed */) { + if (left_sym->kind == v__ast__Kind__array_fixed && !c->inside_unsafe && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__array_fixed && (left)->_typ == 309 /* v.ast.Ident */ && !v__ast__Expr_is_blank_ident(/*rec*/*left) && (right)._typ == 309 /* v.ast.Ident */) { + if ((right_sym->info)._typ == 482 /* v.ast.ArrayFixed */) { if (v__ast__Type_is_ptr((*right_sym->info._v__ast__ArrayFixed).elem_type)) { v__checker__Checker_error(c, _SLIT("assignment from one fixed array to another with a pointer element type is prohibited outside of `unsafe`"), node->pos); } } } - if (left_sym->kind == v__ast__Kind__map && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__map && !v__ast__Expr_is_blank_ident(/*rec*/*left) && v__ast__Expr_is_lvalue(right) && (!v__ast__Type_is_ptr(right_type) || ((right)._typ == 307 /* v.ast.Ident */ && v__ast__Expr_is_auto_deref_var(right)))) { + if (left_sym->kind == v__ast__Kind__map && (node->op == v__token__Kind__assign || node->op == v__token__Kind__decl_assign) && right_sym->kind == v__ast__Kind__map && !v__ast__Expr_is_blank_ident(/*rec*/*left) && v__ast__Expr_is_lvalue(right) && (!v__ast__Type_is_ptr(right_type) || ((right)._typ == 309 /* v.ast.Ident */ && v__ast__Expr_is_auto_deref_var(right)))) { v__checker__Checker_error(c, _SLIT("cannot copy map: call `move` or `clone` method (or use a reference)"), v__ast__Expr_pos(right)); } bool left_is_ptr = v__ast__Type_is_ptr(left_type) || v__ast__TypeSymbol_is_pointer(left_sym); @@ -48559,7 +46657,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; if (!right_is_ptr && node->op == v__token__Kind__assign && v__ast__Type_is_number(right_type_unwrapped)) { v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot assign to `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(*left)}}, {_SLIT("`: "), 0, { .d_c = 0 }}})), v__checker__Checker_expected_msg(c, right_type_unwrapped, left_type_unwrapped)), v__ast__Expr_pos(right)); } - if (!v__ast__TypeSymbol_is_number(right_sym) && !v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f) && ((right)._typ == 332 /* v.ast.StructInit */ || !right_is_ptr)) { + if (!v__ast__TypeSymbol_is_number(right_sym) && !v__ast__Type_has_flag(left_type, v__ast__TypeFlag__shared_f) && ((right)._typ == 334 /* v.ast.StructInit */ || !right_is_ptr)) { string left_name = v__ast__Table_type_to_str(c->table, left_type_unwrapped); v__ast__Type rtype = right_type_unwrapped; if (v__ast__Type_is_ptr(rtype)) { @@ -48674,7 +46772,7 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; else { _t7 = _SLIT("unknown op"); }string extracted_op = _t7; - if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).generic_types.len > 0) { + if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { continue; } _option_v__ast__Fn _t8; @@ -48719,13 +46817,13 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; } } } - if ((right_first)._typ == 324 /* v.ast.PrefixExpr */) { + if ((right_first)._typ == 326 /* v.ast.PrefixExpr */) { v__ast__PrefixExpr right_node = (*right_first._v__ast__PrefixExpr); v__ast__Expr left_first = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->left, 0)); - if ((left_first)._typ == 307 /* v.ast.Ident */) { + if ((left_first)._typ == 309 /* v.ast.Ident */) { v__ast__Ident assigned_var = (*left_first._v__ast__Ident); bool is_shared = false; - if (((*left_first._v__ast__Ident).info)._typ == 417 /* v.ast.IdentVar */) { + if (((*left_first._v__ast__Ident).info)._typ == 419 /* v.ast.IdentVar */) { is_shared = (*(*left_first._v__ast__Ident).info._v__ast__IdentVar).share == v__ast__ShareType__shared_t; } bool old_inside_ref_lit = c->inside_ref_lit; @@ -48733,8 +46831,8 @@ bool v__checker__Checker_assign_stmt_defer_0 = false; v__checker__Checker_expr(c, right_node.right); c->inside_ref_lit = old_inside_ref_lit; if (right_node.op == v__token__Kind__amp) { - if ((right_node.right)._typ == 307 /* v.ast.Ident */) { - if (((*right_node.right._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((right_node.right)._typ == 309 /* v.ast.Ident */) { + if (((*right_node.right._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Var v = (*(*right_node.right._v__ast__Ident).obj._v__ast__Var); right_type0 = v.typ; } @@ -48805,16 +46903,16 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v 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__array && expected_sym->kind == v__ast__Kind__array) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((expected_sym->info)._v__ast__Array,(expected_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type)) { bool _t8 = true; return _t8; } } else if (got_sym->kind == v__ast__Kind__array_fixed && expected_sym->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t9 = true; return _t9; } - if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__checker__Checker_check_types(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((got_sym->info)._v__ast__ArrayFixed,(got_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type, (/* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { bool _t10 = true; return _t10; } @@ -48834,8 +46932,8 @@ bool v__checker__Checker_check_types(v__checker__Checker* c, v__ast__Type got, v bool _t13 = true; return _t13; } else if (got_sym->kind == v__ast__Kind__array) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; - v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((expected_sym->info)._v__ast__ArrayFixed,(expected_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__Array info2 = /* as */ *(v__ast__Array*)__as_cast((got_sym->info)._v__ast__Array,(got_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; if (v__checker__Checker_check_types(c, info.elem_type, info2.elem_type)) { bool _t14 = true; return _t14; @@ -48939,7 +47037,7 @@ _option_void v__checker__Checker_check_expected_call_arg(v__checker__Checker* c, v__ast__Type expected = expected_; if (v__ast__Type_has_flag(expected, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* exp_type_sym = v__ast__Table_sym(c->table, expected_); - v__ast__Array exp_info = /* as */ *(v__ast__Array*)__as_cast((exp_type_sym->info)._v__ast__Array,(exp_type_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array exp_info = /* as */ *(v__ast__Array*)__as_cast((exp_type_sym->info)._v__ast__Array,(exp_type_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; expected = exp_info.elem_type; } if (language == v__ast__Language__c) { @@ -49108,8 +47206,8 @@ bool v__checker__Checker_check_basic(v__checker__Checker* c, v__ast__Type got, v } bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, v__ast__TypeSymbol* got_type_sym, v__ast__TypeSymbol* exp_type_sym) { - v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; - v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType got_info = /* as */ *(v__ast__FnType*)__as_cast((got_type_sym->info)._v__ast__FnType,(got_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + v__ast__FnType exp_info = /* as */ *(v__ast__FnType*)__as_cast((exp_type_sym->info)._v__ast__FnType,(exp_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; v__ast__Fn got_fn = got_info.func; v__ast__Fn exp_fn = exp_info.func; if (got_fn.params.len != exp_fn.params.len) { @@ -49150,7 +47248,7 @@ bool v__checker__Checker_check_matching_function_symbols(v__checker__Checker* c, VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker* c, v__ast__InfixExpr* node, v__ast__Type left_type, v__ast__Type right_type) { if (!v__ast__Type_is_int(left_type)) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, left_type); - if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type)) { + if (left_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)) { v__ast__Type _t1 = left_type; return _t1; } @@ -49193,7 +47291,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_check_shift(v__checker__Checker v__checker__Checker_note(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("shifting a value from a signed type `"), /*115 &string*/0xfe10, {.d_s = left_sym_final->name}}, {_SLIT("` can change the sign"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->left)); } if (node->ct_right_value_evaled) { - if ((node->ct_right_value)._typ != 303 /* v.ast.EmptyExpr */) { + if ((node->ct_right_value)._typ != 305 /* v.ast.EmptyExpr */) { _option_i64 _t7 = v__ast__ComptTimeConstValue_i64(node->ct_right_value); if (_t7.state != 0) { /*or block*/ IError err = _t7.err; @@ -49372,7 +47470,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ v__ast__Type to_set = _const_v__ast__void_type; if (node->is_method && v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->receiver_type); - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -49396,7 +47494,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -49420,7 +47518,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { if (c->table->cur_fn->generic_names.len > 0) { if (Array_string_contains(c->table->cur_fn->generic_names, gt_name) && c->table->cur_fn->generic_names.len == c->table->cur_concrete_types.len) { int idx = Array_string_index(c->table->cur_fn->generic_names, gt_name); @@ -49459,7 +47557,7 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && string__eq(param_type_sym->name, gt_name)) { to_set = v__ast__mktyp(arg.typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, arg.typ); - if ((sym->info)._typ == 484 /* v.ast.FnType */) { + if ((sym->info)._typ == 486 /* v.ast.FnType */) { v__ast__Fn func_ = (*sym->info._v__ast__FnType).func; func_.name = _SLIT(""); int idx = v__ast__Table_find_or_register_fn_type(c->table, c->mod, func_, true, false); @@ -49479,15 +47577,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__variadic)) { to_set = v__ast__mktyp(arg.typ); } else if (arg_sym->kind == v__ast__Kind__array && param_type_sym->kind == v__ast__Kind__array) { - v__ast__Array arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_sym->info)._v__ast__Array,(arg_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; - v__ast__Array param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_type_sym->info)._v__ast__Array,(param_type_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_sym->info)._v__ast__Array,(arg_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; + v__ast__Array param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_type_sym->info)._v__ast__Array,(param_type_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { if (arg_elem_sym->kind == v__ast__Kind__array && param_elem_sym->kind == v__ast__Kind__array && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + arg_elem_info = /* as */ *(v__ast__Array*)__as_cast((arg_elem_sym->info)._v__ast__Array,(arg_elem_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + param_elem_info = /* as */ *(v__ast__Array*)__as_cast((param_elem_sym->info)._v__ast__Array,(param_elem_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -49497,15 +47595,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__array_fixed && param_type_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; - v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_sym->info)._v__ast__ArrayFixed,(arg_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_type_sym->info)._v__ast__ArrayFixed,(param_type_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); v__ast__TypeSymbol* param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); for (;;) { if (arg_elem_sym->kind == v__ast__Kind__array_fixed && param_elem_sym->kind == v__ast__Kind__array_fixed && !Array_string_contains(c->table->cur_fn->generic_names, param_elem_sym->name)) { - arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + arg_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((arg_elem_sym->info)._v__ast__ArrayFixed,(arg_elem_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; arg_elem_sym = v__ast__Table_sym(c->table, arg_elem_info.elem_type); - param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + param_elem_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((param_elem_sym->info)._v__ast__ArrayFixed,(param_elem_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; param_elem_sym = v__ast__Table_sym(c->table, param_elem_info.elem_type); } else { if (string__eq(param_elem_sym->name, gt_name)) { @@ -49515,8 +47613,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } } } else if (arg_sym->kind == v__ast__Kind__map && param_type_sym->kind == v__ast__Kind__map) { - v__ast__Map arg_map_info = /* as */ *(v__ast__Map*)__as_cast((arg_sym->info)._v__ast__Map,(arg_sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; - v__ast__Map param_map_info = /* as */ *(v__ast__Map*)__as_cast((param_type_sym->info)._v__ast__Map,(param_type_sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map arg_map_info = /* as */ *(v__ast__Map*)__as_cast((arg_sym->info)._v__ast__Map,(arg_sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; + v__ast__Map param_map_info = /* as */ *(v__ast__Map*)__as_cast((param_type_sym->info)._v__ast__Map,(param_type_sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; if (v__ast__Type_has_flag(param_map_info.key_type, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_sym(c->table, param_map_info.key_type)->name, gt_name)) { typ = arg_map_info.key_type; } @@ -49524,8 +47622,8 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ typ = arg_map_info.value_type; } } else if (arg_sym->kind == v__ast__Kind__function && param_type_sym->kind == v__ast__Kind__function) { - v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 484) /*expected idx: 484, 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, 484) /*expected idx: 484, name: v.ast.FnType */ ).func; + v__ast__Fn arg_type_func = (/* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; + v__ast__Fn param_type_func = (/* as */ *(v__ast__FnType*)__as_cast((param_type_sym->info)._v__ast__FnType,(param_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; 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]; @@ -49540,15 +47638,15 @@ void v__checker__Checker_infer_fn_generic_types(v__checker__Checker* c, v__ast__ } 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); - if (arg_sym->info._typ == 457 /* v.ast.Struct */) { + if (arg_sym->info._typ == 459 /* v.ast.Struct */) { generic_types = (*arg_sym->info._v__ast__Struct).generic_types; concrete_types = (*arg_sym->info._v__ast__Struct).concrete_types; } - else if (arg_sym->info._typ == 475 /* v.ast.Interface */) { + else if (arg_sym->info._typ == 477 /* v.ast.Interface */) { generic_types = (*arg_sym->info._v__ast__Interface).generic_types; concrete_types = (*arg_sym->info._v__ast__Interface).concrete_types; } - else if (arg_sym->info._typ == 476 /* v.ast.SumType */) { + else if (arg_sym->info._typ == 478 /* v.ast.SumType */) { generic_types = (*arg_sym->info._v__ast__SumType).generic_types; concrete_types = (*arg_sym->info._v__ast__SumType).concrete_types; } @@ -49675,7 +47773,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t2 = 0; _t2 < ast_file->stmts.len; ++_t2) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t2; - if ((stmt)->_typ == 343 /* v.ast.ConstDecl */ || (stmt)->_typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 345 /* v.ast.ConstDecl */ || (stmt)->_typ == 349 /* v.ast.ExprStmt */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -49686,7 +47784,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t3 = 0; _t3 < ast_file->stmts.len; ++_t3) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t3; - if ((stmt)->_typ == 351 /* v.ast.GlobalDecl */) { + if ((stmt)->_typ == 353 /* v.ast.GlobalDecl */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -49697,7 +47795,7 @@ void v__checker__Checker_check(v__checker__Checker* c, v__ast__File* ast_file_) c->stmt_level = 0; for (int _t4 = 0; _t4 < ast_file->stmts.len; ++_t4) { v__ast__Stmt* stmt = ((v__ast__Stmt*)ast_file->stmts.data) + _t4; - if ((stmt)->_typ != 343 /* v.ast.ConstDecl */ && (stmt)->_typ != 351 /* v.ast.GlobalDecl */ && (stmt)->_typ != 347 /* v.ast.ExprStmt */) { + if ((stmt)->_typ != 345 /* v.ast.ConstDecl */ && (stmt)->_typ != 353 /* v.ast.GlobalDecl */ && (stmt)->_typ != 349 /* v.ast.ExprStmt */) { c->expr_level = 0; v__checker__Checker_stmt(c, *stmt); } @@ -49721,7 +47819,7 @@ void v__checker__Checker_check_scope_vars(v__checker__Checker* c, v__ast__Scope* } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { if (!(*obj._v__ast__Var).is_used && string_at((*obj._v__ast__Var).name, 0) != '_') { v__checker__Checker_warn(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unused variable: `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__Var).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*obj._v__ast__Var).pos); } @@ -49954,13 +48052,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_valid_pascal_case(v__checker__Che } void v__checker__Checker_type_decl(v__checker__Checker* c, v__ast__TypeDecl node) { - if (node._typ == 281 /* v.ast.AliasTypeDecl */) { + if (node._typ == 283 /* v.ast.AliasTypeDecl */) { v__checker__Checker_alias_type_decl(c, (*node._v__ast__AliasTypeDecl)); } - else if (node._typ == 282 /* v.ast.FnTypeDecl */) { + else if (node._typ == 284 /* v.ast.FnTypeDecl */) { v__checker__Checker_fn_type_decl(c, (*node._v__ast__FnTypeDecl)); } - else if (node._typ == 283 /* v.ast.SumTypeDecl */) { + else if (node._typ == 285 /* v.ast.SumTypeDecl */) { v__checker__Checker_sum_type_decl(c, (*node._v__ast__SumTypeDecl)); } ; @@ -49981,7 +48079,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy if (typ_sym->kind == v__ast__Kind__placeholder || typ_sym->kind == v__ast__Kind__int_literal || typ_sym->kind == v__ast__Kind__float_literal) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__alias) { - v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + v__ast__TypeSymbol* orig_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = v__ast__TypeSymbol_str(typ_sym)}}, {_SLIT("` is an alias, use the original alias type `"), /*115 &string*/0xfe10, {.d_s = orig_sym->name}}, {_SLIT("` instead"), 0, { .d_c = 0 }}})), node.type_pos); } else if (typ_sym->kind == v__ast__Kind__chan) { v__checker__Checker_error(c, _SLIT("aliases of `chan` types are not allowed."), node.type_pos); @@ -49991,7 +48089,7 @@ void v__checker__Checker_alias_type_decl(v__checker__Checker* c, v__ast__AliasTy void v__checker__Checker_fn_type_decl(v__checker__Checker* c, v__ast__FnTypeDecl node) { v__checker__Checker_check_valid_pascal_case(c, node.name, _SLIT("fn type"), node.pos); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, node.typ); - v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType fn_typ_info = /* as */ *(v__ast__FnType*)__as_cast((typ_sym->info)._v__ast__FnType,(typ_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; v__ast__Fn fn_info = fn_typ_info.func; _option_void _t1 = v__checker__Checker_ensure_type_exists(c, fn_info.return_type, fn_info.return_type_pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -50042,7 +48140,7 @@ void v__checker__Checker_sum_type_decl(v__checker__Checker* c, v__ast__SumTypeDe v__checker__Checker_error(c, _SLIT("sum type cannot hold an interface"), variant.pos); } else if (sym->kind == v__ast__Kind__struct_ && sym->language == v__ast__Language__js) { v__checker__Checker_error(c, _SLIT("sum type cannot hold a JS struct"), variant.pos); - } else if ((sym->info)._typ == 457 /* v.ast.Struct */) { + } else if ((sym->info)._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { if (!v__ast__Type_has_flag(variant.typ, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("generic struct `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` must specify generic type names, e.g. Foo"), 0, { .d_c = 0 }}})), variant.pos); @@ -50100,7 +48198,8 @@ Array_v__ast__InterfaceEmbedding v__checker__Checker_expand_iface_embeds(v__chec Array_v__ast__InterfaceEmbedding _t2 = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); return _t2; } - Map_int_v__ast__InterfaceEmbedding res = new_map(sizeof(int), sizeof(v__ast__InterfaceEmbedding), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop); + Map_int_v__ast__InterfaceEmbedding res = new_map(sizeof(int), sizeof(v__ast__InterfaceEmbedding), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop) + ; Array_v__ast__InterfaceEmbedding ares = __new_array_with_default(0, 0, sizeof(v__ast__InterfaceEmbedding), 0); for (int _t3 = 0; _t3 < iface_embeds.len; ++_t3) { v__ast__InterfaceEmbedding ie = ((v__ast__InterfaceEmbedding*)iface_embeds.data)[_t3]; @@ -50148,14 +48247,14 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); bool explicit_lock_needed = false; v__ast__Expr expr = expr_; - if (expr._typ == 294 /* v.ast.CastExpr */) { + if (expr._typ == 296 /* v.ast.CastExpr */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 299 /* v.ast.ComptimeSelector */) { + else if (expr._typ == 301 /* v.ast.ComptimeSelector */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + else if (expr._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if (!(*(*expr._v__ast__Ident).obj._v__ast__Var).is_mut && !c->pref->translated && !c->file->is_translated && !c->inside_unsafe) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__Ident).name}}, {_SLIT("` is immutable, declare it with `mut` to make it mutable"), 0, { .d_c = 0 }}})), (*expr._v__ast__Ident).pos); } @@ -50173,25 +48272,25 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im pos = (*expr._v__ast__Ident).pos; } } - } else if (((*expr._v__ast__Ident).obj)._typ == 363 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { + } else if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.ConstField */ && Array_string_contains(c->const_names, (*expr._v__ast__Ident).name)) { 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); } } } - else if (expr._typ == 310 /* v.ast.IndexExpr */) { + else if (expr._typ == 312 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(c->table, (*expr._v__ast__IndexExpr).left_type); v__ast__Type elem_type = ((v__ast__Type)(0)); string kind = _SLIT(""); - if (left_sym->info._typ == 452 /* v.ast.Array */) { + if (left_sym->info._typ == 454 /* v.ast.Array */) { elem_type = (*left_sym->info._v__ast__Array).elem_type; kind = _SLIT("array"); } - else if (left_sym->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (left_sym->info._typ == 482 /* v.ast.ArrayFixed */) { elem_type = (*left_sym->info._v__ast__ArrayFixed).elem_type; kind = _SLIT("fixed array"); } - else if (left_sym->info._typ == 453 /* v.ast.Map */) { + else if (left_sym->info._typ == 455 /* v.ast.Map */) { elem_type = (*left_sym->info._v__ast__Map).value_type; kind = _SLIT("map"); } @@ -50206,17 +48305,17 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im to_lock = mr_21955.arg0; pos = mr_21955.arg1; } - else if (expr._typ == 322 /* v.ast.ParExpr */) { + else if (expr._typ == 324 /* v.ast.ParExpr */) { multi_return_string_v__token__Pos mr_22024 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__ParExpr).expr); to_lock = mr_22024.arg0; pos = mr_22024.arg1; } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { multi_return_string_v__token__Pos mr_22096 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__PrefixExpr).right); to_lock = mr_22096.arg0; pos = mr_22096.arg1; } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { if ((*expr._v__ast__SelectorExpr).expr_type == 0) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -50275,7 +48374,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__interface_: { - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; _option_v__ast__StructField _t9 = v__ast__Interface_find_field(&interface_info, (*expr._v__ast__SelectorExpr).field_name); if (_t9.state != 0) { /*or block*/ IError err = _t9.err; @@ -50295,7 +48394,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } case v__ast__Kind__sum_type: { - v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType sumtype_info = /* as */ *(v__ast__SumType*)__as_cast((typ_sym->info)._v__ast__SumType,(typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; _option_v__ast__StructField _t12 = v__ast__SumType_find_field(&sumtype_info, (*expr._v__ast__SelectorExpr).field_name); if (_t12.state != 0) { /*or block*/ IError err = _t12.err; @@ -50370,7 +48469,7 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } ; } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("slice"))) { multi_return_string_v__token__Pos mr_25383 = v__checker__Checker_fail_if_immutable(c, (*expr._v__ast__CallExpr).left); to_lock = mr_25383.arg0; @@ -50380,14 +48479,14 @@ VV_LOCAL_SYMBOL multi_return_string_v__token__Pos v__checker__Checker_fail_if_im } } } - else if (expr._typ == 287 /* v.ast.ArrayInit */) { + else if (expr._typ == 289 /* v.ast.ArrayInit */) { v__checker__Checker_error(c, _SLIT("array literal can not be modified"), (*expr._v__ast__ArrayInit).pos); return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 332 /* v.ast.StructInit */) { + else if (expr._typ == 334 /* v.ast.StructInit */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } - else if (expr._typ == 311 /* v.ast.InfixExpr */) { + else if (expr._typ == 313 /* v.ast.InfixExpr */) { return (multi_return_string_v__token__Pos){.arg0=_SLIT(""), .arg1=pos}; } @@ -50417,12 +48516,12 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, bool _t2 = true; return _t2; } - if ((inter_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { v__ast__Type generic_type = interface_type; v__ast__Interface generic_info = (*inter_sym->info._v__ast__Interface); if (v__ast__Type_has_flag((*inter_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*inter_sym->info._v__ast__Interface).parent_type); - if ((parent_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((parent_sym->info)._typ == 477 /* v.ast.Interface */) { generic_type = (*inter_sym->info._v__ast__Interface).parent_type; generic_info = (*parent_sym->info._v__ast__Interface); } @@ -50444,7 +48543,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, return _t5; } } - if ((inter_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { for (int _t6 = 0; _t6 < (*inter_sym->info._v__ast__Interface).types.len; ++_t6) { v__ast__Type t = ((v__ast__Type*)(*inter_sym->info._v__ast__Interface).types.data)[_t6]; if (v__ast__Type_idx(t) == v__ast__Type_idx(utyp)) { @@ -50465,7 +48564,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, if (typ_sym->kind == v__ast__Kind__interface_ && inter_sym->kind == v__ast__Kind__interface_ && !string_starts_with(styp, _SLIT("JS.")) && !string_starts_with(inter_sym->name, _SLIT("JS."))) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot implement interface `"), /*115 &string*/0xfe10, {.d_s = inter_sym->name}}, {_SLIT("` with a different interface `"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("`"), 0, { .d_c = 0 }}})), pos); } - Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); + Array_v__ast__Fn imethods = (inter_sym->kind == v__ast__Kind__interface_ ? ((/* as */ *(v__ast__Interface*)__as_cast((inter_sym->info)._v__ast__Interface,(inter_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).methods) : (inter_sym->methods)); if (!v__ast__Type_alias_eq(utyp, _const_v__ast__voidptr_type)) { for (int _t10 = 0; _t10 < imethods.len; ++_t10) { v__ast__Fn imethod = ((v__ast__Fn*)imethods.data)[_t10]; @@ -50499,7 +48598,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } } } - if ((inter_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { for (int _t14 = 0; _t14 < (*inter_sym->info._v__ast__Interface).fields.len; ++_t14) { v__ast__StructField ifield = ((v__ast__StructField*)(*inter_sym->info._v__ast__Interface).fields.data)[_t14]; _option_v__ast__StructField _t15; @@ -50532,7 +48631,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_type_implements(v__checker__Checker* c, } v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ast__Expr expr, v__ast__Type ret_type) { - if ((expr)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 295 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) || v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__result)) { string return_modifier_kind = (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) ? (_SLIT("an option")) : (_SLIT("a result"))); string return_modifier = (v__ast__Type_has_flag((*expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) ? (_SLIT("?")) : (_SLIT("!"))); @@ -50552,7 +48651,7 @@ v__ast__Type v__checker__Checker_check_expr_opt_call(v__checker__Checker* c, v__ } else if ((*expr._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unexpected `?`, the function `"), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__CallExpr).name}}, {_SLIT("` does not return an optional"), 0, { .d_c = 0 }}})), (*expr._v__ast__CallExpr).or_block.pos); } - } else if ((expr)._typ == 310 /* v.ast.IndexExpr */) { + } else if ((expr)._typ == 312 /* v.ast.IndexExpr */) { if ((*expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { v__checker__Checker_check_or_expr(c, (*expr._v__ast__IndexExpr).or_expr, ret_type, v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional)); } @@ -50567,7 +48666,11 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("to propagate the call, `"), /*115 &string*/0xfe10, {.d_s = c->table->cur_fn->name}}, {_SLIT("` must return an optional type"), 0, { .d_c = 0 }}})), node.pos); } if (!v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__optional)) { - v__checker__Checker_error(c, _SLIT("to propagate an option, the call must also return an optional type"), node.pos); + if (v__ast__Type_has_flag(expr_return_type, v__ast__TypeFlag__result)) { + v__checker__Checker_warn(c, _SLIT("propagating a result like an option is deprecated, use `foo()!` instead of `foo()?`"), node.pos); + } else { + v__checker__Checker_error(c, _SLIT("to propagate an option, the call must also return an optional type"), node.pos); + } } return; } @@ -50593,7 +48696,7 @@ void v__checker__Checker_check_or_expr(v__checker__Checker* c, v__ast__OrExpr no VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* c, v__ast__Stmt stmt, v__ast__Type ret_type, v__ast__Type expr_return_type) { if (!v__ast__Type_alias_eq(ret_type, _const_v__ast__void_type)) { - if (stmt._typ == 347 /* v.ast.ExprStmt */) { + if (stmt._typ == 349 /* v.ast.ExprStmt */) { c->expected_type = ret_type; c->expected_or_type = v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional); v__ast__Type last_stmt_typ = v__checker__Checker_expr(c, (*stmt._v__ast__ExprStmt).expr); @@ -50605,13 +48708,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* } string expected_type_name = v__ast__Table_type_to_str(c->table, v__ast__Type_clear_flag(ret_type, v__ast__TypeFlag__optional)); if (v__ast__Type_alias_eq((*stmt._v__ast__ExprStmt).typ, _const_v__ast__void_type)) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 308 /* v.ast.IfExpr */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 310 /* v.ast.IfExpr */) { for (int _t1 = 0; _t1 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t1) { v__ast__IfBranch branch = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t1]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); } return; - } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 317 /* v.ast.MatchExpr */) { + } else if (((*stmt._v__ast__ExprStmt).expr)._typ == 319 /* v.ast.MatchExpr */) { for (int _t2 = 0; _t2 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t2) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t2]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); @@ -50624,13 +48727,13 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("wrong return type `"), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT("` in the `or {}` block, expected `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr)); } } - else if (stmt._typ == 341 /* v.ast.BranchStmt */) { + else if (stmt._typ == 343 /* v.ast.BranchStmt */) { if (!((*stmt._v__ast__BranchStmt).kind == v__token__Kind__key_continue || (*stmt._v__ast__BranchStmt).kind == v__token__Kind__key_break)) { v__checker__Checker_error(c, _SLIT("only break/continue is allowed as a branch statement in the end of an `or {}` block"), (*stmt._v__ast__BranchStmt).pos); return; } } - else if (stmt._typ == 358 /* v.ast.Return */) { + else if (stmt._typ == 360 /* v.ast.Return */) { } else { @@ -50638,14 +48741,14 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_or_last_stmt(v__checker__Checker* v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("last statement in the `or {}` block should be an expression of type `"), /*115 &string*/0xfe10, {.d_s = expected_type_name}}, {_SLIT("` or exit parent scope"), 0, { .d_c = 0 }}})), (*(stmt.pos))); } ; - } else if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).expr._typ == 308 /* v.ast.IfExpr */) { + } else if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 310 /* v.ast.IfExpr */) { for (int _t3 = 0; _t3 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t3) { v__ast__IfBranch branch = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t3]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 317 /* v.ast.MatchExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 319 /* v.ast.MatchExpr */) { for (int _t4 = 0; _t4 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t4) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t4]; v__checker__Checker_check_or_last_stmt(c, (*(v__ast__Stmt*)array_last(branch.stmts)), ret_type, expr_return_type); @@ -50678,14 +48781,14 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S c->using_new_err_struct = true; } int name_type = 0; - if (node->expr._typ == 307 /* v.ast.Ident */) { + if (node->expr._typ == 309 /* v.ast.Ident */) { string name = (*node->expr._v__ast__Ident).name; bool valid_generic = v__util__is_generic_type_name(name) && Array_string_contains(c->table->cur_fn->generic_names, name); if (valid_generic) { name_type = v__ast__Type_set_flag(((v__ast__Table_find_type_idx(c->table, name))), v__ast__TypeFlag__generic); } } - else if (node->expr._typ == 334 /* v.ast.TypeOf */) { + else if (node->expr._typ == 336 /* v.ast.TypeOf */) { name_type = v__checker__Checker_expr(c, (*node->expr._v__ast__TypeOf).expr); } @@ -50720,8 +48823,8 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S c->inside_selector_expr = true; v__ast__Type typ = v__checker__Checker_expr(c, node->expr); if (v__ast__Expr_is_auto_deref_var(node->expr)) { - if ((node->expr)._typ == 307 /* v.ast.Ident */) { - if (((*node->expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((node->expr)._typ == 309 /* v.ast.Ident */) { + if (((*node->expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { typ = (*(*node->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -50733,7 +48836,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S return _t6; } node->expr_type = typ; - if (v__ast__Type_has_flag(node->expr_type, v__ast__TypeFlag__optional) && !((node->expr)._typ == 307 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->expr)._v__ast__Ident,(node->expr)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).kind == v__ast__IdentKind__constant)) { + if (v__ast__Type_has_flag(node->expr_type, v__ast__TypeFlag__optional) && !((node->expr)._typ == 309 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->expr)._v__ast__Ident,(node->expr)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).kind == v__ast__IdentKind__constant)) { v__checker__Checker_error(c, _SLIT("cannot access fields of an optional, handle the error with `or {...}` or propagate it with `?`"), node->pos); } string field_name = node->field_name; @@ -50757,7 +48860,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S string unknown_field_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has no field named `"), /*115 &string*/0xfe10, {.d_s = field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})); bool has_field = false; v__ast__StructField field = ((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.default_expr = {0},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,}); - if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 457 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { + if (field_name.len > 0 && u8_is_capital(string_at(field_name, 0)) && (sym->info)._typ == 459 /* v.ast.Struct */ && sym->language == v__ast__Language__v) { for (int _t10 = 0; _t10 < (*sym->info._v__ast__Struct).embeds.len; ++_t10) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t10]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(c->table, embed); @@ -50787,16 +48890,16 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t13.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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_39477 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); - field = mr_39477.arg0; - embed_types = mr_39477.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_39652 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t13.data); + field = mr_39652.arg0; + embed_types = mr_39652.arg1; 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); } } if (!c->inside_unsafe) { - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_union && !Array_v__token__Kind_contains(_const_v__token__assign_tokens, node->next_token)) { v__checker__Checker_warn(c, _SLIT("reading a union field (or its address) requires `unsafe`"), node->pos); } @@ -50823,9 +48926,9 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S *(multi_return_v__ast__StructField_Array_v__ast__Type*) _t15.data = (multi_return_v__ast__StructField_Array_v__ast__Type){.arg0=((v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.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_40308 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); - field = mr_40308.arg0; - embed_types = mr_40308.arg1; + multi_return_v__ast__StructField_Array_v__ast__Type mr_40483 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t15.data); + field = mr_40483.arg0; + embed_types = mr_40483.arg1; node->from_embed_types = embed_types; } } @@ -50903,7 +49006,7 @@ v__ast__Type v__checker__Checker_selector_expr(v__checker__Checker* c, v__ast__S v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = unwrapped_sym->name}}, {_SLIT("` has no property `"), /*115 &string*/0xfe10, {.d_s = node->field_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } else { - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { if (!v__token__Pos_struct_eq(c->smartcast_mut_pos, ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}))) { v__checker__Checker_note(c, _SLIT("smartcasting requires either an immutable value, or an explicit mut keyword before the value"), c->smartcast_mut_pos); } @@ -50981,7 +49084,7 @@ void v__checker__Checker_enum_decl(v__checker__Checker* c, v__ast__EnumDecl* nod } } if (field->has_expr) { - if (field->expr._typ == 312 /* v.ast.IntegerLiteral */) { + if (field->expr._typ == 314 /* v.ast.IntegerLiteral */) { i64 val = string_i64((*field->expr._v__ast__IntegerLiteral).val); if (val < _const_v__checker__int_min || val > _const_v__checker__int_max) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("enum value `"), /*100 &i64*/0xfe09, {.d_i64 = val}}, {_SLIT("` overflows int"), 0, { .d_c = 0 }}})), (*field->expr._v__ast__IntegerLiteral).pos); @@ -50990,14 +49093,14 @@ void v__checker__Checker_enum_decl(v__checker__Checker* c, v__ast__EnumDecl* nod } array_push((array*)&seen, _MOV((i64[]){ ((i64)(val)) })); } - else if (field->expr._typ == 324 /* v.ast.PrefixExpr */) { + else if (field->expr._typ == 326 /* v.ast.PrefixExpr */) { } - else if (field->expr._typ == 311 /* v.ast.InfixExpr */) { + else if (field->expr._typ == 313 /* v.ast.InfixExpr */) { v__checker__Checker_infix_expr(c, (voidptr)&/*qq*/(*field->expr._v__ast__InfixExpr)); } else { - if ((field->expr)._typ == 307 /* v.ast.Ident */) { + if ((field->expr)._typ == 309 /* v.ast.Ident */) { if ((*field->expr._v__ast__Ident).language == v__ast__Language__c) { continue; } @@ -51040,38 +49143,38 @@ inline VV_LOCAL_SYMBOL void v__checker__Checker_check_loop_label(v__checker__Che VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__Stmt node_) { v__ast__Stmt node = node_; c->expected_type = _const_v__ast__void_type; - if (node._typ == 345 /* v.ast.EmptyStmt */) { + if (node._typ == 347 /* v.ast.EmptyStmt */) { if (c->pref->is_verbose) { eprintln(_SLIT("Checker.stmt() EmptyStmt")); print_backtrace(); } } - else if (node._typ == 318 /* v.ast.NodeError */) { + else if (node._typ == 320 /* v.ast.NodeError */) { } - else if (node._typ == 337 /* v.ast.AsmStmt */) { + else if (node._typ == 339 /* v.ast.AsmStmt */) { v__checker__Checker_asm_stmt(c, (voidptr)&/*qq*/(*node._v__ast__AsmStmt)); } - else if (node._typ == 338 /* v.ast.AssertStmt */) { + else if (node._typ == 340 /* v.ast.AssertStmt */) { v__checker__Checker_assert_stmt(c, (*node._v__ast__AssertStmt)); } - else if (node._typ == 339 /* v.ast.AssignStmt */) { + else if (node._typ == 341 /* v.ast.AssignStmt */) { v__checker__Checker_assign_stmt(c, (voidptr)&/*qq*/(*node._v__ast__AssignStmt)); } - else if (node._typ == 340 /* v.ast.Block */) { + else if (node._typ == 342 /* v.ast.Block */) { v__checker__Checker_block(c, (*node._v__ast__Block)); } - else if (node._typ == 341 /* v.ast.BranchStmt */) { + else if (node._typ == 343 /* v.ast.BranchStmt */) { v__checker__Checker_branch_stmt(c, (*node._v__ast__BranchStmt)); } - else if (node._typ == 342 /* v.ast.ComptimeFor */) { + else if (node._typ == 344 /* v.ast.ComptimeFor */) { v__checker__Checker_comptime_for(c, (*node._v__ast__ComptimeFor)); } - else if (node._typ == 343 /* v.ast.ConstDecl */) { + else if (node._typ == 345 /* v.ast.ConstDecl */) { c->inside_const = true; v__checker__Checker_const_decl(c, (voidptr)&/*qq*/(*node._v__ast__ConstDecl)); c->inside_const = false; } - else if (node._typ == 344 /* v.ast.DeferStmt */) { + else if (node._typ == 346 /* v.ast.DeferStmt */) { if ((*node._v__ast__DeferStmt).idx_in_fn < 0) { (*node._v__ast__DeferStmt).idx_in_fn = c->table->cur_fn->defer_stmts.len; array_push((array*)&c->table->cur_fn->defer_stmts, _MOV((v__ast__DeferStmt[]){ *&(*node._v__ast__DeferStmt) })); @@ -51082,7 +49185,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St for (int i = 0; i < (*node._v__ast__DeferStmt).defer_vars.len; ++i) { v__ast__Ident ident = ((v__ast__Ident*)(*node._v__ast__DeferStmt).defer_vars.data)[i]; v__ast__Ident id = ident; - if ((id.info)._typ == 417 /* v.ast.IdentVar */) { + if ((id.info)._typ == 419 /* v.ast.IdentVar */) { if (id.comptime && Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, id.name)) { array_set(&(*node._v__ast__DeferStmt).defer_vars, i, &(v__ast__Ident[]) { ((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; @@ -51099,20 +49202,20 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__checker__Checker_stmts(c, (*node._v__ast__DeferStmt).stmts); c->inside_defer = false; } - else if (node._typ == 346 /* v.ast.EnumDecl */) { + else if (node._typ == 348 /* v.ast.EnumDecl */) { v__checker__Checker_enum_decl(c, (voidptr)&/*qq*/(*node._v__ast__EnumDecl)); } - else if (node._typ == 347 /* v.ast.ExprStmt */) { + else if (node._typ == 349 /* v.ast.ExprStmt */) { (*node._v__ast__ExprStmt).typ = v__checker__Checker_expr(c, (*node._v__ast__ExprStmt).expr); c->expected_type = _const_v__ast__void_type; v__ast__Type or_typ = _const_v__ast__void_type; - if ((*node._v__ast__ExprStmt).expr._typ == 310 /* v.ast.IndexExpr */) { + if ((*node._v__ast__ExprStmt).expr._typ == 312 /* v.ast.IndexExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__IndexExpr).or_expr.kind != v__ast__OrKind__absent) { (*node._v__ast__ExprStmt).is_expr = true; or_typ = (*node._v__ast__ExprStmt).typ; } } - else if ((*node._v__ast__ExprStmt).expr._typ == 324 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__ExprStmt).expr._typ == 326 /* v.ast.PrefixExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent) { (*node._v__ast__ExprStmt).is_expr = true; or_typ = (*node._v__ast__ExprStmt).typ; @@ -51123,7 +49226,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St } ; if (!c->pref->is_repl && (c->stmt_level == 1 || (c->stmt_level > 1 && !c->is_last_stmt))) { - if (((*node._v__ast__ExprStmt).expr)._typ == 311 /* v.ast.InfixExpr */) { + if (((*node._v__ast__ExprStmt).expr)._typ == 313 /* v.ast.InfixExpr */) { if ((*(*node._v__ast__ExprStmt).expr._v__ast__InfixExpr).op == v__token__Kind__left_shift) { v__ast__TypeSymbol* left_sym = v__ast__Table_final_sym(c->table, (*(*node._v__ast__ExprStmt).expr._v__ast__InfixExpr).left_type); if (left_sym->kind != v__ast__Kind__array) { @@ -51137,21 +49240,21 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St else if (node._typ == 220 /* v.ast.FnDecl */) { v__checker__Checker_fn_decl(c, (voidptr)&/*qq*/(*node._v__ast__FnDecl)); } - else if (node._typ == 348 /* v.ast.ForCStmt */) { + else if (node._typ == 350 /* v.ast.ForCStmt */) { v__checker__Checker_for_c_stmt(c, (*node._v__ast__ForCStmt)); } - else if (node._typ == 349 /* v.ast.ForInStmt */) { + else if (node._typ == 351 /* v.ast.ForInStmt */) { v__checker__Checker_for_in_stmt(c, (voidptr)&/*qq*/(*node._v__ast__ForInStmt)); } - else if (node._typ == 350 /* v.ast.ForStmt */) { + else if (node._typ == 352 /* v.ast.ForStmt */) { v__checker__Checker_for_stmt(c, (voidptr)&/*qq*/(*node._v__ast__ForStmt)); } - else if (node._typ == 351 /* v.ast.GlobalDecl */) { + else if (node._typ == 353 /* v.ast.GlobalDecl */) { v__checker__Checker_global_decl(c, (voidptr)&/*qq*/(*node._v__ast__GlobalDecl)); } - else if (node._typ == 352 /* v.ast.GotoLabel */) { + else if (node._typ == 354 /* v.ast.GotoLabel */) { } - else if (node._typ == 353 /* v.ast.GotoStmt */) { + else if (node._typ == 355 /* v.ast.GotoStmt */) { if (c->inside_defer) { v__checker__Checker_error(c, _SLIT("goto is not allowed in defer statements"), (*node._v__ast__GotoStmt).pos); } @@ -51162,32 +49265,32 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmt(v__checker__Checker* c, v__ast__St v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown label `"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__GotoStmt).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__GotoStmt).pos); } } - else if (node._typ == 354 /* v.ast.HashStmt */) { + else if (node._typ == 356 /* v.ast.HashStmt */) { v__checker__Checker_hash_stmt(c, (voidptr)&/*qq*/(*node._v__ast__HashStmt)); } - else if (node._typ == 355 /* v.ast.Import */) { + else if (node._typ == 357 /* v.ast.Import */) { v__checker__Checker_import_stmt(c, (*node._v__ast__Import)); } - else if (node._typ == 356 /* v.ast.InterfaceDecl */) { + else if (node._typ == 358 /* v.ast.InterfaceDecl */) { v__checker__Checker_interface_decl(c, (voidptr)&/*qq*/(*node._v__ast__InterfaceDecl)); } - else if (node._typ == 357 /* v.ast.Module */) { + else if (node._typ == 359 /* v.ast.Module */) { c->mod = (*node._v__ast__Module).name; c->is_just_builtin_mod = string__eq((*node._v__ast__Module).name, _SLIT("builtin")); c->is_builtin_mod = c->is_just_builtin_mod || (string__eq((*node._v__ast__Module).name, _SLIT("os")) || string__eq((*node._v__ast__Module).name, _SLIT("strconv"))); v__checker__Checker_check_valid_snake_case(c, (*node._v__ast__Module).name, _SLIT("module name"), (*node._v__ast__Module).pos); } - else if (node._typ == 358 /* v.ast.Return */) { + else if (node._typ == 360 /* v.ast.Return */) { v__checker__Checker_return_stmt(c, (voidptr)&/*qq*/(*node._v__ast__Return)); c->scope_returns = true; } - else if (node._typ == 359 /* v.ast.SqlStmt */) { + else if (node._typ == 361 /* v.ast.SqlStmt */) { v__checker__Checker_sql_stmt(c, (voidptr)&/*qq*/(*node._v__ast__SqlStmt)); } - else if (node._typ == 360 /* v.ast.StructDecl */) { + else if (node._typ == 362 /* v.ast.StructDecl */) { v__checker__Checker_struct_decl(c, (voidptr)&/*qq*/(*node._v__ast__StructDecl)); } - else if (node._typ == 284 /* v.ast.TypeDecl */) { + else if (node._typ == 286 /* v.ast.TypeDecl */) { v__checker__Checker_type_decl(c, (*node._v__ast__TypeDecl)); } ; @@ -51240,7 +49343,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_global_decl(v__checker__Checker* c, v__ v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), field->typ_pos); } if (field->has_expr) { - if ((field->expr)._typ == 285 /* v.ast.AnonFn */ && string__eq(field->name, _SLIT("main"))) { + if ((field->expr)._typ == 287 /* v.ast.AnonFn */ && string__eq(field->name, _SLIT("main"))) { v__checker__Checker_error(c, _SLIT("the `main` function is the program entry point, cannot redefine it"), field->pos); } field->typ = v__checker__Checker_expr(c, field->expr); @@ -51291,9 +49394,9 @@ VV_LOCAL_SYMBOL void v__checker__Checker_asm_stmt(v__checker__Checker* c, v__ast } VV_LOCAL_SYMBOL void v__checker__Checker_asm_arg(v__checker__Checker* c, v__ast__AsmArg arg, v__ast__AsmStmt stmt, Array_string aliases) { - if (arg._typ == 438 /* v.ast.AsmAlias */) { + if (arg._typ == 440 /* v.ast.AsmAlias */) { } - else if (arg._typ == 437 /* v.ast.AsmAddressing */) { + else if (arg._typ == 439 /* v.ast.AsmAddressing */) { if (!((*arg._v__ast__AsmAddressing).scale == -1 || (*arg._v__ast__AsmAddressing).scale == 1 || (*arg._v__ast__AsmAddressing).scale == 2 || (*arg._v__ast__AsmAddressing).scale == 4 || (*arg._v__ast__AsmAddressing).scale == 8)) { v__checker__Checker_error(c, _SLIT("scale must be one of 1, 2, 4, or 8"), (*arg._v__ast__AsmAddressing).pos); } @@ -51301,17 +49404,17 @@ VV_LOCAL_SYMBOL void v__checker__Checker_asm_arg(v__checker__Checker* c, v__ast_ v__checker__Checker_asm_arg(c, (*arg._v__ast__AsmAddressing).base, stmt, aliases); v__checker__Checker_asm_arg(c, (*arg._v__ast__AsmAddressing).index, stmt, aliases); } - else if (arg._typ == 291 /* v.ast.BoolLiteral */) { + else if (arg._typ == 293 /* v.ast.BoolLiteral */) { } - else if (arg._typ == 305 /* v.ast.FloatLiteral */) { + else if (arg._typ == 307 /* v.ast.FloatLiteral */) { } - else if (arg._typ == 296 /* v.ast.CharLiteral */) { + else if (arg._typ == 298 /* v.ast.CharLiteral */) { } - else if (arg._typ == 312 /* v.ast.IntegerLiteral */) { + else if (arg._typ == 314 /* v.ast.IntegerLiteral */) { } - else if (arg._typ == 362 /* v.ast.AsmRegister */) { + else if (arg._typ == 364 /* v.ast.AsmRegister */) { } - else if (arg._typ == 439 /* v.ast.AsmDisp */) { + else if (arg._typ == 441 /* v.ast.AsmDisp */) { } else if (arg._typ == 20 /* string */) { } @@ -51616,7 +49719,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_stmts_ending_with_expression(v__checker } } v__checker__Checker_stmt(c, stmt); - if ((stmt)._typ == 352 /* v.ast.GotoLabel */) { + if ((stmt)._typ == 354 /* v.ast.GotoLabel */) { unreachable = ((v__token__Pos){.len = 0,.line_nr = -1,.pos = 0,.col = 0,.last_line = 0,}); c->scope_returns = false; } @@ -51660,15 +49763,15 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t1; } - if (node._typ == 318 /* v.ast.NodeError */) { + if (node._typ == 320 /* v.ast.NodeError */) { } - else if (node._typ == 300 /* v.ast.ComptimeType */) { + else if (node._typ == 302 /* v.ast.ComptimeType */) { v__checker__Checker_error(c, _SLIT("incorrect use of compile-time type"), (*node._v__ast__ComptimeType).pos); } - else if (node._typ == 303 /* v.ast.EmptyExpr */) { + else if (node._typ == 305 /* v.ast.EmptyExpr */) { v__checker__Checker_error(c, _SLIT("checker.expr(): unhandled EmptyExpr"), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); } - else if (node._typ == 292 /* v.ast.CTempVar */) { + else if (node._typ == 294 /* v.ast.CTempVar */) { v__ast__Type _t2 = (*node._v__ast__CTempVar).typ; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51677,7 +49780,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t2; } - else if (node._typ == 285 /* v.ast.AnonFn */) { + else if (node._typ == 287 /* v.ast.AnonFn */) { v__ast__Type _t3 = v__checker__Checker_anon_fn(c, (voidptr)&/*qq*/(*node._v__ast__AnonFn)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51686,7 +49789,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t3; } - else if (node._typ == 286 /* v.ast.ArrayDecompose */) { + else if (node._typ == 288 /* v.ast.ArrayDecompose */) { v__ast__Type typ = v__checker__Checker_expr(c, (*node._v__ast__ArrayDecompose).expr); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, typ); if (type_sym->kind != v__ast__Kind__array) { @@ -51699,7 +49802,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t4; } - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((type_sym->info)._v__ast__Array,(type_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type elem_type = v__ast__Type_set_flag(array_info.elem_type, v__ast__TypeFlag__variadic); (*node._v__ast__ArrayDecompose).expr_type = typ; (*node._v__ast__ArrayDecompose).arg_type = elem_type; @@ -51711,7 +49814,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t5; } - else if (node._typ == 287 /* v.ast.ArrayInit */) { + else if (node._typ == 289 /* v.ast.ArrayInit */) { v__ast__Type _t6 = v__checker__Checker_array_init(c, (voidptr)&/*qq*/(*node._v__ast__ArrayInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51720,7 +49823,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t6; } - else if (node._typ == 288 /* v.ast.AsCast */) { + else if (node._typ == 290 /* v.ast.AsCast */) { (*node._v__ast__AsCast).expr_type = v__checker__Checker_expr(c, (*node._v__ast__AsCast).expr); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(c->table, (*node._v__ast__AsCast).expr_type); v__ast__TypeSymbol* type_sym = v__ast__Table_sym(c->table, (*node._v__ast__AsCast).typ); @@ -51757,7 +49860,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t9; } - else if (node._typ == 289 /* v.ast.Assoc */) { + else if (node._typ == 291 /* v.ast.Assoc */) { _option_v__ast__Var_ptr _t10 = v__ast__Scope_find_var((*node._v__ast__Assoc).scope, (*node._v__ast__Assoc).var_name); if (_t10.state != 0) { /*or block*/ IError err = _t10.err; @@ -51779,7 +49882,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t11; } - else if (node._typ == 291 /* v.ast.BoolLiteral */) { + else if (node._typ == 293 /* v.ast.BoolLiteral */) { v__ast__Type _t12 = _const_v__ast__bool_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51788,7 +49891,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t12; } - else if (node._typ == 294 /* v.ast.CastExpr */) { + else if (node._typ == 296 /* v.ast.CastExpr */) { v__ast__Type _t13 = v__checker__Checker_cast_expr(c, (voidptr)&/*qq*/(*node._v__ast__CastExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51797,7 +49900,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t13; } - else if (node._typ == 293 /* v.ast.CallExpr */) { + else if (node._typ == 295 /* v.ast.CallExpr */) { v__ast__Type ret_type = v__checker__Checker_call_expr(c, (voidptr)&/*qq*/(*node._v__ast__CallExpr)); if (!v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__optional) && !v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__result)) { if ((*node._v__ast__CallExpr).or_block.kind == v__ast__OrKind__block) { @@ -51822,7 +49925,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t14; } - else if (node._typ == 295 /* v.ast.ChanInit */) { + else if (node._typ == 297 /* v.ast.ChanInit */) { v__ast__Type _t15 = v__checker__Checker_chan_init(c, (voidptr)&/*qq*/(*node._v__ast__ChanInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51831,7 +49934,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t15; } - else if (node._typ == 296 /* v.ast.CharLiteral */) { + else if (node._typ == 298 /* v.ast.CharLiteral */) { v__ast__Type _t16 = _const_v__ast__rune_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51840,7 +49943,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t16; } - else if (node._typ == 297 /* v.ast.Comment */) { + else if (node._typ == 299 /* v.ast.Comment */) { v__ast__Type _t17 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51849,7 +49952,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t17; } - else if (node._typ == 290 /* v.ast.AtExpr */) { + else if (node._typ == 292 /* v.ast.AtExpr */) { v__ast__Type _t18 = v__checker__Checker_at_expr(c, (voidptr)&/*qq*/(*node._v__ast__AtExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51858,7 +49961,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t18; } - else if (node._typ == 298 /* v.ast.ComptimeCall */) { + else if (node._typ == 300 /* v.ast.ComptimeCall */) { v__ast__Type _t19 = v__checker__Checker_comptime_call(c, (voidptr)&/*qq*/(*node._v__ast__ComptimeCall)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51867,7 +49970,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t19; } - else if (node._typ == 299 /* v.ast.ComptimeSelector */) { + else if (node._typ == 301 /* v.ast.ComptimeSelector */) { v__ast__Type _t20 = v__checker__Checker_comptime_selector(c, (voidptr)&/*qq*/(*node._v__ast__ComptimeSelector)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51876,7 +49979,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t20; } - else if (node._typ == 301 /* v.ast.ConcatExpr */) { + else if (node._typ == 303 /* v.ast.ConcatExpr */) { v__ast__Type _t21 = v__checker__Checker_concat_expr(c, (voidptr)&/*qq*/(*node._v__ast__ConcatExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51885,7 +49988,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t21; } - else if (node._typ == 302 /* v.ast.DumpExpr */) { + else if (node._typ == 304 /* v.ast.DumpExpr */) { (*node._v__ast__DumpExpr).expr_type = v__checker__Checker_expr(c, (*node._v__ast__DumpExpr).expr); v__checker__Checker_check_expr_opt_call(c, (*node._v__ast__DumpExpr).expr, (*node._v__ast__DumpExpr).expr_type); int etidx = v__ast__Type_idx((*node._v__ast__DumpExpr).expr_type); @@ -51919,7 +50022,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t24; } - else if (node._typ == 304 /* v.ast.EnumVal */) { + else if (node._typ == 306 /* v.ast.EnumVal */) { v__ast__Type _t25 = v__checker__Checker_enum_val(c, (voidptr)&/*qq*/(*node._v__ast__EnumVal)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51928,7 +50031,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t25; } - else if (node._typ == 305 /* v.ast.FloatLiteral */) { + else if (node._typ == 307 /* v.ast.FloatLiteral */) { v__ast__Type _t26 = _const_v__ast__float_literal_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51937,7 +50040,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t26; } - else if (node._typ == 306 /* v.ast.GoExpr */) { + else if (node._typ == 308 /* v.ast.GoExpr */) { v__ast__Type _t27 = v__checker__Checker_go_expr(c, (voidptr)&/*qq*/(*node._v__ast__GoExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51946,7 +50049,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t27; } - else if (node._typ == 307 /* v.ast.Ident */) { + else if (node._typ == 309 /* v.ast.Ident */) { v__ast__Type res = v__checker__Checker_ident(c, (voidptr)&/*qq*/(*node._v__ast__Ident)); v__ast__Type _t28 = res; // Defer begin @@ -51956,7 +50059,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t28; } - else if (node._typ == 308 /* v.ast.IfExpr */) { + else if (node._typ == 310 /* v.ast.IfExpr */) { v__ast__Type _t29 = v__checker__Checker_if_expr(c, (voidptr)&/*qq*/(*node._v__ast__IfExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -51965,21 +50068,21 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t29; } - else if (node._typ == 309 /* v.ast.IfGuardExpr */) { + else if (node._typ == 311 /* v.ast.IfGuardExpr */) { bool old_inside_if_guard = c->inside_if_guard; c->inside_if_guard = true; (*node._v__ast__IfGuardExpr).expr_type = v__checker__Checker_expr(c, (*node._v__ast__IfGuardExpr).expr); c->inside_if_guard = old_inside_if_guard; - if (!v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { - bool no_opt = true; - if ((*node._v__ast__IfGuardExpr).expr._typ == 310 /* v.ast.IndexExpr */) { - no_opt = false; + if (!v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional) && !v__ast__Type_has_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + bool no_opt_or_res = true; + if ((*node._v__ast__IfGuardExpr).expr._typ == 312 /* v.ast.IndexExpr */) { + no_opt_or_res = false; (*node._v__ast__IfGuardExpr).expr_type = v__ast__Type_set_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); (*(*node._v__ast__IfGuardExpr).expr._v__ast__IndexExpr).is_option = true; } - else if ((*node._v__ast__IfGuardExpr).expr._typ == 324 /* v.ast.PrefixExpr */) { + else if ((*node._v__ast__IfGuardExpr).expr._typ == 326 /* v.ast.PrefixExpr */) { if ((*(*node._v__ast__IfGuardExpr).expr._v__ast__PrefixExpr).op == v__token__Kind__arrow) { - no_opt = false; + no_opt_or_res = false; (*node._v__ast__IfGuardExpr).expr_type = v__ast__Type_set_flag((*node._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); (*(*node._v__ast__IfGuardExpr).expr._v__ast__PrefixExpr).is_option = true; } @@ -51988,8 +50091,8 @@ bool v__checker__Checker_expr_defer_0 = false; else { } ; - if (no_opt) { - v__checker__Checker_error(c, _SLIT("expression should return an option"), v__ast__Expr_pos((*node._v__ast__IfGuardExpr).expr)); + if (no_opt_or_res) { + v__checker__Checker_error(c, _SLIT("expression should either return an option or a result"), v__ast__Expr_pos((*node._v__ast__IfGuardExpr).expr)); } } v__ast__Type _t30 = _const_v__ast__bool_type; @@ -52000,7 +50103,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t30; } - else if (node._typ == 310 /* v.ast.IndexExpr */) { + else if (node._typ == 312 /* v.ast.IndexExpr */) { v__ast__Type _t31 = v__checker__Checker_index_expr(c, (voidptr)&/*qq*/(*node._v__ast__IndexExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52009,7 +50112,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t31; } - else if (node._typ == 311 /* v.ast.InfixExpr */) { + else if (node._typ == 313 /* v.ast.InfixExpr */) { v__ast__Type _t32 = v__checker__Checker_infix_expr(c, (voidptr)&/*qq*/(*node._v__ast__InfixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52018,7 +50121,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t32; } - else if (node._typ == 312 /* v.ast.IntegerLiteral */) { + else if (node._typ == 314 /* v.ast.IntegerLiteral */) { v__ast__Type _t33 = v__checker__Checker_int_lit(c, (voidptr)&/*qq*/(*node._v__ast__IntegerLiteral)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52027,7 +50130,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t33; } - else if (node._typ == 315 /* v.ast.LockExpr */) { + else if (node._typ == 317 /* v.ast.LockExpr */) { v__ast__Type _t34 = v__checker__Checker_lock_expr(c, (voidptr)&/*qq*/(*node._v__ast__LockExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52036,7 +50139,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t34; } - else if (node._typ == 316 /* v.ast.MapInit */) { + else if (node._typ == 318 /* v.ast.MapInit */) { v__ast__Type _t35 = v__checker__Checker_map_init(c, (voidptr)&/*qq*/(*node._v__ast__MapInit)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52045,7 +50148,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t35; } - else if (node._typ == 317 /* v.ast.MatchExpr */) { + else if (node._typ == 319 /* v.ast.MatchExpr */) { v__ast__Type _t36 = v__checker__Checker_match_expr(c, (voidptr)&/*qq*/(*node._v__ast__MatchExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52054,7 +50157,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t36; } - else if (node._typ == 323 /* v.ast.PostfixExpr */) { + else if (node._typ == 325 /* v.ast.PostfixExpr */) { v__ast__Type _t37 = v__checker__Checker_postfix_expr(c, (voidptr)&/*qq*/(*node._v__ast__PostfixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52063,7 +50166,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t37; } - else if (node._typ == 324 /* v.ast.PrefixExpr */) { + else if (node._typ == 326 /* v.ast.PrefixExpr */) { v__ast__Type _t38 = v__checker__Checker_prefix_expr(c, (voidptr)&/*qq*/(*node._v__ast__PrefixExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52072,7 +50175,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t38; } - else if (node._typ == 319 /* v.ast.None */) { + else if (node._typ == 321 /* v.ast.None */) { v__ast__Type _t39 = _const_v__ast__none_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52081,7 +50184,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t39; } - else if (node._typ == 321 /* v.ast.OrExpr */) { + else if (node._typ == 323 /* v.ast.OrExpr */) { v__ast__Type _t40 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52090,8 +50193,8 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t40; } - else if (node._typ == 322 /* v.ast.ParExpr */) { - if (((*node._v__ast__ParExpr).expr)._typ == 322 /* v.ast.ParExpr */) { + else if (node._typ == 324 /* v.ast.ParExpr */) { + if (((*node._v__ast__ParExpr).expr)._typ == 324 /* v.ast.ParExpr */) { v__checker__Checker_warn(c, _SLIT("redundant parentheses are used"), (*node._v__ast__ParExpr).pos); } v__ast__Type _t41 = v__checker__Checker_expr(c, (*node._v__ast__ParExpr).expr); @@ -52102,7 +50205,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t41; } - else if (node._typ == 325 /* v.ast.RangeExpr */) { + else if (node._typ == 327 /* v.ast.RangeExpr */) { v__ast__Type _t42 = _const_v__ast__void_type; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52111,7 +50214,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t42; } - else if (node._typ == 326 /* v.ast.SelectExpr */) { + else if (node._typ == 328 /* v.ast.SelectExpr */) { v__ast__Type _t43 = v__checker__Checker_select_expr(c, (voidptr)&/*qq*/(*node._v__ast__SelectExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52120,7 +50223,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t43; } - else if (node._typ == 327 /* v.ast.SelectorExpr */) { + else if (node._typ == 329 /* v.ast.SelectorExpr */) { v__ast__Type _t44 = v__checker__Checker_selector_expr(c, (voidptr)&/*qq*/(*node._v__ast__SelectorExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52129,7 +50232,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t44; } - else if (node._typ == 328 /* v.ast.SizeOf */) { + else if (node._typ == 330 /* v.ast.SizeOf */) { if (!(*node._v__ast__SizeOf).is_type) { (*node._v__ast__SizeOf).typ = v__checker__Checker_expr(c, (*node._v__ast__SizeOf).expr); } @@ -52141,7 +50244,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t45; } - else if (node._typ == 313 /* v.ast.IsRefType */) { + else if (node._typ == 315 /* v.ast.IsRefType */) { if (!(*node._v__ast__IsRefType).is_type) { (*node._v__ast__IsRefType).typ = v__checker__Checker_expr(c, (*node._v__ast__IsRefType).expr); } @@ -52153,7 +50256,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t46; } - else if (node._typ == 320 /* v.ast.OffsetOf */) { + else if (node._typ == 322 /* v.ast.OffsetOf */) { v__ast__Type _t47 = v__checker__Checker_offset_of(c, (*node._v__ast__OffsetOf)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52162,7 +50265,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t47; } - else if (node._typ == 329 /* v.ast.SqlExpr */) { + else if (node._typ == 331 /* v.ast.SqlExpr */) { v__ast__Type _t48 = v__checker__Checker_sql_expr(c, (voidptr)&/*qq*/(*node._v__ast__SqlExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52171,7 +50274,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t48; } - else if (node._typ == 331 /* v.ast.StringLiteral */) { + else if (node._typ == 333 /* v.ast.StringLiteral */) { if ((*node._v__ast__StringLiteral).language == v__ast__Language__c) { v__ast__Type _t49 = v__ast__Type_set_nr_muls(_const_v__ast__byte_type, 1); // Defer begin @@ -52189,7 +50292,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t50; } - else if (node._typ == 330 /* v.ast.StringInterLiteral */) { + else if (node._typ == 332 /* v.ast.StringInterLiteral */) { v__ast__Type _t51 = v__checker__Checker_string_inter_lit(c, (voidptr)&/*qq*/(*node._v__ast__StringInterLiteral)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52198,7 +50301,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t51; } - else if (node._typ == 332 /* v.ast.StructInit */) { + else if (node._typ == 334 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).unresolved) { v__ast__Type _t52 = v__checker__Checker_expr(c, v__ast__resolve_init((*node._v__ast__StructInit), v__checker__Checker_unwrap_generic(c, (*node._v__ast__StructInit).typ), c->table)); // Defer begin @@ -52216,7 +50319,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t53; } - else if (node._typ == 333 /* v.ast.TypeNode */) { + else if (node._typ == 335 /* v.ast.TypeNode */) { v__ast__Type _t54 = (*node._v__ast__TypeNode).typ; // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52225,7 +50328,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t54; } - else if (node._typ == 334 /* v.ast.TypeOf */) { + else if (node._typ == 336 /* v.ast.TypeOf */) { (*node._v__ast__TypeOf).expr_type = v__checker__Checker_expr(c, (*node._v__ast__TypeOf).expr); v__ast__Type _t55 = _const_v__ast__string_type; // Defer begin @@ -52235,7 +50338,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t55; } - else if (node._typ == 335 /* v.ast.UnsafeExpr */) { + else if (node._typ == 337 /* v.ast.UnsafeExpr */) { v__ast__Type _t56 = v__checker__Checker_unsafe_expr(c, (voidptr)&/*qq*/(*node._v__ast__UnsafeExpr)); // Defer begin if (v__checker__Checker_expr_defer_0) { @@ -52244,7 +50347,7 @@ bool v__checker__Checker_expr_defer_0 = false; // Defer end return _t56; } - else if (node._typ == 314 /* v.ast.Likely */) { + else if (node._typ == 316 /* v.ast.Likely */) { v__ast__Type ltype = v__checker__Checker_expr(c, (*node._v__ast__Likely).expr); if (!v__checker__Checker_check_types(c, ltype, _const_v__ast__bool_type)) { v__ast__TypeSymbol* ltype_sym = v__ast__Table_sym(c->table, ltype); @@ -52277,6 +50380,9 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__ast__Type to_type = node->typ; v__ast__TypeSymbol* to_sym = v__ast__Table_sym(c->table, to_type); v__ast__TypeSymbol* final_to_sym = v__ast__Table_final_sym(c->table, to_type); + if (v__ast__Type_has_flag(to_type, v__ast__TypeFlag__optional)) { + v__checker__Checker_error(c, _SLIT("casting to optional type is forbidden"), node->pos); + } if ((v__ast__TypeSymbol_is_number(to_sym) && string__eq(from_sym->name, _SLIT("JS.Number"))) || (v__ast__TypeSymbol_is_number(to_sym) && string__eq(from_sym->name, _SLIT("JS.BigInt"))) || (v__ast__TypeSymbol_is_string(to_sym) && string__eq(from_sym->name, _SLIT("JS.String"))) || (v__ast__Type_is_bool(to_type) && string__eq(from_sym->name, _SLIT("JS.Boolean"))) || (v__ast__Type_is_bool(from_type) && string__eq(to_sym->name, _SLIT("JS.Boolean"))) || (v__ast__TypeSymbol_is_number(from_sym) && string__eq(to_sym->name, _SLIT("JS.Number"))) || (v__ast__TypeSymbol_is_number(from_sym) && string__eq(to_sym->name, _SLIT("JS.BigInt"))) || (v__ast__TypeSymbol_is_string(from_sym) && string__eq(to_sym->name, _SLIT("JS.String")))) { v__ast__Type _t1 = to_type; return _t1; @@ -52306,17 +50412,17 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - } else if ((to_sym->info)._typ == 472 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { + } else if ((to_sym->info)._typ == 474 /* v.ast.Alias */ && !(final_to_sym->kind == v__ast__Kind__struct_ && v__ast__Type_is_ptr(to_type))) { if (!v__checker__Checker_check_types(c, from_type, (*to_sym->info._v__ast__Alias).parent_type) && !(v__ast__TypeSymbol_is_int(final_to_sym) && (final_from_sym->kind == v__ast__Kind__enum_ || final_from_sym->kind == v__ast__Kind__bool || final_from_sym->kind == v__ast__Kind__i8 || final_from_sym->kind == v__ast__Kind__char))) { string ft = v__ast__Table_type_to_str(c->table, from_type); string tt = v__ast__Table_type_to_str(c->table, to_type); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("cannot cast `"), /*115 &string*/0xfe10, {.d_s = ft}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = tt}}, {_SLIT("` (alias to `"), /*115 &string*/0xfe10, {.d_s = final_to_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})), node->pos); } - } else if (to_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(to_type) && !(/* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).is_typedef) { + } else if (to_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(to_type) && !(/* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_typedef) { if (from_sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(from_type)) { v__checker__Checker_warn(c, _SLIT("casting to struct is deprecated, use e.g. `Struct{...expr}` instead"), node->pos); - v__ast__Struct from_type_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; - v__ast__Struct to_type_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct from_type_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; + v__ast__Struct to_type_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (!v__checker__Checker_check_struct_signature(c, from_type_info, to_type_info)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot convert struct `"), /*115 &string*/0xfe10, {.d_s = from_sym->name}}, {_SLIT("` to struct `"), /*115 &string*/0xfe10, {.d_s = to_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -52329,7 +50435,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE if (!v__ast__Type_is_ptr(from_type) && !v__ast__Type_is_pointer(from_type) && from_sym->kind != v__ast__Kind__interface_ && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->expr, true); } - if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ).is_generic) { + if ((/* as */ *(v__ast__Interface*)__as_cast((to_sym->info)._v__ast__Interface,(to_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).is_generic) { v__ast__Type inferred_type = v__checker__Checker_resolve_generic_interface(c, from_type, to_type, node->pos); if (inferred_type != 0) { to_type = inferred_type; @@ -52409,7 +50515,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot cast function `"), /*115 &string*/0xfe10, {.d_s = fnexpr}}, {_SLIT("` to string"), 0, { .d_c = 0 }}})), node->pos); } else if (!v__ast__Type_alias_eq(to_type, _const_v__ast__string_type) && v__ast__Type_alias_eq(from_type, _const_v__ast__string_type) && (!(to_sym->kind == v__ast__Kind__alias && string__eq(final_to_sym->name, _SLIT("string"))))) { string error_msg = str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot cast a string to a type `"), /*115 &string*/0xfe10, {.d_s = final_to_sym->name}}, {_SLIT("`, that is not an alias of string"), 0, { .d_c = 0 }}})); - if ((node->expr)._typ == 331 /* v.ast.StringLiteral */) { + if ((node->expr)._typ == 333 /* v.ast.StringLiteral */) { if ((*node->expr._v__ast__StringLiteral).val.len == 1) { error_msg = /*f*/string__plus(error_msg, str_intp(3, _MOV((StrIntpData[]){{_SLIT(", for denoting characters use `"), /*115 &string*/0xfe10, {.d_s = (*node->expr._v__ast__StringLiteral).val}}, {_SLIT("` instead of '"), /*115 &string*/0xfe10, {.d_s = (*node->expr._v__ast__StringLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } @@ -52421,7 +50527,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE v__checker__Checker_expr(c, node->arg); } if (to_sym->kind == v__ast__Kind__enum_) { - if ((node->expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((node->expr)._typ == 314 /* v.ast.IntegerLiteral */) { string enum_typ_name = v__ast__Table_get_type_name(c->table, to_type); int node_val = string_int((*node->expr._v__ast__IntegerLiteral).val); v__ast__EnumDecl* _t4 = (v__ast__EnumDecl*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, c->table->enum_decls), &(string[]){to_sym->name})); @@ -52442,7 +50548,7 @@ v__ast__Type v__checker__Checker_cast_expr(v__checker__Checker* c, v__ast__CastE int enum_val = 0; for (int _t5 = 0; _t5 < enum_decl.fields.len; ++_t5) { v__ast__EnumField enum_field = ((v__ast__EnumField*)enum_decl.fields.data)[_t5]; - if ((enum_field.expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((enum_field.expr)._typ == 314 /* v.ast.IntegerLiteral */) { enum_val = string_int((*enum_field.expr._v__ast__IntegerLiteral).val); } if (node_val == enum_val) { @@ -52588,11 +50694,11 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no return _t3; } if (node->kind == v__ast__IdentKind__constant || node->kind == v__ast__IdentKind__global || node->kind == v__ast__IdentKind__variable) { - v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 417) /*expected idx: 417, name: v.ast.IdentVar */ ; + v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast((node->info)._v__ast__IdentVar,(node->info)._typ, 419) /*expected idx: 419, name: v.ast.IdentVar */ ; v__ast__Type _t4 = info.typ; return _t4; } else if (node->kind == v__ast__IdentKind__function) { - v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 416) /*expected idx: 416, name: v.ast.IdentFn */ ; + v__ast__IdentFn info = /* as */ *(v__ast__IdentFn*)__as_cast((node->info)._v__ast__IdentFn,(node->info)._typ, 418) /*expected idx: 418, name: v.ast.IdentFn */ ; v__ast__Type _t5 = info.typ; return _t5; } else if (node->kind == v__ast__IdentKind__unresolved) { @@ -52602,14 +50708,14 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no _option_v__ast__ScopeObject _t6; if (_t6 = v__ast__Scope_find(node->scope, node->name), _t6.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t6.data; - if (obj._typ == 364 /* v.ast.GlobalField */) { + if (obj._typ == 366 /* v.ast.GlobalField */) { node->kind = v__ast__IdentKind__global; node->info = v__ast__IdentVar_to_sumtype_v__ast__IdentInfo(ADDR(v__ast__IdentVar, (((v__ast__IdentVar){.typ = (*obj._v__ast__GlobalField).typ,.share = 0,.is_mut = 0,.is_static = 0,.is_volatile = 0,.is_optional = 0,})))); node->obj = obj; v__ast__Type _t7 = (*obj._v__ast__GlobalField).typ; return _t7; } - else if (obj._typ == 365 /* v.ast.Var */) { + else if (obj._typ == 367 /* v.ast.Var */) { int node_pos = (c->pref->is_vweb && !_IN_MAP(ADDR(string, node->name), ADDR(map, node->scope->objects)) && node->scope->start_pos < c->comptime_call_pos ? (c->comptime_call_pos) : (node->pos.pos)); if (node_pos < (*obj._v__ast__Var).pos.pos) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` (used before declaration)"), 0, { .d_c = 0 }}})), node->pos); @@ -52624,17 +50730,17 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } v__ast__Type typ = _t8; if (typ == 0) { - if (((*obj._v__ast__Var).expr)._typ == 307 /* v.ast.Ident */) { + if (((*obj._v__ast__Var).expr)._typ == 309 /* v.ast.Ident */) { if ((*(*obj._v__ast__Var).expr._v__ast__Ident).kind == v__ast__IdentKind__unresolved) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unresolved variable: `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t9 = _const_v__ast__void_type; return _t9; } } - if (((*obj._v__ast__Var).expr)._typ == 309 /* v.ast.IfGuardExpr */) { + if (((*obj._v__ast__Var).expr)._typ == 311 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len) { for (int vi = 0; vi < (*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.len; ++vi) { v__ast__IfGuardVar var = ((v__ast__IfGuardVar*)(*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).vars.data)[vi]; @@ -52644,7 +50750,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } } } else { - typ = v__ast__Type_clear_flag((*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional); + typ = v__ast__Type_clear_flag(v__ast__Type_clear_flag((*(*obj._v__ast__Var).expr._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional), v__ast__TypeFlag__result); } } else { typ = v__checker__Checker_expr(c, (*obj._v__ast__Var).expr); @@ -52678,7 +50784,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no _option_v__ast__ScopeObject _t12; if (_t12 = v__ast__Scope_find(c->file->global_scope, name), _t12.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t12.data; - if (obj._typ == 363 /* v.ast.ConstField */) { + if (obj._typ == 365 /* v.ast.ConstField */) { if (!((*obj._v__ast__ConstField).is_pub || string__eq((*obj._v__ast__ConstField).mod, c->mod) || c->pref->is_test)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("constant `"), /*115 &string*/0xfe10, {.d_s = (*obj._v__ast__ConstField).name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); } @@ -52690,7 +50796,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no typ = v__checker__Checker_expr(c, (*obj._v__ast__ConstField).expr); c->inside_const = false; c->mod = old_c_mod; - if (((*obj._v__ast__ConstField).expr)._typ == 293 /* v.ast.CallExpr */) { + if (((*obj._v__ast__ConstField).expr)._typ == 295 /* v.ast.CallExpr */) { if ((*(*obj._v__ast__ConstField).expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent) { typ = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); } @@ -52768,7 +50874,7 @@ v__ast__Type v__checker__Checker_ident(v__checker__Checker* c, v__ast__Ident* no } if (!DenseArray_has_index(&_t21.key_values, _t22)) {continue;} v__ast__ScopeObject so = (*(v__ast__ScopeObject*)DenseArray_value(&_t21.key_values, _t22)); - if ((so)._typ == 363 /* v.ast.ConstField */) { + if ((so)._typ == 365 /* v.ast.ConstField */) { if (string__eq((*so._v__ast__ConstField).mod, cname_mod)) { array_push((array*)&const_names_in_mod, _MOV((string[]){ string_clone((*so._v__ast__ConstField).name) })); } @@ -52813,7 +50919,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, cur_type); v__ast__Type to_type = (sym->kind == v__ast__Kind__interface_ ? (v__ast__Type_ref(to_type_)) : (to_type_)); v__ast__Expr expr = expr_; - if (expr._typ == 327 /* v.ast.SelectorExpr */) { + if (expr._typ == 329 /* v.ast.SelectorExpr */) { bool is_mut = false; Array_v__ast__Type smartcasts = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*expr._v__ast__SelectorExpr).expr_type); @@ -52855,12 +50961,12 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast(v__checker__Checker* c, v__as c->smartcast_mut_pos = (*expr._v__ast__SelectorExpr).pos; } } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { bool is_mut = false; Array_v__ast__Type smartcasts = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); bool is_already_casted = false; int orig_type = 0; - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { is_mut = (*(*expr._v__ast__Ident).obj._v__ast__Var).is_mut; _PUSH_MANY(&smartcasts, ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts), _t7, Array_v__ast__Type); is_already_casted = (*(*expr._v__ast__Ident).obj._v__ast__Var).pos.pos == (*expr._v__ast__Ident).pos.pos; @@ -52907,15 +51013,15 @@ v__ast__Type v__checker__Checker_select_expr(v__checker__Checker* c, v__ast__Sel for (int _t1 = 0; _t1 < node->branches.len; ++_t1) { v__ast__SelectBranch branch = ((v__ast__SelectBranch*)node->branches.data)[_t1]; v__checker__Checker_stmt(c, branch.stmt); - if (branch.stmt._typ == 347 /* v.ast.ExprStmt */) { + if (branch.stmt._typ == 349 /* v.ast.ExprStmt */) { if (branch.is_timeout) { if (!v__ast__Type_is_int((*branch.stmt._v__ast__ExprStmt).typ)) { v__ast__TypeSymbol* tsym = v__ast__Table_sym(c->table, (*branch.stmt._v__ast__ExprStmt).typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("invalid type `"), /*115 &string*/0xfe10, {.d_s = tsym->name}}, {_SLIT("` for timeout - expected integer number of nanoseconds aka `time.Duration`"), 0, { .d_c = 0 }}})), (*branch.stmt._v__ast__ExprStmt).pos); } } else { - if (((*branch.stmt._v__ast__ExprStmt).expr)._typ == 311 /* v.ast.InfixExpr */) { - if (((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 307 /* v.ast.Ident */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 327 /* v.ast.SelectorExpr */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 310 /* v.ast.IndexExpr */) { + if (((*branch.stmt._v__ast__ExprStmt).expr)._typ == 313 /* v.ast.InfixExpr */) { + if (((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 309 /* v.ast.Ident */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 329 /* v.ast.SelectorExpr */ && ((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)._typ != 312 /* v.ast.IndexExpr */) { v__checker__Checker_error(c, _SLIT("channel in `select` key must be predefined"), v__ast__Expr_pos((*(*branch.stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).left)); } } else { @@ -52923,10 +51029,10 @@ v__ast__Type v__checker__Checker_select_expr(v__checker__Checker* c, v__ast__Sel } } } - else if (branch.stmt._typ == 339 /* v.ast.AssignStmt */) { + else if (branch.stmt._typ == 341 /* v.ast.AssignStmt */) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)); - if (expr._typ == 324 /* v.ast.PrefixExpr */) { - if (((*expr._v__ast__PrefixExpr).right)._typ != 307 /* v.ast.Ident */ && ((*expr._v__ast__PrefixExpr).right)._typ != 327 /* v.ast.SelectorExpr */ && ((*expr._v__ast__PrefixExpr).right)._typ != 310 /* v.ast.IndexExpr */) { + if (expr._typ == 326 /* v.ast.PrefixExpr */) { + if (((*expr._v__ast__PrefixExpr).right)._typ != 309 /* v.ast.Ident */ && ((*expr._v__ast__PrefixExpr).right)._typ != 329 /* v.ast.SelectorExpr */ && ((*expr._v__ast__PrefixExpr).right)._typ != 312 /* v.ast.IndexExpr */) { v__checker__Checker_error(c, _SLIT("channel in `select` key must be predefined"), v__ast__Expr_pos((*expr._v__ast__PrefixExpr).right)); } if ((*expr._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent) { @@ -52962,7 +51068,7 @@ v__ast__Type v__checker__Checker_lock_expr(v__checker__Checker* c, v__ast__LockE v__ast__Type e_typ = v__checker__Checker_expr(c, (*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i))); string id_name = v__ast__Expr_str((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i))); if (!v__ast__Type_has_flag(e_typ, v__ast__TypeFlag__shared_f)) { - string obj_type = (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))._typ == 307 /* v.ast.Ident */ ? (_SLIT("variable")) : (_SLIT("struct element"))); + string obj_type = (((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))._typ == 309 /* v.ast.Ident */ ? (_SLIT("variable")) : (_SLIT("struct element"))); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = id_name}}, {_SLIT("` must be declared as `shared` "), /*115 &string*/0xfe10, {.d_s = obj_type}}, {_SLIT(" to be locked"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*(v__ast__Expr*)/*ee elem_sym */array_get(node->lockeds, i)))); } if (Array_string_contains(c->locked_names, id_name)) { @@ -52980,7 +51086,7 @@ v__ast__Type v__checker__Checker_lock_expr(v__checker__Checker* c, v__ast__LockE v__ast__Type ret_type = _const_v__ast__void_type; if (node->stmts.len > 0) { v__ast__Stmt last_stmt = (*(v__ast__Stmt*)array_last(node->stmts)); - if ((last_stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((last_stmt)._typ == 349 /* v.ast.ExprStmt */) { c->expected_type = expected_type; ret_type = v__checker__Checker_expr(c, (*last_stmt._v__ast__ExprStmt).expr); } @@ -53023,31 +51129,31 @@ VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_definition(v__chec VV_LOCAL_SYMBOL _option_v__ast__Expr v__checker__Checker_find_obj_definition(v__checker__Checker* c, v__ast__ScopeObject obj) { string name = _SLIT(""); - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { name = (*obj._v__ast__Var).name; } - else if (obj._typ == 363 /* v.ast.ConstField */) { + else if (obj._typ == 365 /* v.ast.ConstField */) { name = (*obj._v__ast__ConstField).name; } - else if (obj._typ == 364 /* v.ast.GlobalField */) { + else if (obj._typ == 366 /* v.ast.GlobalField */) { name = (*obj._v__ast__GlobalField).name; } - else if (obj._typ == 362 /* v.ast.AsmRegister */) { + else if (obj._typ == 364 /* v.ast.AsmRegister */) { name = (*obj._v__ast__AsmRegister).name; } ; v__ast__Expr expr = v__ast__empty_expr(); - if ((obj)._typ == 365 /* v.ast.Var */) { + if ((obj)._typ == 367 /* v.ast.Var */) { if ((*obj._v__ast__Var).is_mut) { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is mut and may have changed since its definition"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } expr = (*obj._v__ast__Var).expr; - } else if ((obj)._typ == 363 /* v.ast.ConstField */) { + } else if ((obj)._typ == 365 /* v.ast.ConstField */) { expr = (*obj._v__ast__ConstField).expr; } else { return (_option_v__ast__Expr){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("` is a global variable and is unknown at compile time"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; } - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { _option_v__ast__Expr _t3 = v__checker__Checker_find_definition(c, (*expr._v__ast__Ident)); return _t3; } @@ -53063,8 +51169,8 @@ VV_LOCAL_SYMBOL _option_bool v__checker__Checker_has_return(v__checker__Checker* bool has_complexity = false; for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt s = ((v__ast__Stmt*)stmts.data)[_t1]; - if ((s)._typ == 347 /* v.ast.ExprStmt */) { - if (((*s._v__ast__ExprStmt).expr)._typ == 308 /* v.ast.IfExpr */ || ((*s._v__ast__ExprStmt).expr)._typ == 317 /* v.ast.MatchExpr */) { + if ((s)._typ == 349 /* v.ast.ExprStmt */) { + if (((*s._v__ast__ExprStmt).expr)._typ == 310 /* v.ast.IfExpr */ || ((*s._v__ast__ExprStmt).expr)._typ == 319 /* v.ast.MatchExpr */) { has_complexity = true; break; } @@ -53089,16 +51195,16 @@ 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_95884 = v__checker__Checker_fail_if_immutable(c, node->expr); - node->auto_locked = mr_95884.arg0; + multi_return_string_v__token__Pos mr_96262 = v__checker__Checker_fail_if_immutable(c, node->expr); + node->auto_locked = mr_96262.arg0; } v__ast__Type _t1 = typ; return _t1; } void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr* node, bool as_interface) { - if (node->_typ == 307 /* v.ast.Ident */) { - if (((*node->_v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (node->_typ == 309 /* v.ast.Ident */) { + if (((*node->_v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Var* obj = &(*(*node->_v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t1 = v__ast__Scope_find_var(c->fn_scope, (*(*node->_v__ast__Ident).obj._v__ast__Var).name); @@ -53122,7 +51228,7 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } else { if (type_sym->kind == (v__ast__Kind__struct_)) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (!info.is_heap) { (*(*node->_v__ast__Ident).obj._v__ast__Var).is_auto_heap = true; } @@ -53135,12 +51241,12 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } } } - else if (node->_typ == 327 /* v.ast.SelectorExpr */) { + else if (node->_typ == 329 /* v.ast.SelectorExpr */) { if (!v__ast__Type_is_ptr((*node->_v__ast__SelectorExpr).expr_type)) { v__checker__Checker_mark_as_referenced(c, &(*node->_v__ast__SelectorExpr).expr, as_interface); } } - else if (node->_typ == 310 /* v.ast.IndexExpr */) { + else if (node->_typ == 312 /* v.ast.IndexExpr */) { v__checker__Checker_mark_as_referenced(c, &(*node->_v__ast__IndexExpr).left, as_interface); } @@ -53150,15 +51256,15 @@ void v__checker__Checker_mark_as_referenced(v__checker__Checker* c, v__ast__Expr } string v__checker__Checker_get_base_name(v__checker__Checker* c, v__ast__Expr* node) { - if (node->_typ == 307 /* v.ast.Ident */) { + if (node->_typ == 309 /* v.ast.Ident */) { string _t1 = (*node->_v__ast__Ident).name; return _t1; } - else if (node->_typ == 327 /* v.ast.SelectorExpr */) { + else if (node->_typ == 329 /* v.ast.SelectorExpr */) { string _t2 = v__checker__Checker_get_base_name(c, &(*node->_v__ast__SelectorExpr).expr); return _t2; } - else if (node->_typ == 310 /* v.ast.IndexExpr */) { + else if (node->_typ == 312 /* v.ast.IndexExpr */) { string _t3 = v__checker__Checker_get_base_name(c, &(*node->_v__ast__IndexExpr).left); return _t3; } @@ -53178,14 +51284,14 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre c->inside_ref_lit = old_inside_ref_lit; node->right_type = right_type; if (node->op == v__token__Kind__amp) { - if ((node->right)._typ == 324 /* v.ast.PrefixExpr */) { + if ((node->right)._typ == 326 /* v.ast.PrefixExpr */) { 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 == 327 /* v.ast.SelectorExpr */) { + } else if ((node->right)._typ == 329 /* v.ast.SelectorExpr */) { v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__SelectorExpr).expr_type); - if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 457) /*expected idx: 457, 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, 486) /*expected idx: 486, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ).uses_exprs))) { + if (expr_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((expr_sym->info)._v__ast__Struct,(expr_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_minify && ((*node->right._v__ast__SelectorExpr).typ == _const_v__ast__bool_type_idx || (right_sym->kind == v__ast__Kind__enum_ && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).is_flag && !(/* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).uses_exprs))) { 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)); } } @@ -53193,19 +51299,19 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre if (node->op == v__token__Kind__amp && !v__ast__Type_is_ptr(right_type)) { v__ast__Expr expr = node->right; for (;;) { - if (!((expr)._typ == 322 /* v.ast.ParExpr */)) break; + if (!((expr)._typ == 324 /* v.ast.ParExpr */)) break; expr = (*expr._v__ast__ParExpr).expr; } - if ((expr)._typ == 291 /* v.ast.BoolLiteral */ || (expr)._typ == 293 /* v.ast.CallExpr */ || (expr)._typ == 296 /* v.ast.CharLiteral */ || (expr)._typ == 305 /* v.ast.FloatLiteral */ || (expr)._typ == 312 /* v.ast.IntegerLiteral */ || (expr)._typ == 311 /* v.ast.InfixExpr */ || (expr)._typ == 331 /* v.ast.StringLiteral */ || (expr)._typ == 330 /* v.ast.StringInterLiteral */) { + if ((expr)._typ == 293 /* v.ast.BoolLiteral */ || (expr)._typ == 295 /* v.ast.CallExpr */ || (expr)._typ == 298 /* v.ast.CharLiteral */ || (expr)._typ == 307 /* v.ast.FloatLiteral */ || (expr)._typ == 314 /* v.ast.IntegerLiteral */ || (expr)._typ == 313 /* v.ast.InfixExpr */ || (expr)._typ == 333 /* v.ast.StringLiteral */ || (expr)._typ == 332 /* v.ast.StringInterLiteral */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot take the address of "), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(expr)}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } - if ((node->right)._typ == 310 /* v.ast.IndexExpr */) { + if ((node->right)._typ == 312 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, (*node->right._v__ast__IndexExpr).left_type); bool is_mut = false; - if (((*node->right._v__ast__IndexExpr).left)._typ == 307 /* v.ast.Ident */) { + if (((*node->right._v__ast__IndexExpr).left)._typ == 309 /* v.ast.Ident */) { v__ast__Ident ident = (*(*node->right._v__ast__IndexExpr).left._v__ast__Ident); v__ast__ScopeObject ident_obj = ident.obj; - if ((ident_obj)._typ == 365 /* v.ast.Var */) { + if ((ident_obj)._typ == 367 /* v.ast.Var */) { is_mut = (*ident_obj._v__ast__Var).is_mut; } } @@ -53223,7 +51329,7 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre } v__ast__Type _t1 = v__ast__Type_ref(right_type); return _t1; - } else if (node->op == v__token__Kind__amp && (node->right)._typ != 294 /* v.ast.CastExpr */) { + } else if (node->op == v__token__Kind__amp && (node->right)._typ != 296 /* v.ast.CastExpr */) { if (!c->inside_fn_arg && !c->inside_unsafe) { v__checker__Checker_mark_as_referenced(c, &node->right, false); } @@ -53270,16 +51376,16 @@ v__ast__Type v__checker__Checker_prefix_expr(v__checker__Checker* c, v__ast__Pre VV_LOCAL_SYMBOL void v__checker__Checker_check_index(v__checker__Checker* c, v__ast__TypeSymbol* typ_sym, v__ast__Expr index, v__ast__Type index_type, v__token__Pos pos, bool range_index, bool is_gated) { v__ast__TypeSymbol* index_type_sym = v__ast__Table_sym(c->table, index_type); if (typ_sym->kind == v__ast__Kind__array || typ_sym->kind == v__ast__Kind__array_fixed || typ_sym->kind == v__ast__Kind__string) { - if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { + if (!(v__ast__Type_is_int(index_type) || index_type_sym->kind == v__ast__Kind__enum_ || (index_type_sym->kind == v__ast__Kind__alias && v__ast__Type_is_int((/* as */ *(v__ast__Alias*)__as_cast((index_type_sym->info)._v__ast__Alias,(index_type_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)) || (c->pref->translated && v__ast__Type_is_any_kind_of_pointer(index_type)))) { string type_str = (typ_sym->kind == v__ast__Kind__string ? ( str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-integer string index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))) : ( str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-integer index `"), /*115 &string*/0xfe10, {.d_s = index_type_sym->name}}, {_SLIT("` (array type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("`)"), 0, { .d_c = 0 }}})))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = type_str}}, {_SLIT0, 0, { .d_c = 0 }}})), pos); } - if ((index)._typ == 312 /* v.ast.IntegerLiteral */ && !is_gated) { + if ((index)._typ == 314 /* v.ast.IntegerLiteral */ && !is_gated) { if (string_at((*index._v__ast__IntegerLiteral).val, 0) == '-') { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("negative index `"), /*115 &string*/0xfe10, {.d_s = (*index._v__ast__IntegerLiteral).val}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } else if (typ_sym->kind == v__ast__Kind__array_fixed) { int i = string_int((*index._v__ast__IntegerLiteral).val); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((typ_sym->info)._v__ast__ArrayFixed,(typ_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; if ((!range_index && i >= info.size) || (range_index && i > info.size)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("index out of range (index: "), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT(", len: "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT(")"), 0, { .d_c = 0 }}})), (*index._v__ast__IntegerLiteral).pos); } @@ -53302,7 +51408,7 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } else if (typ_sym->kind == (v__ast__Kind__array)) { node->is_array = true; - if (node->or_expr.kind != v__ast__OrKind__absent && (node->index)._typ == 325 /* v.ast.RangeExpr */) { + if (node->or_expr.kind != v__ast__OrKind__absent && (node->index)._typ == 327 /* v.ast.RangeExpr */) { v__checker__Checker_error(c, _SLIT("custom error handling on range expressions for arrays is not supported yet."), node->or_expr.pos); } } @@ -53326,19 +51432,19 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } if ((v__ast__Type_is_ptr(typ) && !v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f) && !v__ast__Expr_is_auto_deref_var(node->left)) || v__ast__Type_is_pointer(typ)) { bool is_ok = false; - if ((node->left)._typ == 307 /* v.ast.Ident */) { - if (((*node->left._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((node->left)._typ == 309 /* v.ast.Ident */) { + if (((*node->left._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { is_ok = (*(*node->left._v__ast__Ident).obj._v__ast__Var).is_mut && (*(*node->left._v__ast__Ident).obj._v__ast__Var).is_arg && !v__ast__Type_is_ptr(v__ast__Type_deref(typ)); } } - if (!is_ok && (node->index)._typ == 325 /* v.ast.RangeExpr */) { + if (!is_ok && (node->index)._typ == 327 /* v.ast.RangeExpr */) { string s = v__ast__Table_type_to_str(c->table, typ); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT("` does not support slicing"), 0, { .d_c = 0 }}})), node->pos); } else if (!c->inside_unsafe && !is_ok && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_warn(c, _SLIT("pointer indexing is only allowed in `unsafe` blocks"), node->pos); } } - if ((node->index)._typ == 325 /* v.ast.RangeExpr */) { + if ((node->index)._typ == 327 /* v.ast.RangeExpr */) { if ((*node->index._v__ast__RangeExpr).has_low) { v__ast__Type index_type = v__checker__Checker_expr(c, (*node->index._v__ast__RangeExpr).low); v__checker__Checker_check_index(c, typ_sym, (*node->index._v__ast__RangeExpr).low, index_type, node->pos, true, node->is_gated); @@ -53356,7 +51462,7 @@ v__ast__Type v__checker__Checker_index_expr(v__checker__Checker* c, v__ast__Inde } } else { if (typ_sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((typ_sym->info)._v__ast__Map,(typ_sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((typ_sym->info)._v__ast__Map,(typ_sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; c->expected_type = info.key_type; v__ast__Type index_type = v__checker__Checker_expr(c, node->index); if (!v__checker__Checker_check_types(c, index_type, info.key_type)) { @@ -53415,7 +51521,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, typ); if (typ_sym->kind == v__ast__Kind__array && node->enum_name.len == 0) { - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((typ_sym->info)._v__ast__Array,(typ_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((typ_sym->info)._v__ast__Array,(typ_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; typ = array_info.elem_type; typ_sym = v__ast__Table_sym(c->table, typ); } @@ -53425,7 +51531,7 @@ v__ast__Type v__checker__Checker_enum_val(v__checker__Checker* c, v__ast__EnumVa v__ast__Type _t5 = _const_v__ast__void_type; return _t5; } - if ((fsym->info)._typ != 486 /* v.ast.Enum */) { + if ((fsym->info)._typ != 488 /* v.ast.Enum */) { v__checker__Checker_error(c, _SLIT("not an enum"), node->pos); v__ast__Type _t6 = _const_v__ast__void_type; return _t6; @@ -53476,19 +51582,19 @@ v__ast__Type v__checker__Checker_offset_of(v__checker__Checker* c, v__ast__Offse void v__checker__Checker_check_dup_keys(v__checker__Checker* c, v__ast__MapInit* node, int i) { v__ast__Expr key_i = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, i)); - if ((key_i)._typ == 331 /* v.ast.StringLiteral */) { + if ((key_i)._typ == 333 /* v.ast.StringLiteral */) { for (int j = 0; j < i; ++j) { v__ast__Expr key_j = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, j)); - if ((key_j)._typ == 331 /* v.ast.StringLiteral */) { + if ((key_j)._typ == 333 /* v.ast.StringLiteral */) { if (string__eq((*key_i._v__ast__StringLiteral).val, (*key_j._v__ast__StringLiteral).val)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate key \""), /*115 &string*/0xfe10, {.d_s = (*key_i._v__ast__StringLiteral).val}}, {_SLIT("\" in map literal"), 0, { .d_c = 0 }}})), (*key_i._v__ast__StringLiteral).pos); } } } - } else if ((key_i)._typ == 312 /* v.ast.IntegerLiteral */) { + } else if ((key_i)._typ == 314 /* v.ast.IntegerLiteral */) { for (int j = 0; j < i; ++j) { v__ast__Expr key_j = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->keys, j)); - if ((key_j)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((key_j)._typ == 314 /* v.ast.IntegerLiteral */) { if (string__eq((*key_i._v__ast__IntegerLiteral).val, (*key_j._v__ast__IntegerLiteral).val)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("duplicate key \""), /*115 &string*/0xfe10, {.d_s = (*key_i._v__ast__IntegerLiteral).val}}, {_SLIT("\" in map literal"), 0, { .d_c = 0 }}})), (*key_i._v__ast__IntegerLiteral).pos); } @@ -53668,10 +51774,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array: { - _option_void _t1 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type, pos); + _option_void _t1 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type, pos); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -53680,10 +51786,10 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__array_fixed: { - _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type, pos); + _option_void _t3 = v__checker__Checker_ensure_type_exists(c, (/* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type, pos); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -53692,11 +51798,11 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__map: { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; _option_void _t5 = v__checker__Checker_ensure_type_exists(c, info.key_type, pos); if (_t5.state != 0 && _t5.err._typ != _IError_None___index) { _option_void _t6; - memcpy(&_t6, &_t5, sizeof(Option)); + memcpy(&_t6, &_t5, sizeof(_option)); return _t6; } @@ -53704,7 +51810,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ _option_void _t7 = v__checker__Checker_ensure_type_exists(c, info.value_type, pos); if (_t7.state != 0 && _t7.err._typ != _IError_None___index) { _option_void _t8; - memcpy(&_t8, &_t7, sizeof(Option)); + memcpy(&_t8, &_t7, sizeof(_option)); return _t8; } @@ -53713,13 +51819,13 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ } case v__ast__Kind__sum_type: { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; for (int _t9 = 0; _t9 < info.concrete_types.len; ++_t9) { v__ast__Type concrete_typ = ((v__ast__Type*)info.concrete_types.data)[_t9]; _option_void _t10 = v__checker__Checker_ensure_type_exists(c, concrete_typ, pos); if (_t10.state != 0 && _t10.err._typ != _IError_None___index) { _option_void _t11; - memcpy(&_t11, &_t10, sizeof(Option)); + memcpy(&_t11, &_t10, sizeof(_option)); return _t11; } @@ -53770,7 +51876,7 @@ VV_LOCAL_SYMBOL _option_void v__checker__Checker_ensure_type_exists(v__checker__ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr expr, v__ast__Type typ, string what) { v__token__Pos pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); - if (expr._typ == 307 /* v.ast.Ident */) { + if (expr._typ == 309 /* v.ast.Ident */) { if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f)) { if (!Array_string_contains(c->rlocked_names, (*expr._v__ast__Ident).name) && !Array_string_contains(c->locked_names, (*expr._v__ast__Ident).name)) { string action = (string__eq(what, _SLIT("argument")) ? (_SLIT("passed")) : (_SLIT("used"))); @@ -53779,7 +51885,7 @@ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr } return; } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { pos = (*expr._v__ast__SelectorExpr).pos; if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f)) { string expr_name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -53792,21 +51898,21 @@ void v__checker__Checker_fail_if_unreadable(v__checker__Checker* c, v__ast__Expr v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__SelectorExpr).expr, (*expr._v__ast__SelectorExpr).expr_type, what); } } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { pos = (*expr._v__ast__CallExpr).pos; if ((*expr._v__ast__CallExpr).is_method) { v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__CallExpr).left, (*expr._v__ast__CallExpr).left_type, what); } return; } - else if (expr._typ == 315 /* v.ast.LockExpr */) { + else if (expr._typ == 317 /* v.ast.LockExpr */) { return; } - else if (expr._typ == 310 /* v.ast.IndexExpr */) { + else if (expr._typ == 312 /* v.ast.IndexExpr */) { pos = v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__IndexExpr).left), (*expr._v__ast__IndexExpr).pos); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__IndexExpr).left, (*expr._v__ast__IndexExpr).left_type, what); } - else if (expr._typ == 311 /* v.ast.InfixExpr */) { + else if (expr._typ == 313 /* v.ast.InfixExpr */) { pos = v__token__Pos_extend(v__ast__Expr_pos((*expr._v__ast__InfixExpr).left), (*expr._v__ast__InfixExpr).pos); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__InfixExpr).left, (*expr._v__ast__InfixExpr).left_type, what); v__checker__Checker_fail_if_unreadable(c, (*expr._v__ast__InfixExpr).right, (*expr._v__ast__InfixExpr).right_type, what); @@ -53867,7 +51973,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check if (node->is_vweb) { v__ast__FnDecl* save_cur_fn = c->table->cur_fn; v__pref__Preferences *pref_ = HEAP(v__pref__Preferences, (*c->pref)); - v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).vroot,(*(pref_)).out_name_c,(*(pref_)).out_name,(*(pref_)).path,(*(pref_)).message_limit,(*(pref_)).checker_match_exhaustive_cutoff_limit,(*(pref_)).thread_stack_size,(*(pref_)).os,(*(pref_)).arch,(*(pref_)).backend,(*(pref_)).ccompiler_type,(*(pref_)).gc_mode,(*(pref_)).use_color,(*(pref_)).assert_failure_mode,(*(pref_)).build_mode,(*(pref_)).output_mode,(*(pref_)).is_verbose,(*(pref_)).is_glibc,(*(pref_)).is_musl,(*(pref_)).is_test,(*(pref_)).is_script,(*(pref_)).is_vsh,(*(pref_)).is_livemain,(*(pref_)).is_liveshared,(*(pref_)).is_shared,(*(pref_)).is_o,(*(pref_)).is_prof,(*(pref_)).is_prod,(*(pref_)).is_repl,(*(pref_)).is_run,(*(pref_)).is_debug,(*(pref_)).is_vlines,(*(pref_)).is_stats,(*(pref_)).is_fmt,(*(pref_)).is_vet,.is_vweb = true,(*(pref_)).is_ios_simulator,(*(pref_)).is_apk,(*(pref_)).is_help,(*(pref_)).is_cstrict,(*(pref_)).profile_no_inline,(*(pref_)).translated,(*(pref_)).obfuscate,(*(pref_)).sanitize,(*(pref_)).sourcemap,(*(pref_)).sourcemap_inline,(*(pref_)).sourcemap_src_included,(*(pref_)).show_cc,(*(pref_)).show_c_output,(*(pref_)).show_callgraph,(*(pref_)).show_depgraph,(*(pref_)).use_cache,(*(pref_)).retry_compilation,(*(pref_)).m64,(*(pref_)).building_v,(*(pref_)).autofree,(*(pref_)).compress,(*(pref_)).no_builtin,(*(pref_)).enable_globals,(*(pref_)).is_bare,(*(pref_)).no_preludes,(*(pref_)).output_cross_c,(*(pref_)).output_es5,(*(pref_)).prealloc,(*(pref_)).print_v_files,(*(pref_)).skip_running,(*(pref_)).skip_warnings,(*(pref_)).warn_impure_v,(*(pref_)).warns_are_errors,(*(pref_)).fatal_errors,(*(pref_)).reuse_tmpc,(*(pref_)).no_rsp,(*(pref_)).no_std,(*(pref_)).no_parallel,(*(pref_)).only_check_syntax,(*(pref_)).check_only,(*(pref_)).experimental,(*(pref_)).skip_unused,(*(pref_)).show_timings,(*(pref_)).nofloat,}, sizeof(v__pref__Preferences))); + v__pref__Preferences* pref2 = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){(*(pref_)).cache_manager,(*(pref_)).profile_fns,(*(pref_)).lookup_path,(*(pref_)).run_only,(*(pref_)).compile_defines,(*(pref_)).compile_defines_all,(*(pref_)).run_args,(*(pref_)).printfn_list,(*(pref_)).cleanup_files,(*(pref_)).build_options,(*(pref_)).test_runner,(*(pref_)).profile_file,(*(pref_)).dump_c_flags,(*(pref_)).dump_modules,(*(pref_)).dump_files,(*(pref_)).cflags,(*(pref_)).ccompiler,(*(pref_)).third_party_option,(*(pref_)).bare_builtin_dir,(*(pref_)).custom_prelude,(*(pref_)).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); @@ -53913,7 +52019,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_call(v__checker__Check return _t17; } string method_name = _SLIT(""); - if ((v->expr)._typ == 331 /* v.ast.StringLiteral */) { + if ((v->expr)._typ == 333 /* v.ast.StringLiteral */) { method_name = (*v->expr._v__ast__StringLiteral).val; } else { v__checker__Checker_error(c, _SLIT("todo: not a string literal"), node->method_pos); @@ -53940,7 +52046,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_comptime_selector(v__checker__C if (!v__ast__Type_alias_eq(expr_type, _const_v__ast__string_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected `string` instead of `"), /*115 &string*/0xfe10, {.d_s = expr_sym->name}}, {_SLIT("` (e.g. `field.name`)"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->field_expr)); } - if ((node->field_expr)._typ == 327 /* v.ast.SelectorExpr */) { + if ((node->field_expr)._typ == 329 /* v.ast.SelectorExpr */) { v__token__Pos left_pos = v__ast__Expr_pos((*node->field_expr._v__ast__SelectorExpr).expr); if (c->comptime_fields_type.len == 0) { v__checker__Checker_error(c, _SLIT("compile time field access can only be used when iterating over `T.fields`"), left_pos); @@ -53966,7 +52072,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_comptime_for(v__checker__Checker* c, v_ } if (node.kind == v__ast__ComptimeForKind__fields) { if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; c->inside_comptime_for_field = true; for (int _t1 = 0; _t1 < sym_info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)sym_info.fields.data)[_t1]; @@ -53985,24 +52091,24 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com if (nlevel > 100) { return (_option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - if (expr._typ == 322 /* v.ast.ParExpr */) { + if (expr._typ == 324 /* v.ast.ParExpr */) { _option_v__ast__ComptTimeConstValue _t2 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__ParExpr).expr, nlevel + 1); return _t2; } - else if (expr._typ == 328 /* v.ast.SizeOf */) { + else if (expr._typ == 330 /* v.ast.SizeOf */) { multi_return_int_int mr_4820 = v__ast__Table_type_size(c->table, (*expr._v__ast__SizeOf).typ); int s = mr_4820.arg0; _option_v__ast__ComptTimeConstValue _t3; opt_ok2(&(v__ast__ComptTimeConstValue[]) { int_to_sumtype_v__ast__ComptTimeConstValue(&s) }, (_option*)(&_t3), sizeof(v__ast__ComptTimeConstValue)); return _t3; } - else if (expr._typ == 305 /* v.ast.FloatLiteral */) { + else if (expr._typ == 307 /* v.ast.FloatLiteral */) { f64 x = string_f64((*expr._v__ast__FloatLiteral).val); _option_v__ast__ComptTimeConstValue _t4; opt_ok2(&(v__ast__ComptTimeConstValue[]) { f64_to_sumtype_v__ast__ComptTimeConstValue(&x) }, (_option*)(&_t4), sizeof(v__ast__ComptTimeConstValue)); return _t4; } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { u64 x = string_u64((*expr._v__ast__IntegerLiteral).val); if (x > 9223372036854775807U) { _option_v__ast__ComptTimeConstValue _t5; @@ -54013,12 +52119,12 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com opt_ok2(&(v__ast__ComptTimeConstValue[]) { i64_to_sumtype_v__ast__ComptTimeConstValue(ADDR(i64, (string_i64((*expr._v__ast__IntegerLiteral).val)))) }, (_option*)(&_t6), sizeof(v__ast__ComptTimeConstValue)); return _t6; } - else if (expr._typ == 331 /* v.ast.StringLiteral */) { + else if (expr._typ == 333 /* v.ast.StringLiteral */) { _option_v__ast__ComptTimeConstValue _t7; opt_ok2(&(v__ast__ComptTimeConstValue[]) { string_to_sumtype_v__ast__ComptTimeConstValue(ADDR(string, (v__util__smart_quote((*expr._v__ast__StringLiteral).val, (*expr._v__ast__StringLiteral).is_raw)))) }, (_option*)(&_t7), sizeof(v__ast__ComptTimeConstValue)); return _t7; } - else if (expr._typ == 296 /* v.ast.CharLiteral */) { + else if (expr._typ == 298 /* v.ast.CharLiteral */) { Array_rune runes = string_runes((*expr._v__ast__CharLiteral).val); if (runes.len > 0) { _option_v__ast__ComptTimeConstValue _t8; @@ -54027,13 +52133,13 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com } return (_option_v__ast__ComptTimeConstValue){ .state=2, .err=_const_none__, .data={EMPTY_STRUCT_INITIALIZATION} }; } - else if (expr._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 363 /* v.ast.ConstField */) { + else if (expr._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.ConstField */) { _option_v__ast__ComptTimeConstValue _t10 = v__checker__Checker_eval_comptime_const_expr(c, (*(*expr._v__ast__Ident).obj._v__ast__ConstField).expr, nlevel + 1); return _t10; } } - else if (expr._typ == 294 /* v.ast.CastExpr */) { + else if (expr._typ == 296 /* v.ast.CastExpr */) { _option_v__ast__ComptTimeConstValue _t11 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__CastExpr).expr, nlevel + 1); if (_t11.state != 0) { /*or block*/ IError err = _t11.err; @@ -54152,11 +52258,11 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com return _t40; } } - else if (expr._typ == 311 /* v.ast.InfixExpr */) { + else if (expr._typ == 313 /* v.ast.InfixExpr */) { _option_v__ast__ComptTimeConstValue _t43 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).left, nlevel + 1); if (_t43.state != 0) { /*or block*/ _option_v__ast__ComptTimeConstValue _t44; - memcpy(&_t44, &_t43, sizeof(Option)); + memcpy(&_t44, &_t43, sizeof(_option)); return _t44; } @@ -54164,7 +52270,7 @@ VV_LOCAL_SYMBOL _option_v__ast__ComptTimeConstValue v__checker__Checker_eval_com _option_v__ast__ComptTimeConstValue _t45 = v__checker__Checker_eval_comptime_const_expr(c, (*expr._v__ast__InfixExpr).right, nlevel + 1); if (_t45.state != 0) { /*or block*/ _option_v__ast__ComptTimeConstValue _t46; - memcpy(&_t46, &_t45, sizeof(Option)); + memcpy(&_t46, &_t45, sizeof(_option)); return _t46; } @@ -55203,7 +53309,7 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ bool _t1 = node->ct_skip; return _t1; } - if ((node->ct_expr)._typ == 307 /* v.ast.Ident */) { + if ((node->ct_expr)._typ == 309 /* v.ast.Ident */) { if (node->ct_opt) { if (Array_string_contains(_const_v__checker__valid_comptime_not_user_defined, (*node->ct_expr._v__ast__Ident).name)) { v__checker__Checker_error(c, _SLIT("optional `[if expression ?]` tags, can be used only for user defined identifiers"), node->pos); @@ -55240,15 +53346,15 @@ VV_LOCAL_SYMBOL bool v__checker__Checker_evaluate_once_comptime_if_attribute(v__ } 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 == 291 /* v.ast.BoolLiteral */) { + if (cond._typ == 293 /* v.ast.BoolLiteral */) { v__checker__ComptimeBranchSkipState _t1 = ((*cond._v__ast__BoolLiteral).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t1; } - else if (cond._typ == 322 /* v.ast.ParExpr */) { + else if (cond._typ == 324 /* v.ast.ParExpr */) { v__checker__ComptimeBranchSkipState _t2 = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__ParExpr).expr, pos); return _t2; } - else if (cond._typ == 324 /* v.ast.PrefixExpr */) { + else if (cond._typ == 326 /* 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); } @@ -55256,17 +53362,17 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 == 323 /* v.ast.PostfixExpr */) { + else if (cond._typ == 325 /* 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 == 307 /* v.ast.Ident */) { + } else if (((*cond._v__ast__PostfixExpr).expr)._typ == 309 /* v.ast.Ident */) { 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); } } - else if (cond._typ == 311 /* v.ast.InfixExpr */) { + else if (cond._typ == 313 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and)) { v__checker__ComptimeBranchSkipState l = v__checker__Checker_comptime_if_branch(c, (*cond._v__ast__InfixExpr).left, (*cond._v__ast__InfixExpr).pos); @@ -55289,19 +53395,19 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 == 333 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 333 /* v.ast.TypeNode */) { + if (((*cond._v__ast__InfixExpr).left)._typ == 335 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(*cond._v__ast__InfixExpr).right._v__ast__TypeNode).typ); if (sym->kind != v__ast__Kind__interface_) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); } v__checker__ComptimeBranchSkipState _t9 = v__checker__ComptimeBranchSkipState__unknown; return _t9; - } else if (((*cond._v__ast__InfixExpr).left)._typ == 333 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 300 /* 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, 333) /*expected idx: 333, name: v.ast.TypeNode */ ; + } else if (((*cond._v__ast__InfixExpr).left)._typ == 335 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 302 /* 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, 335) /*expected idx: 335, name: v.ast.TypeNode */ ; v__ast__Type checked_type = v__checker__Checker_unwrap_generic(c, left.typ); 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 == 327 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 333 /* v.ast.TypeNode */) { + } else if (((*cond._v__ast__InfixExpr).left)._typ == 329 /* v.ast.SelectorExpr */ || ((*cond._v__ast__InfixExpr).left)._typ == 335 /* v.ast.TypeNode */) { v__checker__Checker_expr(c, (*cond._v__ast__InfixExpr).left); v__checker__ComptimeBranchSkipState _t11 = v__checker__ComptimeBranchSkipState__unknown; return _t11; @@ -55310,8 +53416,8 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime } } else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__eq) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__ne)) { - if (((*cond._v__ast__InfixExpr).left)._typ == 327 /* v.ast.SelectorExpr */ && ((*cond._v__ast__InfixExpr).right)._typ == 312 /* v.ast.IntegerLiteral */) { - } else if (((*cond._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */) { + if (((*cond._v__ast__InfixExpr).left)._typ == 329 /* v.ast.SelectorExpr */ && ((*cond._v__ast__InfixExpr).right)._typ == 314 /* v.ast.IntegerLiteral */) { + } else if (((*cond._v__ast__InfixExpr).left)._typ == 309 /* 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 _t12 = v__checker__Checker_find_definition(c, (*(*cond._v__ast__InfixExpr).left._v__ast__Ident)); @@ -55339,7 +53445,7 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime v__checker__Checker_error(c, _SLIT("invalid `$if` condition"), (*cond._v__ast__InfixExpr).pos); }; } - else if (cond._typ == 307 /* v.ast.Ident */) { + else if (cond._typ == 309 /* 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_equal = true; @@ -55457,7 +53563,7 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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 != 365 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 363 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 364 /* v.ast.GlobalField */) { + if (((*cond._v__ast__Ident).obj)._typ != 367 /* v.ast.Var */ && ((*cond._v__ast__Ident).obj)._typ != 365 /* v.ast.ConstField */ && ((*cond._v__ast__Ident).obj)._typ != 366 /* 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); } @@ -55477,11 +53583,11 @@ VV_LOCAL_SYMBOL v__checker__ComptimeBranchSkipState v__checker__Checker_comptime 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); } - v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 291) /*expected idx: 291, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + v__checker__ComptimeBranchSkipState _t44 = ((/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)._v__ast__BoolLiteral,(expr)._typ, 293) /*expected idx: 293, name: v.ast.BoolLiteral */ ).val ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); return _t44; } } - else if (cond._typ == 298 /* v.ast.ComptimeCall */) { + else if (cond._typ == 300 /* v.ast.ComptimeCall */) { if ((*cond._v__ast__ComptimeCall).is_pkgconfig) { _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*/ @@ -55519,7 +53625,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra if (node->elem_type != 0) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, node->elem_type); if (elem_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct elem_info = /* as */ *(v__ast__Struct*)__as_cast((elem_sym->info)._v__ast__Struct,(elem_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct elem_info = /* as */ *(v__ast__Struct*)__as_cast((elem_sym->info)._v__ast__Struct,(elem_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (elem_info.generic_types.len > 0 && elem_info.concrete_types.len == 0 && !v__ast__Type_has_flag(node->elem_type, v__ast__TypeFlag__generic)) { if (c->table->cur_concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic struct must specify type parameter, e.g. Foo"), node->elem_type_pos); @@ -55592,7 +53698,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra } v__ast__Array array_info = v__ast__TypeSymbol_array_info(type_sym); node->elem_type = array_info.elem_type; - v__ast__Type _t6 = v__ast__Type_clear_flag(c->expected_type, v__ast__TypeFlag__optional); + v__ast__Type _t6 = v__ast__Type_clear_flag((v__ast__Type_has_flag(c->expected_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(v__ast__Type_clear_flag(c->expected_type, v__ast__TypeFlag__shared_f))) : (c->expected_type)), v__ast__TypeFlag__optional); return _t6; } if (node->exprs.len > 0 && v__ast__Type_alias_eq(node->elem_type, _const_v__ast__void_type)) { @@ -55652,7 +53758,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra c->expected_type = elem_type; continue; } - if ((expr)->_typ != 333 /* v.ast.TypeNode */) { + if ((expr)->_typ != 335 /* v.ast.TypeNode */) { if (v__ast__Table_type_kind(c->table, elem_type) == v__ast__Kind__interface_) { if (v__checker__Checker_type_implements(c, typ, elem_type, v__ast__Expr_pos(/*rec*/*expr))) { continue; @@ -55688,11 +53794,11 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra i64 fixed_size = ((i64)(0)); v__ast__Expr init_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, 0)); v__checker__Checker_expr(c, init_expr); - if (init_expr._typ == 312 /* v.ast.IntegerLiteral */) { + if (init_expr._typ == 314 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*init_expr._v__ast__IntegerLiteral).val); } - else if (init_expr._typ == 307 /* v.ast.Ident */) { - if (((*init_expr._v__ast__Ident).obj)._typ == 363 /* v.ast.ConstField */) { + else if (init_expr._typ == 309 /* v.ast.Ident */) { + if (((*init_expr._v__ast__Ident).obj)._typ == 365 /* v.ast.ConstField */) { _option_v__ast__ComptTimeConstValue _t9; if (_t9 = v__checker__Checker_eval_comptime_const_expr(c, (*(*init_expr._v__ast__Ident).obj._v__ast__ConstField).expr, 0), _t9.state == 0) { v__ast__ComptTimeConstValue comptime_value = *(v__ast__ComptTimeConstValue*)_t9.data; @@ -55708,7 +53814,7 @@ v__ast__Type v__checker__Checker_array_init(v__checker__Checker* c, v__ast__Arra v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("non-constant array bound `"), /*115 &string*/0xfe10, {.d_s = (*init_expr._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*init_expr._v__ast__Ident).pos); } } - else if (init_expr._typ == 311 /* v.ast.InfixExpr */) { + else if (init_expr._typ == 313 /* v.ast.InfixExpr */) { _option_v__ast__ComptTimeConstValue _t11; if (_t11 = v__checker__Checker_eval_comptime_const_expr(c, init_expr, 0), _t11.state == 0) { v__ast__ComptTimeConstValue comptime_value = *(v__ast__ComptTimeConstValue*)_t11.data; @@ -55782,7 +53888,7 @@ v__ast__Type v__checker__Checker_map_init(v__checker__Checker* c, v__ast__MapIni if (info.value_type != 0) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(c->table, info.value_type); if (val_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct val_info = /* as */ *(v__ast__Struct*)__as_cast((val_sym->info)._v__ast__Struct,(val_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct val_info = /* as */ *(v__ast__Struct*)__as_cast((val_sym->info)._v__ast__Struct,(val_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (val_info.generic_types.len > 0 && val_info.concrete_types.len == 0 && !v__ast__Type_has_flag(info.value_type, v__ast__TypeFlag__generic)) { if (c->table->cur_concrete_types.len == 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("generic struct `"), /*115 &string*/0xfe10, {.d_s = val_sym->name}}, {_SLIT("` must specify type parameter, e.g. Foo"), 0, { .d_c = 0 }}})), node->pos); @@ -55932,14 +54038,14 @@ v__ast__Scope* prev_fn_scope; } if (node->generic_names.len > 0) { v__ast__TypeSymbol* gs = v__ast__Table_sym(c->table, node->return_type); - if ((gs->info)._typ == 457 /* v.ast.Struct */) { + if ((gs->info)._typ == 459 /* v.ast.Struct */) { if ((*gs->info._v__ast__Struct).is_generic && !v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, _SLIT("return generic struct in fn declaration must specify the generic type names, e.g. Foo"), node->return_type_pos); } } } v__ast__TypeSymbol* return_sym = v__ast__Table_final_sym(c->table, node->return_type); - if ((return_sym->info)._typ == 483 /* v.ast.MultiReturn */) { + if ((return_sym->info)._typ == 485 /* v.ast.MultiReturn */) { for (int _t4 = 0; _t4 < (*return_sym->info._v__ast__MultiReturn).types.len; ++_t4) { v__ast__Type multi_type = ((v__ast__Type*)(*return_sym->info._v__ast__MultiReturn).types.data)[_t4]; v__ast__TypeSymbol* multi_sym = v__ast__Table_sym(c->table, multi_type); @@ -55990,13 +54096,13 @@ v__ast__Scope* prev_fn_scope; return; } if (sym->kind == v__ast__Kind__interface_ && v__ast__TypeSymbol_has_method(sym, node->name)) { - if ((sym->info)._typ == 475 /* v.ast.Interface */) { + if ((sym->info)._typ == 477 /* v.ast.Interface */) { if (v__ast__Interface_has_method(&(*sym->info._v__ast__Interface), node->name)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` cannot implement its own interface method `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } } - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { _option_v__ast__StructField _t6; if (_t6 = v__ast__Table_find_field(c->table, sym, node->name), _t6.state == 0) { v__ast__StructField field = *(v__ast__StructField*)_t6.data; @@ -56055,7 +54161,7 @@ v__ast__Scope* prev_fn_scope; if (!v__ast__Type_is_ptr(param->typ)) { v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, param->typ); if (arg_typ_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((arg_typ_sym->info)._v__ast__Struct,(arg_typ_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (info.is_heap) { _option_v__ast__Var_ptr _t9 = v__ast__Scope_find_var(node->scope, param->name); if (_t9.state != 0) { /*or block*/ @@ -56070,12 +54176,12 @@ v__ast__Scope* prev_fn_scope; v__checker__Checker_error(c, _SLIT("generic struct in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__interface_) { - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((arg_typ_sym->info)._v__ast__Interface,(arg_typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic interface in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } } else if (arg_typ_sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((arg_typ_sym->info)._v__ast__SumType,(arg_typ_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; if (info.generic_types.len > 0 && !v__ast__Type_has_flag(param->typ, v__ast__TypeFlag__generic) && info.concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("generic sumtype in fn declaration must specify the generic type names, e.g. Foo"), param->type_pos); } @@ -56152,7 +54258,7 @@ v__ast__Scope* prev_fn_scope; if (!c->pref->is_test) { for (int _t11 = 0; _t11 < node->stmts.len; ++_t11) { v__ast__Stmt st = ((v__ast__Stmt*)node->stmts.data)[_t11]; - if ((st)._typ == 338 /* v.ast.AssertStmt */) { + if ((st)._typ == 340 /* v.ast.AssertStmt */) { v__checker__Checker_warn(c, _SLIT("tests will not be run, because filename does not end with `_test.v`"), node->pos); break; } @@ -56167,13 +54273,13 @@ v__ast__Scope* prev_fn_scope; } c->expected_type = _const_v__ast__void_type; c->table->cur_fn = node; - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__optional) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 358 /* v.ast.Return */)) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__optional) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 360 /* v.ast.Return */)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->return_type); if (sym->kind == v__ast__Kind__void) { array_push((array*)&node->stmts, _MOV((v__ast__Stmt[]){ v__ast__Return_to_sumtype_v__ast__Stmt(ADDR(v__ast__Return, (((v__ast__Return){.pos = node->pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),})))) })); } } - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__result) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 358 /* v.ast.Return */)) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__result) && (node->stmts.len == 0 || ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 360 /* v.ast.Return */)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, node->return_type); if (sym->kind == v__ast__Kind__void) { array_push((array*)&node->stmts, _MOV((v__ast__Stmt[]){ v__ast__Return_to_sumtype_v__ast__Stmt(ADDR(v__ast__Return, (((v__ast__Return){.pos = node->pos,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.exprs = __new_array(0, 0, sizeof(v__ast__Expr)),.types = __new_array(0, 0, sizeof(v__ast__Type)),})))) })); @@ -56277,12 +54383,12 @@ v__ast__Type v__checker__Checker_call_expr(v__checker__Checker* c, v__ast__CallE if (!v__ast__Type_alias_eq(arg.typ, _const_v__ast__string_type)) { continue; } - if ((arg.expr)._typ == 307 /* v.ast.Ident */ || (arg.expr)._typ == 331 /* v.ast.StringLiteral */ || (arg.expr)._typ == 327 /* v.ast.SelectorExpr */) { + if ((arg.expr)._typ == 309 /* v.ast.Ident */ || (arg.expr)._typ == 333 /* v.ast.StringLiteral */ || (arg.expr)._typ == 329 /* v.ast.SelectorExpr */) { continue; } (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).is_tmp_autofree = true; } - if (v__ast__Type_alias_eq(node->receiver_type, _const_v__ast__string_type) && !((node->left)._typ == 307 /* v.ast.Ident */ || (node->left)._typ == 331 /* v.ast.StringLiteral */ || (node->left)._typ == 327 /* v.ast.SelectorExpr */)) { + if (v__ast__Type_alias_eq(node->receiver_type, _const_v__ast__string_type) && !((node->left)._typ == 309 /* v.ast.Ident */ || (node->left)._typ == 333 /* v.ast.StringLiteral */ || (node->left)._typ == 329 /* v.ast.SelectorExpr */)) { node->free_receiver = true; } } @@ -56346,7 +54452,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp return _t5; } c->table->cur_fn->has_await = true; - if (tsym->info._typ == 457 /* v.ast.Struct */) { + if (tsym->info._typ == 459 /* v.ast.Struct */) { v__ast__Type ret_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*tsym->info._v__ast__Struct).concrete_types, 0)); ret_type = v__ast__Type_set_flag(ret_type, v__ast__TypeFlag__optional); node->return_type = ret_type; @@ -56369,11 +54475,11 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp return _t8; } v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr; - if ((expr)._typ == 333 /* v.ast.TypeNode */) { + if ((expr)._typ == 335 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, (*expr._v__ast__TypeNode).typ)); if (v__ast__Table_known_type(c->table, sym->name) && sym->kind != v__ast__Kind__placeholder) { v__ast__Kind kind = sym->kind; - if ((sym->info)._typ == 472 /* v.ast.Alias */) { + if ((sym->info)._typ == 474 /* v.ast.Alias */) { kind = v__ast__Table_sym(c->table, (*sym->info._v__ast__Alias).parent_type)->kind; } if (!(kind == v__ast__Kind__struct_ || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__map || kind == v__ast__Kind__array)) { @@ -56393,7 +54499,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (!v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 1)).typ, _const_v__ast__string_type)) { v__checker__Checker_error(c, _SLIT("json.decode: second argument needs to be a string"), node->pos); } - v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast((expr)._v__ast__TypeNode,(expr)._typ, 333) /*expected idx: 333, name: v.ast.TypeNode */ ; + v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast((expr)._v__ast__TypeNode,(expr)._typ, 335) /*expected idx: 335, name: v.ast.TypeNode */ ; v__ast__Type ret_type = v__ast__Type_set_flag(typ.typ, v__ast__TypeFlag__optional); node->return_type = ret_type; v__ast__Type _t10 = ret_type; @@ -56402,12 +54508,12 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp 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 == 285 /* v.ast.AnonFn */) { + if ((node->left)._typ == 287 /* v.ast.AnonFn */) { node->name = _SLIT(""); v__checker__Checker_expr(c, node->left); if (!v__ast__Type_alias_eq((*node->left._v__ast__AnonFn).typ, ((v__ast__Type)(0)))) { v__ast__TypeSymbol* anon_fn_sym = v__ast__Table_sym(c->table, (*node->left._v__ast__AnonFn).typ); - func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((anon_fn_sym->info)._v__ast__FnType,(anon_fn_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; found = true; } } @@ -56422,54 +54528,48 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp (*(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 == 310 /* v.ast.IndexExpr */) { + if (!found && (node->left)._typ == 312 /* v.ast.IndexExpr */) { v__checker__Checker_expr(c, node->left); - v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); - if ((sym->info)._typ == 452 /* v.ast.Array */) { + v__ast__TypeSymbol* sym = v__ast__Table_final_sym(c->table, (*node->left._v__ast__IndexExpr).left_type); + if ((sym->info)._typ == 454 /* v.ast.Array */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Array).elem_type); - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { - node->return_type = (*elem_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t12 = (*elem_sym->info._v__ast__FnType).func.return_type; - return _t12; + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + func = (*elem_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the element of the array, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 453 /* v.ast.Map */) { + } else if ((sym->info)._typ == 455 /* v.ast.Map */) { v__ast__TypeSymbol* value_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__Map).value_type); - if ((value_sym->info)._typ == 484 /* v.ast.FnType */) { - node->return_type = (*value_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t13 = (*value_sym->info._v__ast__FnType).func.return_type; - return _t13; + if ((value_sym->info)._typ == 486 /* v.ast.FnType */) { + func = (*value_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the value of the map, it is not a function"), node->pos); } - } else if ((sym->info)._typ == 480 /* v.ast.ArrayFixed */) { + } else if ((sym->info)._typ == 482 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, (*sym->info._v__ast__ArrayFixed).elem_type); - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { - node->return_type = (*elem_sym->info._v__ast__FnType).func.return_type; - v__ast__Type _t14 = (*elem_sym->info._v__ast__FnType).func.return_type; - return _t14; + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { + func = (*elem_sym->info._v__ast__FnType).func; + found = true; } else { v__checker__Checker_error(c, _SLIT("cannot call the element of the array, it is not a function"), node->pos); } } - found = true; - v__ast__Type _t15 = _const_v__ast__string_type; - return _t15; } - if (!found && (node->left)._typ == 293 /* v.ast.CallExpr */) { + if (!found && (node->left)._typ == 295 /* v.ast.CallExpr */) { v__checker__Checker_expr(c, node->left); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*node->left._v__ast__CallExpr).return_type); - if ((sym->info)._typ == 484 /* v.ast.FnType */) { + if ((sym->info)._typ == 486 /* v.ast.FnType */) { node->return_type = (*sym->info._v__ast__FnType).func.return_type; found = true; func = (*sym->info._v__ast__FnType).func; } } if (!found) { - _option_v__ast__Fn _t16; - if (_t16 = v__ast__Table_find_fn(c->table, fn_name), _t16.state == 0) { - v__ast__Fn f = *(v__ast__Fn*)_t16.data; + _option_v__ast__Fn _t12; + if (_t12 = v__ast__Table_find_fn(c->table, fn_name), _t12.state == 0) { + v__ast__Fn f = *(v__ast__Fn*)_t12.data; found = true; func = f; (*(v__ast__Fn*)map_get((map*)&c->table->fns, &(string[]){fn_name}, &(v__ast__Fn[]){ (v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,} })).usages++; @@ -56486,9 +54586,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } if (!found && c->pref->is_vsh) { string os_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("os."), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT0, 0, { .d_c = 0 }}})); - _option_v__ast__Fn _t17; - if (_t17 = v__ast__Table_find_fn(c->table, os_name), _t17.state == 0) { - v__ast__Fn f = *(v__ast__Fn*)_t17.data; + _option_v__ast__Fn _t13; + if (_t13 = v__ast__Table_find_fn(c->table, os_name), _t13.state == 0) { + v__ast__Fn f = *(v__ast__Fn*)_t13.data; if (f.generic_names.len == node->concrete_types.len) { string node_alias_name = v__ast__CallExpr_fkey(node); map_set(&c->table->fn_generic_types, &(string[]){os_name}, &(Array_Array_v__ast__Type[]) { (*(Array_Array_v__ast__Type*)map_get(ADDR(map, c->table->fn_generic_types), &(string[]){node_alias_name}, &(Array_Array_v__ast__Type[]){ __new_array(0, 0, sizeof(Array_v__ast__Type)) })) }); @@ -56500,27 +54600,27 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } if (is_native_builtin) { - v__ast__Type _t18 = _const_v__ast__void_type; - return _t18; + v__ast__Type _t14 = _const_v__ast__void_type; + return _t14; } if (!found) { int typ = 0; - _option_v__ast__ScopeObject _t19; - if (_t19 = v__ast__Scope_find(node->scope, node->name), _t19.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t19.data; - if (obj._typ == 364 /* v.ast.GlobalField */) { + _option_v__ast__ScopeObject _t15; + if (_t15 = v__ast__Scope_find(node->scope, node->name), _t15.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t15.data; + if (obj._typ == 366 /* v.ast.GlobalField */) { typ = (*obj._v__ast__GlobalField).typ; node->is_fn_var = true; node->fn_var_type = typ; } - else if (obj._typ == 365 /* v.ast.Var */) { - v__ast__Type _t20; /* if prepend */ + else if (obj._typ == 367 /* v.ast.Var */) { + v__ast__Type _t16; /* if prepend */ if ((*obj._v__ast__Var).smartcasts.len != 0) { - _t20 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); + _t16 = (*(v__ast__Type*)array_last((*obj._v__ast__Var).smartcasts)); } else { - _t20 = (*obj._v__ast__Var).typ; + _t16 = (*obj._v__ast__Var).typ; } - typ = _t20; + typ = _t16; node->is_fn_var = true; node->fn_var_type = typ; } @@ -56532,14 +54632,14 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp if (typ != 0) { v__ast__TypeSymbol* generic_vts = v__ast__Table_final_sym(c->table, typ); if (generic_vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((generic_vts->info)._v__ast__FnType,(generic_vts->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; } else { v__ast__TypeSymbol* vts = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, typ)); if (vts->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((vts->info)._v__ast__FnType,(vts->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; func = info.func; found = true; found_in_args = true; @@ -56548,52 +54648,52 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } } if (!found) { - _option_v__ast__ScopeObject _t21; - if (_t21 = v__ast__Scope_find(c->file->global_scope, fn_name), _t21.state == 0) { - v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t21.data; + _option_v__ast__ScopeObject _t17; + if (_t17 = v__ast__Scope_find(c->file->global_scope, fn_name), _t17.state == 0) { + v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t17.data; if ((*(obj.typ)) != 0) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*(obj.typ))); if (sym->kind == v__ast__Kind__function) { found = true; - func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ).func; + func = (/* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ).func; } } } } if (!found) { *continue_check = false; - _option_int _t22; - if (_t22 = string_index(fn_name, _SLIT(".")), _t22.state == 0) { - int dot_index = *(int*)_t22.data; + _option_int _t18; + if (_t18 = string_index(fn_name, _SLIT(".")), _t18.state == 0) { + int dot_index = *(int*)_t18.data; if (!u8_is_capital(string_at(fn_name, 0))) { string mod_name = string_substr_ni(fn_name, 0, dot_index); Array_string mod_func_names = __new_array_with_default(0, 0, sizeof(string), 0); - Map_string_v__ast__Fn _t23 = c->table->fns; - int _t25 = _t23.key_values.len; - for (int _t24 = 0; _t24 < _t25; ++_t24 ) { - int _t26 = _t23.key_values.len - _t25; - _t25 = _t23.key_values.len; - if (_t26 < 0) { - _t24 = -1; + Map_string_v__ast__Fn _t19 = c->table->fns; + int _t21 = _t19.key_values.len; + for (int _t20 = 0; _t20 < _t21; ++_t20 ) { + int _t22 = _t19.key_values.len - _t21; + _t21 = _t19.key_values.len; + if (_t22 < 0) { + _t20 = -1; continue; } - if (!DenseArray_has_index(&_t23.key_values, _t24)) {continue;} - string ctfnk = /*key*/ *(string*)DenseArray_key(&_t23.key_values, _t24); + if (!DenseArray_has_index(&_t19.key_values, _t20)) {continue;} + string ctfnk = /*key*/ *(string*)DenseArray_key(&_t19.key_values, _t20); ctfnk = string_clone(ctfnk); - v__ast__Fn ctfnv = (*(v__ast__Fn*)DenseArray_value(&_t23.key_values, _t24)); + v__ast__Fn ctfnv = (*(v__ast__Fn*)DenseArray_value(&_t19.key_values, _t20)); if (ctfnv.is_pub && string_starts_with(ctfnk, mod_name)) { array_push((array*)&mod_func_names, _MOV((string[]){ string_clone(ctfnk) })); } } v__util__Suggestion suggestion = v__util__new_suggestion(fn_name, mod_func_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown function: "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT(" "), 0, { .d_c = 0 }}}))), node->pos); - v__ast__Type _t28 = _const_v__ast__void_type; - return _t28; + v__ast__Type _t24 = _const_v__ast__void_type; + return _t24; } } v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown function: "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); - v__ast__Type _t29 = _const_v__ast__void_type; - return _t29; + v__ast__Type _t25 = _const_v__ast__void_type; + return _t25; } node->is_noreturn = func.is_noreturn; node->is_ctor_new = func.is_ctor_new; @@ -56619,29 +54719,29 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp string plural = (func.generic_names.len == 1 ? (_SLIT("")) : (_SLIT("s"))); v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("expected "), /*100 &int*/0xfe07, {.d_i32 = func.generic_names.len}}, {_SLIT(" generic parameter"), /*115 &string*/0xfe10, {.d_s = plural}}, {_SLIT(", got "), /*100 &int*/0xfe07, {.d_i32 = node->concrete_types.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->concrete_list_pos); } - for (int _t30 = 0; _t30 < node->concrete_types.len; ++_t30) { - v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t30]; - _option_void _t31 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); - if (_t31.state != 0 && _t31.err._typ != _IError_None___index) { - IError err = _t31.err; + for (int _t26 = 0; _t26 < node->concrete_types.len; ++_t26) { + v__ast__Type concrete_type = ((v__ast__Type*)node->concrete_types.data)[_t26]; + _option_void _t27 = v__checker__Checker_ensure_type_exists(c, concrete_type, node->concrete_list_pos); + if (_t27.state != 0 && _t27.err._typ != _IError_None___index) { + IError err = _t27.err; } ; } if (func.generic_names.len > 0 && node->args.len == 0 && node->concrete_types.len == 0) { v__checker__Checker_error(c, _SLIT("no argument generic function must add concrete types, e.g. foo()"), node->pos); - v__ast__Type _t32 = func.return_type; - return _t32; + v__ast__Type _t28 = func.return_type; + return _t28; } if (v__ast__Type_alias_eq(func.return_type, _const_v__ast__void_type) && func.is_conditional && func.ctdefine_idx != _const_v__ast__invalid_type_idx) { node->should_be_skipped = v__checker__Checker_evaluate_once_comptime_if_attribute(c, (voidptr)&/*qq*/(*(v__ast__Attr*)/*ee elem_sym */array_get(func.attrs, func.ctdefine_idx))); } if (node->language != v__ast__Language__js) { - _option_void _t33 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/func); - if (_t33.state != 0 && _t33.err._typ != _IError_None___index) { - IError err = _t33.err; - v__ast__Type _t34 = func.return_type; - return _t34; + _option_void _t29 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/func); + if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { + IError err = _t29.err; + v__ast__Type _t30 = func.return_type; + return _t30; } ; @@ -56660,8 +54760,8 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_fail_if_unreadable(c, arg.expr, arg.typ, _SLIT("argument to print")); c->inside_println_arg = false; node->return_type = _const_v__ast__void_type; - v__ast__Type _t35 = func.return_type; - return _t35; + v__ast__Type _t31 = func.return_type; + return _t31; } if (node->args.len == 1 && string__eq(fn_name, _SLIT("error"))) { v__ast__CallArg arg = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)); @@ -56670,12 +54770,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_warn(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`error("), /*115 &v.ast.CallArg*/0xfe10, {.d_s = v__ast__CallArg_str(arg)}}, {_SLIT(")` can be shortened to just `"), /*115 &v.ast.CallArg*/0xfe10, {.d_s = v__ast__CallArg_str(arg)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } - if (node->expected_arg_types.len == 0) { - for (int _t36 = 0; _t36 < func.params.len; ++_t36) { - v__ast__Param param = ((v__ast__Param*)func.params.data)[_t36]; - array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ param.typ })); - } - } + v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/func); if (!v__pref__Backend_is_js(c->pref->backend) && node->args.len > 0 && func.params.len == 0) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("too many arguments in call to `"), /*115 &string*/0xfe10, {.d_s = func.name}}, {_SLIT("` (non-js backend: "), /*115 &v.pref.Backend*/0xfe10, {.d_s = v__pref__Backend_str(c->pref->backend)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), node->pos); } @@ -56685,25 +54780,25 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } v__ast__Param param = (func.is_variadic && i >= func.params.len - 1 ? ((*(v__ast__Param*)/*ee elem_sym */array_get(func.params, func.params.len - 1))) : ((*(v__ast__Param*)/*ee elem_sym */array_get(func.params, i)))); - if (func.is_variadic && (call_arg->expr)._typ == 286 /* v.ast.ArrayDecompose */) { + if (func.is_variadic && (call_arg->expr)._typ == 288 /* v.ast.ArrayDecompose */) { if (i > func.params.len - 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("too many arguments in call to `"), /*115 &string*/0xfe10, {.d_s = func.name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } } c->expected_type = param.typ; v__ast__TypeSymbol* e_sym = v__ast__Table_sym(c->table, c->expected_type); - if ((call_arg->expr)._typ == 316 /* v.ast.MapInit */ && e_sym->kind == v__ast__Kind__struct_) { + if ((call_arg->expr)._typ == 318 /* v.ast.MapInit */ && e_sym->kind == v__ast__Kind__struct_) { v__checker__Checker_error(c, _SLIT("cannot initialize a struct with a map"), call_arg->pos); continue; - } else if ((call_arg->expr)._typ == 332 /* v.ast.StructInit */ && e_sym->kind == v__ast__Kind__map) { + } else if ((call_arg->expr)._typ == 334 /* v.ast.StructInit */ && e_sym->kind == v__ast__Kind__map) { v__checker__Checker_error(c, _SLIT("cannot initialize a map with a struct"), call_arg->pos); continue; } v__ast__Type arg_typ = v__checker__Checker_check_expr_opt_call(c, call_arg->expr, v__checker__Checker_expr(c, call_arg->expr)); (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).typ = arg_typ; if (c->inside_comptime_for_field) { - if ((call_arg->expr)._typ == 307 /* v.ast.Ident */) { - if (((*call_arg->expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((call_arg->expr)._typ == 309 /* v.ast.Ident */) { + if (((*call_arg->expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, i)).typ = (*(*call_arg->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -56718,9 +54813,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp v__checker__Checker_error(c, _SLIT("function with `shared` arguments cannot be called inside `lock`/`rlock` block"), call_arg->pos); } if (call_arg->is_mut) { - multi_return_string_v__token__Pos mr_29230 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); - string to_lock = mr_29230.arg0; - v__token__Pos pos = mr_29230.arg1; + multi_return_string_v__token__Pos mr_28912 = v__checker__Checker_fail_if_immutable(c, call_arg->expr); + string to_lock = mr_28912.arg0; + v__token__Pos pos = mr_28912.arg1; if (!v__ast__Expr_is_lvalue(call_arg->expr)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(call_arg->expr)); } @@ -56745,7 +54840,7 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } v__ast__TypeSymbol* final_param_sym = param_typ_sym; v__ast__Type final_param_typ = param.typ; - if (func.is_variadic && (param_typ_sym->info)._typ == 452 /* v.ast.Array */) { + if (func.is_variadic && (param_typ_sym->info)._typ == 454 /* v.ast.Array */) { final_param_typ = (*param_typ_sym->info._v__ast__Array).elem_type; final_param_sym = v__ast__Table_sym(c->table, final_param_typ); } @@ -56760,19 +54855,16 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } - _option_void _t38 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); - if (_t38.state != 0 && _t38.err._typ != _IError_None___index) { - IError err = _t38.err; - if (arg_typ_sym->kind == v__ast__Kind__void && param_typ_sym->kind == v__ast__Kind__string) { - continue; - } + _option_void _t32 = v__checker__Checker_check_expected_call_arg(c, arg_typ, v__checker__Checker_unwrap_generic(c, param.typ), node->language, *call_arg); + if (_t32.state != 0 && _t32.err._typ != _IError_None___index) { + IError err = _t32.err; if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic)) { continue; } if (param_typ_sym->kind == v__ast__Kind__array && arg_typ_sym->kind == v__ast__Kind__array) { - v__ast__Array param_info = /* as */ *(v__ast__Array*)__as_cast((param_typ_sym->info)._v__ast__Array,(param_typ_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array param_info = /* as */ *(v__ast__Array*)__as_cast((param_typ_sym->info)._v__ast__Array,(param_typ_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type param_elem_type = v__ast__Table_unaliased_type(c->table, param_info.elem_type); - v__ast__Array arg_info = /* as */ *(v__ast__Array*)__as_cast((arg_typ_sym->info)._v__ast__Array,(arg_typ_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array arg_info = /* as */ *(v__ast__Array*)__as_cast((arg_typ_sym->info)._v__ast__Array,(arg_typ_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type arg_elem_type = v__ast__Table_unaliased_type(c->table, arg_info.elem_type); if (v__ast__Type_nr_muls(param.typ) == v__ast__Type_nr_muls(arg_typ) && param_info.nr_dims == arg_info.nr_dims && v__ast__Type_alias_eq(param_elem_type, arg_elem_type)) { continue; @@ -56811,11 +54903,11 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp continue; } if (arg_typ_sym_->kind == v__ast__Kind__array && param_typ_sym_->kind == v__ast__Kind__array) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((arg_typ_sym_->info)._v__ast__Array,(arg_typ_sym_->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((param_typ_sym_->info)._v__ast__Array,(param_typ_sym_->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((arg_typ_sym_->info)._v__ast__Array,(arg_typ_sym_->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__Array*)__as_cast((param_typ_sym_->info)._v__ast__Array,(param_typ_sym_->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type)) { continue; } } else if (arg_typ_sym_->kind == v__ast__Kind__array_fixed && param_typ_sym_->kind == v__ast__Kind__array_fixed) { - if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ).elem_type)) { + if (v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((arg_typ_sym_->info)._v__ast__ArrayFixed,(arg_typ_sym_->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type) && v__ast__Type_is_any_kind_of_pointer((/* as */ *(v__ast__ArrayFixed*)__as_cast((param_typ_sym_->info)._v__ast__ArrayFixed,(param_typ_sym_->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ).elem_type)) { continue; } } @@ -56846,9 +54938,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp c->expected_type = param.typ; v__ast__Type typ = v__checker__Checker_check_expr_opt_call(c, call_arg->expr, v__checker__Checker_expr(c, call_arg->expr)); if (v__ast__Type_has_flag(param.typ, v__ast__TypeFlag__generic) && func.generic_names.len == node->concrete_types.len) { - _option_v__ast__Type _t39; - if (_t39 = v__ast__Table_resolve_generic_to_concrete(c->table, param.typ, func.generic_names, concrete_types), _t39.state == 0) { - v__ast__Type unwrap_typ = *(v__ast__Type*)_t39.data; + _option_v__ast__Type _t33; + if (_t33 = v__ast__Table_resolve_generic_to_concrete(c->table, param.typ, func.generic_names, concrete_types), _t33.state == 0) { + v__ast__Type unwrap_typ = *(v__ast__Type*)_t33.data; v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* unwrap_sym = v__ast__Table_sym(c->table, unwrap_typ); if (unwrap_sym->kind == v__ast__Kind__interface_) { @@ -56859,9 +54951,9 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp } continue; } - _option_void _t40 = v__checker__Checker_check_expected_call_arg(c, utyp, unwrap_typ, node->language, *call_arg); - if (_t40.state != 0 && _t40.err._typ != _IError_None___index) { - IError err = _t40.err; + _option_void _t34 = v__checker__Checker_check_expected_call_arg(c, utyp, unwrap_typ, node->language, *call_arg); + if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { + IError err = _t34.err; if (c->comptime_fields_type.len > 0) { continue; } @@ -56880,38 +54972,38 @@ v__ast__Type v__checker__Checker_fn_call(v__checker__Checker* c, v__ast__CallExp node->return_type = func.return_type; } if (node->concrete_types.len > 0 && func.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { - _option_v__ast__Type _t41; - if (_t41 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t41.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t41.data; + _option_v__ast__Type _t35; + if (_t35 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t35.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t35.data; node->return_type = typ; - v__ast__Type _t42 = typ; - return _t42; + v__ast__Type _t36 = typ; + return _t36; } } if (node->concrete_types.len > 0 && func.generic_names.len == 0) { v__checker__Checker_error(c, _SLIT("a non generic function called like a generic one"), node->concrete_list_pos); } if (func.generic_names.len > 0) { - _option_v__ast__Type _t43; + _option_v__ast__Type _t37; if (has_generic) { - _option_v__ast__Type _t44; - if (_t44 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, node->concrete_types), _t44.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t44.data; + _option_v__ast__Type _t38; + if (_t38 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, node->concrete_types), _t38.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t38.data; if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__generic)) { node->return_type = typ; } } - v__ast__Type _t45 = node->return_type; - return _t45; - } else if (_t43 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t43.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t43.data; + v__ast__Type _t39 = node->return_type; + return _t39; + } else if (_t37 = v__ast__Table_resolve_generic_to_concrete(c->table, func.return_type, func.generic_names, concrete_types), _t37.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t37.data; node->return_type = typ; - v__ast__Type _t46 = typ; - return _t46; + v__ast__Type _t40 = typ; + return _t40; } } - v__ast__Type _t47 = func.return_type; - return _t47; + v__ast__Type _t41 = func.return_type; + return _t41; } v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__CallExpr* node) { @@ -56965,7 +55057,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t8 = v__checker__Checker_map_builtin_method_call(c, node, left_type, *left_sym); return _t8; } else { - v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + v__ast__Type parent_type = (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; v__ast__Type _t9 = v__checker__Checker_map_builtin_method_call(c, node, parent_type, *final_left_sym); return _t9; } @@ -56990,19 +55082,19 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal return _t12; } } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Expr arg_expr = (string__eq(method_name, _SLIT("insert")) ? ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 1)).expr) : ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)); v__ast__Type arg_type = v__checker__Checker_expr(c, arg_expr); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); if (!v__checker__Checker_check_types(c, arg_type, info.elem_type) && !v__checker__Checker_check_types(c, left_type, arg_type)) { v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("cannot "), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT(" `"), /*115 &string*/0xfe10, {.d_s = arg_sym->name}}, {_SLIT("` to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg_expr)); } - } else if ((final_left_sym->info)._typ == 452 /* v.ast.Array */ && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { + } else if ((final_left_sym->info)._typ == 454 /* v.ast.Array */ && (string__eq(method_name, _SLIT("first")) || string__eq(method_name, _SLIT("last")) || string__eq(method_name, _SLIT("pop")))) { node->return_type = (*final_left_sym->info._v__ast__Array).elem_type; v__ast__Type _t13 = node->return_type; return _t13; } else if (v__pref__Backend_is_js(c->pref->backend) && string_starts_with(left_sym->name, _SLIT("Promise<")) && string__eq(method_name, _SLIT("wait"))) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -57012,7 +55104,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type _t14 = node->return_type; return _t14; } else if (left_sym->kind == v__ast__Kind__thread && string__eq(method_name, _SLIT("wait"))) { - v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.Thread */ ; + v__ast__Thread info = /* as */ *(v__ast__Thread*)__as_cast((left_sym->info)._v__ast__Thread,(left_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.Thread */ ; if (node->args.len > 0) { v__checker__Checker_error(c, _SLIT("wait() does not have any arguments"), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } @@ -57036,11 +55128,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal IError err = _t17.err; if (left_sym->kind == v__ast__Kind__struct_ || left_sym->kind == v__ast__Kind__sum_type || left_sym->kind == v__ast__Kind__interface_) { v__ast__Type parent_type = _const_v__ast__void_type; - if ((left_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((left_sym->info)._typ == 459 /* v.ast.Struct */) { parent_type = (*left_sym->info._v__ast__Struct).parent_type; - } else if ((left_sym->info)._typ == 476 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 478 /* v.ast.SumType */) { parent_type = (*left_sym->info._v__ast__SumType).parent_type; - } else if ((left_sym->info)._typ == 475 /* v.ast.Interface */) { + } else if ((left_sym->info)._typ == 477 /* v.ast.Interface */) { parent_type = (*left_sym->info._v__ast__Interface).parent_type; } if (parent_type != 0) { @@ -57067,9 +55159,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t19.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_43470 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); - method = mr_43470.arg0; - embed_types = mr_43470.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_42752 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t19.data); + method = mr_42752.arg0; + embed_types = mr_42752.arg1; if (embed_types.len != 0) { is_method_from_embed = true; node->from_embed_types = embed_types; @@ -57083,7 +55175,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__TypeSymbol* rec_sym = v__ast__Table_sym(c->table, node->left_type); bool rec_is_generic = v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic); Array_v__ast__Type rec_concrete_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); - if ((rec_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((rec_sym->info)._typ == 459 /* v.ast.Struct */) { rec_concrete_types = array_clone_to_depth(&(*rec_sym->info._v__ast__Struct).concrete_types, 0); if (rec_is_generic && node->concrete_types.len == 0 && method.generic_names.len == (*rec_sym->info._v__ast__Struct).generic_types.len) { node->concrete_types = (*rec_sym->info._v__ast__Struct).generic_types; @@ -57117,9 +55209,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` receiver cannot be called inside `lock`/`rlock` block"), node->pos); } if ((*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).is_mut) { - multi_return_string_v__token__Pos mr_45780 = v__checker__Checker_fail_if_immutable(c, node->left); - string to_lock = mr_45780.arg0; - v__token__Pos pos = mr_45780.arg1; + multi_return_string_v__token__Pos mr_45062 = v__checker__Checker_fail_if_immutable(c, node->left); + string to_lock = mr_45062.arg0; + v__token__Pos pos = mr_45062.arg1; if (!v__ast__Expr_is_lvalue(node->left)) { v__checker__Checker_error(c, _SLIT("cannot pass expression as `mut`"), v__ast__Expr_pos(node->left)); } @@ -57159,7 +55251,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__ast__Type exp_arg_typ = ((v__ast__Type)(0)); bool param_is_mut = false; bool no_type_promotion = false; - if ((left_sym->info)._typ == 481 /* v.ast.Chan */) { + if ((left_sym->info)._typ == 483 /* v.ast.Chan */) { if (string__eq(method_name, _SLIT("try_push"))) { exp_arg_typ = v__ast__Type_ref((*left_sym->info._v__ast__Chan).elem_type); } else if (string__eq(method_name, _SLIT("try_pop"))) { @@ -57189,7 +55281,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } v__ast__TypeSymbol* final_arg_sym = exp_arg_sym; v__ast__Type final_arg_typ = exp_arg_typ; - if (method.is_variadic && (exp_arg_sym->info)._typ == 452 /* v.ast.Array */) { + if (method.is_variadic && (exp_arg_sym->info)._typ == 454 /* v.ast.Array */) { final_arg_typ = (*exp_arg_sym->info._v__ast__Array).elem_type; final_arg_sym = v__ast__Table_sym(c->table, final_arg_typ); } @@ -57227,9 +55319,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT("method with `shared` arguments cannot be called inside `lock`/`rlock` block"), arg->pos); } if (arg->is_mut) { - multi_return_string_v__token__Pos mr_49682 = v__checker__Checker_fail_if_immutable(c, arg->expr); - string to_lock = mr_49682.arg0; - v__token__Pos pos = mr_49682.arg1; + multi_return_string_v__token__Pos mr_48964 = v__checker__Checker_fail_if_immutable(c, arg->expr); + string to_lock = mr_48964.arg0; + v__token__Pos pos = mr_48964.arg1; if (!param_is_mut) { string tok = v__ast__ShareType_str(arg->share); v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` parameter `"), /*115 &string*/0xfe10, {.d_s = param.name}}, {_SLIT("` is not `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("`, `"), /*115 &string*/0xfe10, {.d_s = tok}}, {_SLIT("` is not needed`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(arg->expr)); @@ -57249,11 +55341,11 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_fail_if_unreadable(c, arg->expr, got_arg_typ, _SLIT("argument")); } } - if ((left_sym->info)._typ == 452 /* v.ast.Array */ && string__eq(method_name, _SLIT("sort_with_compare"))) { + if ((left_sym->info)._typ == 454 /* v.ast.Array */ && string__eq(method_name, _SLIT("sort_with_compare"))) { v__ast__Type elem_typ = (*left_sym->info._v__ast__Array).elem_type; v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg->typ); if (arg_sym->kind == v__ast__Kind__function) { - v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType func_info = /* as */ *(v__ast__FnType*)__as_cast((arg_sym->info)._v__ast__FnType,(arg_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; if (func_info.func.params.len == 2) { if (v__ast__Type_nr_muls((*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ) != v__ast__Type_nr_muls(elem_typ) + 1) { string arg_typ_str = v__ast__Table_type_to_str(c->table, (*(v__ast__Param*)/*ee elem_sym */array_get(func_info.func.params, 0)).typ); @@ -57284,16 +55376,14 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal IError err = _t31.err; v__ast__TypeSymbol* param_typ_sym = v__ast__Table_sym(c->table, exp_arg_typ); v__ast__TypeSymbol* arg_typ_sym = v__ast__Table_sym(c->table, got_arg_typ); - if ((param_typ_sym->info)._typ == 452 /* v.ast.Array */ && (arg_typ_sym->info)._typ == 452 /* v.ast.Array */) { + if ((param_typ_sym->info)._typ == 454 /* v.ast.Array */ && (arg_typ_sym->info)._typ == 454 /* v.ast.Array */) { v__ast__Type param_elem_type = v__ast__Table_unaliased_type(c->table, (*param_typ_sym->info._v__ast__Array).elem_type); v__ast__Type arg_elem_type = v__ast__Table_unaliased_type(c->table, (*arg_typ_sym->info._v__ast__Array).elem_type); if (v__ast__Type_nr_muls(exp_arg_typ) == v__ast__Type_nr_muls(got_arg_typ) && (*param_typ_sym->info._v__ast__Array).nr_dims == (*arg_typ_sym->info._v__ast__Array).nr_dims && v__ast__Type_alias_eq(param_elem_type, arg_elem_type)) { continue; } } - if (!v__ast__Type_alias_eq(got_arg_typ, _const_v__ast__void_type)) { - v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); - } + v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); ; } @@ -57305,11 +55395,7 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal if (!c->table->cur_fn->is_deprecated && method.is_deprecated) { v__checker__Checker_deprecate_fnmethod(c, _SLIT("method"), str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method.name}}, {_SLIT0, 0, { .d_c = 0 }}})), method, *node); } - if (node->expected_arg_types.len == 0) { - for (int i = 1; i < method.params.len; ++i) { - array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, i)).typ })); - } - } + v__checker__Checker_set_node_expected_arg_types(c, node, (voidptr)&/*qq*/method); if (is_method_from_embed) { node->receiver_type = v__ast__Type_derive((*(v__ast__Type*)array_last(node->from_embed_types)), (*(v__ast__Param*)/*ee elem_sym */array_get(method.params, 0)).typ); } else if (is_generic) { @@ -57331,12 +55417,12 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal node->return_type = method.return_type; } if (node->concrete_types.len > 0 && method.return_type != 0 && c->table->cur_fn->generic_names.len == 0) { - _option_v__ast__Type _t33; - if (_t33 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t33.state == 0) { - v__ast__Type typ = *(v__ast__Type*)_t33.data; + _option_v__ast__Type _t32; + if (_t32 = v__ast__Table_resolve_generic_to_concrete(c->table, method.return_type, method.generic_names, concrete_types), _t32.state == 0) { + v__ast__Type typ = *(v__ast__Type*)_t32.data; node->return_type = typ; - v__ast__Type _t34 = typ; - return _t34; + v__ast__Type _t33 = typ; + return _t33; } } if (node->concrete_types.len > 0 && method.generic_names.len == 0) { @@ -57344,17 +55430,17 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } if (method.generic_names.len > 0) { if (!v__ast__Type_has_flag(left_type, v__ast__TypeFlag__generic)) { - if ((left_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((left_sym->info)._typ == 459 /* v.ast.Struct */) { if (method.generic_names.len == (*left_sym->info._v__ast__Struct).concrete_types.len) { node->concrete_types = (*left_sym->info._v__ast__Struct).concrete_types; } } } - v__ast__Type _t35 = node->return_type; - return _t35; + v__ast__Type _t34 = node->return_type; + return _t34; } - v__ast__Type _t36 = method.return_type; - return _t36; + v__ast__Type _t35 = method.return_type; + return _t35; } if (string__eq(method_name, _SLIT("str"))) { if (left_sym->kind == v__ast__Kind__interface_) { @@ -57367,25 +55453,25 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal v__checker__Checker_error(c, _SLIT(".str() method calls should have no arguments"), node->pos); } v__checker__Checker_fail_if_unreadable(c, node->left, left_type, _SLIT("receiver")); - v__ast__Type _t37 = _const_v__ast__string_type; - return _t37; + v__ast__Type _t36 = _const_v__ast__string_type; + return _t36; } else if (string__eq(method_name, _SLIT("free"))) { - v__ast__Type _t38 = _const_v__ast__void_type; - return _t38; + v__ast__Type _t37 = _const_v__ast__void_type; + return _t37; } - _option_v__ast__StructField _t39; - if (_t39 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t39.state == 0) { - v__ast__StructField field = *(v__ast__StructField*)_t39.data; + _option_v__ast__StructField _t38; + if (_t38 = v__ast__Table_find_field_with_embeds(c->table, left_sym, method_name), _t38.state == 0) { + v__ast__StructField field = *(v__ast__StructField*)_t38.data; v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, field.typ)); if (field_sym->kind == v__ast__Kind__function) { node->is_method = false; node->is_field = true; - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; - _option_void _t40 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); - if (_t40.state != 0 && _t40.err._typ != _IError_None___index) { - IError err = _t40.err; - v__ast__Type _t41 = info.func.return_type; - return _t41; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; + _option_void _t39 = v__checker__Checker_check_expected_arg_count(c, node, (voidptr)&/*qq*/info.func); + if (_t39.state != 0 && _t39.err._typ != _IError_None___index) { + IError err = _t39.err; + v__ast__Type _t40 = info.func.return_type; + return _t40; } ; @@ -57398,9 +55484,9 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal array_push((array*)&earg_types, _MOV((v__ast__Type[]){ targ })); if (i < info.func.params.len) { v__ast__Type exp_arg_typ = (*(v__ast__Param*)/*ee elem_sym */array_get(info.func.params, i)).typ; - _option_void _t43 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); - if (_t43.state != 0 && _t43.err._typ != _IError_None___index) { - IError err = _t43.err; + _option_void _t42 = v__checker__Checker_check_expected_call_arg(c, targ, v__checker__Checker_unwrap_generic(c, exp_arg_typ), node->language, *arg); + if (_t42.state != 0 && _t42.err._typ != _IError_None___index) { + IError err = _t42.err; if (!v__ast__Type_alias_eq(targ, _const_v__ast__void_type)) { v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = IError_name_table[err._typ]._method_msg(err._object)}}, {_SLIT(" in argument "), /*100 &int*/0xfe07, {.d_i32 = i + 1}}, {_SLIT(" to `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), arg->pos); } @@ -57412,35 +55498,35 @@ v__ast__Type v__checker__Checker_method_call(v__checker__Checker* c, v__ast__Cal } node->expected_arg_types = earg_types; node->is_method = true; - _option_multi_return_v__ast__StructField_Array_v__ast__Type _t44 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); - if (_t44.state != 0) { /*or block*/ - IError err = _t44.err; - v__ast__Type _t45 = info.func.return_type; - return _t45; + _option_multi_return_v__ast__StructField_Array_v__ast__Type _t43 = v__ast__Table_find_field_from_embeds(c->table, left_sym, method_name); + if (_t43.state != 0) { /*or block*/ + IError err = _t43.err; + v__ast__Type _t44 = info.func.return_type; + return _t44; } - multi_return_v__ast__StructField_Array_v__ast__Type mr_57048 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t44.data); - node->from_embed_types = mr_57048.arg1; - v__ast__Type _t46 = info.func.return_type; - return _t46; + multi_return_v__ast__StructField_Array_v__ast__Type mr_56127 = (*(multi_return_v__ast__StructField_Array_v__ast__Type*)_t43.data); + node->from_embed_types = mr_56127.arg1; + v__ast__Type _t45 = info.func.return_type; + return _t45; } } if (!v__ast__Type_alias_eq(left_type, _const_v__ast__void_type)) { - Array_string _t47 = {0}; - Array_v__ast__Fn _t47_orig = left_sym->methods; - int _t47_len = _t47_orig.len; - _t47 = __new_array(0, _t47_len, sizeof(string)); + Array_string _t46 = {0}; + Array_v__ast__Fn _t46_orig = left_sym->methods; + int _t46_len = _t46_orig.len; + _t46 = __new_array(0, _t46_len, sizeof(string)); - for (int _t48 = 0; _t48 < _t47_len; ++_t48) { - v__ast__Fn it = ((v__ast__Fn*) _t47_orig.data)[_t48]; + for (int _t47 = 0; _t47 < _t46_len; ++_t47) { + v__ast__Fn it = ((v__ast__Fn*) _t46_orig.data)[_t47]; string ti = it.name; - array_push((array*)&_t47, &ti); + array_push((array*)&_t46, &ti); } - v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t47); + v__util__Suggestion suggestion = v__util__new_suggestion(method_name,_t46); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, unknown_method_msg), node->pos); } - v__ast__Type _t49 = _const_v__ast__void_type; - return _t49; + v__ast__Type _t48 = _const_v__ast__void_type; + return _t48; } VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, v__ast__GoExpr* node) { @@ -57467,6 +55553,15 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_go_expr(v__checker__Checker* c, return 0; } +VV_LOCAL_SYMBOL void v__checker__Checker_set_node_expected_arg_types(v__checker__Checker* c, v__ast__CallExpr* node, v__ast__Fn* func) { + if (node->expected_arg_types.len == 0) { + int start_idx = (func->is_method ? (1) : (0)); + for (int i = start_idx; i < func->params.len; ++i) { + array_push((array*)&node->expected_arg_types, _MOV((v__ast__Type[]){ (*(v__ast__Param*)/*ee elem_sym */array_get(func->params, i)).typ })); + } + } +} + VV_LOCAL_SYMBOL void v__checker__Checker_deprecate_fnmethod(v__checker__Checker* c, string kind, string name, v__ast__Fn the_fn, v__ast__CallExpr node) { string deprecation_message = _SLIT(""); time__Time now = time__now(); @@ -57553,7 +55648,7 @@ _option_void v__checker__Checker_check_expected_arg_count(v__checker__Checker* c if (min_required_params == nr_args + 1) { v__ast__Type last_typ = (*(v__ast__Param*)array_last(f->params)).typ; v__ast__TypeSymbol* last_sym = v__ast__Table_sym(c->table, last_typ); - if ((last_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((last_sym->info)._typ == 459 /* v.ast.Struct */) { Array_v__ast__Attr _t1 = {0}; Array_v__ast__Attr _t1_orig = (*last_sym->info._v__ast__Struct).attrs; int _t1_len = _t1_orig.len; @@ -57589,7 +55684,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke } v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(c->table, elem_typ); v__ast__Expr arg_expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (arg_expr._typ == 285 /* v.ast.AnonFn */) { + if (arg_expr._typ == 287 /* v.ast.AnonFn */) { if ((*arg_expr._v__ast__AnonFn).decl.params.len > 1) { v__checker__Checker_error(c, _SLIT("function needs exactly 1 argument"), (*arg_expr._v__ast__AnonFn).decl.pos); } else if (is_map && (v__ast__Type_alias_eq((*arg_expr._v__ast__AnonFn).decl.return_type, _const_v__ast__void_type) || !v__ast__Type_alias_eq((*(v__ast__Param*)/*ee elem_sym */array_get((*arg_expr._v__ast__AnonFn).decl.params, 0)).typ, elem_typ))) { @@ -57598,7 +55693,7 @@ 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, should use `fn(a "), /*115 &string*/0xfe10, {.d_s = elem_sym->name}}, {_SLIT(") bool {...}`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__AnonFn).decl.pos); } } - else if (arg_expr._typ == 307 /* v.ast.Ident */) { + else if (arg_expr._typ == 309 /* v.ast.Ident */) { if ((*arg_expr._v__ast__Ident).kind == v__ast__IdentKind__function) { _option_v__ast__Fn _t1 = v__ast__Table_find_fn(c->table, (*arg_expr._v__ast__Ident).name); if (_t1.state != 0) { /*or block*/ @@ -57616,9 +55711,9 @@ 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, should use `fn(a "), /*115 &string*/0xfe10, {.d_s = elem_sym->name}}, {_SLIT(") bool {...}`"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__Ident).pos); } } else if ((*arg_expr._v__ast__Ident).kind == v__ast__IdentKind__variable) { - if (((*arg_expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (((*arg_expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Expr expr = (*(*arg_expr._v__ast__Ident).obj._v__ast__Var).expr; - if ((expr)._typ == 285 /* v.ast.AnonFn */) { + if ((expr)._typ == 287 /* v.ast.AnonFn */) { if ((*expr._v__ast__AnonFn).decl.params.len > 1) { v__checker__Checker_error(c, _SLIT("function needs exactly 1 argument"), (*expr._v__ast__AnonFn).decl.pos); } else if (is_map && (v__ast__Type_alias_eq((*expr._v__ast__AnonFn).decl.return_type, _const_v__ast__void_type) || !v__ast__Type_alias_eq((*(v__ast__Param*)/*ee elem_sym */array_get((*expr._v__ast__AnonFn).decl.params, 0)).typ, elem_typ))) { @@ -57634,7 +55729,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_map_and_filter(v__checker__Checke } } } - else if (arg_expr._typ == 293 /* v.ast.CallExpr */) { + else if (arg_expr._typ == 295 /* v.ast.CallExpr */) { if (is_map && (v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, _const_v__ast__void_type) || v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, 0))) { 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("` does not return anything"), 0, { .d_c = 0 }}})), (*arg_expr._v__ast__CallExpr).pos); } else if (!is_map && !v__ast__Type_alias_eq((*arg_expr._v__ast__CallExpr).return_type, _const_v__ast__bool_type)) { @@ -57644,12 +55739,12 @@ 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 == 331 /* v.ast.StringLiteral */) { + else if (arg_expr._typ == 333 /* 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 == 330 /* v.ast.StringInterLiteral */) { + else if (arg_expr._typ == 332 /* 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); } @@ -57682,7 +55777,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_map_builtin_method_call(v__chec if (node->args.len != 0) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`."), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("()` does not have any arguments"), 0, { .d_c = 0 }}})), (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).pos); } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; int typ = (string__eq(method_name, _SLIT("keys")) ? (v__ast__Table_find_or_register_array(c->table, info.key_type)) : (v__ast__Table_find_or_register_array(c->table, info.value_type))); ret_type = ((typ)); } @@ -57691,7 +55786,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_map_builtin_method_call(v__chec if (node->args.len != 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected 1 argument, but got "), /*100 &int*/0xfe07, {.d_i32 = node->args.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((left_sym.info)._v__ast__Map,(left_sym.info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; v__ast__Type arg_type = v__checker__Checker_expr(c, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr); _option_void _t1 = v__checker__Checker_check_expected_call_arg(c, arg_type, info.key_type, node->language, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0))); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { @@ -57716,12 +55811,12 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("slice")) && !c->is_builtin_mod) { v__checker__Checker_error(c, _SLIT(".slice() is a private method, use `x[start..end]` instead"), node->pos); } - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left_sym.info)._v__ast__Array,(left_sym.info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left_sym.info)._v__ast__Array,(left_sym.info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; elem_typ = array_info.elem_type; if (string__eq(method_name, _SLIT("filter")) || string__eq(method_name, _SLIT("map")) || string__eq(method_name, _SLIT("any")) || string__eq(method_name, _SLIT("all"))) { v__checker__scope_register_it(node->scope, node->pos, elem_typ); } else if (string__eq(method_name, _SLIT("sort"))) { - if ((node->left)._typ == 293 /* v.ast.CallExpr */) { + if ((node->left)._typ == 295 /* v.ast.CallExpr */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the `sort()` method can be called only on mutable receivers, but `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str(node->left)}}, {_SLIT("` is a call expression"), 0, { .d_c = 0 }}})), node->pos); } v__checker__Checker_fail_if_immutable(c, node->left); @@ -57729,7 +55824,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (node->args.len > 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("expected 0 or 1 argument, but got "), /*100 &int*/0xfe07, {.d_i32 = node->args.len}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); } else if (node->args.len == 1) { - if (((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)._typ == 311 /* v.ast.InfixExpr */) { + if (((*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr)._typ == 313 /* v.ast.InfixExpr */) { if (!((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).op == v__token__Kind__gt || (*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).op == v__token__Kind__lt)) { v__checker__Checker_error(c, _SLIT("`.sort()` can only use `<` or `>` comparison"), node->pos); } @@ -57740,7 +55835,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch } else if (left_name == right_name) { v__checker__Checker_error(c, _SLIT("`.sort()` cannot use same argument"), node->pos); } - if ((((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 307 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 327 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 310 /* v.ast.IndexExpr */) || (((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 307 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 327 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 310 /* v.ast.IndexExpr */)) { + if ((((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 309 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 329 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).left)._typ != 312 /* v.ast.IndexExpr */) || (((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 309 /* v.ast.Ident */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 329 /* v.ast.SelectorExpr */ && ((*(*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, 0)).expr._v__ast__InfixExpr).right)._typ != 312 /* v.ast.IndexExpr */)) { v__checker__Checker_error(c, _SLIT("`.sort()` can only use ident, index or selector as argument, \ne.g. `arr.sort(a < b)`, `arr.sort(a.id < b.id)`, `arr.sort(a[0] < b[0])`"), node->pos); } } else { @@ -57772,7 +55867,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_array_builtin_method_call(v__ch if (string__eq(method_name, _SLIT("map"))) { v__checker__Checker_check_map_and_filter(c, true, elem_typ, *node); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(c->table, arg_type); - v__ast__Type ret_type = ((arg_sym->info._typ == 484 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); + v__ast__Type ret_type = ((arg_sym->info._typ == 486 /* v.ast.FnType */)? ((*arg_sym->info._v__ast__FnType).func.return_type) : (arg_type)); node->return_type = v__ast__Table_find_or_register_array(c->table, v__checker__Checker_unwrap_generic(c, ret_type)); if (v__ast__Type_has_flag(node->return_type, v__ast__TypeFlag__shared_f)) { node->return_type = v__ast__Type_deref(v__ast__Type_clear_flag(node->return_type, v__ast__TypeFlag__shared_f)); @@ -57867,10 +55962,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_c_stmt(v__checker__Checker* c, v__a } v__checker__Checker_expr(c, node.cond); if (node.has_inc) { - if ((node.inc)._typ == 339 /* v.ast.AssignStmt */) { + if ((node.inc)._typ == 341 /* v.ast.AssignStmt */) { for (int _t1 = 0; _t1 < (*node.inc._v__ast__AssignStmt).right.len; ++_t1) { v__ast__Expr right = ((v__ast__Expr*)(*node.inc._v__ast__AssignStmt).right.data)[_t1]; - if ((right)._typ == 293 /* v.ast.CallExpr */) { + if ((right)._typ == 295 /* v.ast.CallExpr */) { if ((*right._v__ast__CallExpr).or_block.stmts.len > 0) { v__checker__Checker_error(c, _SLIT("optionals are not allowed in `for statement increment` (yet)"), (*right._v__ast__CallExpr).pos); } @@ -57972,29 +56067,29 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_in_stmt(v__checker__Checker* c, v__ } if (node->val_is_mut) { value_type = v__ast__Type_ref(value_type); - if (node->cond._typ == 307 /* v.ast.Ident */) { - if (((*node->cond._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (node->cond._typ == 309 /* v.ast.Ident */) { + if (((*node->cond._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if (!(*(*node->cond._v__ast__Ident).obj._v__ast__Var).is_mut) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = (*(*node->cond._v__ast__Ident).obj._v__ast__Var).name}}, {_SLIT("` is immutable, it cannot be changed"), 0, { .d_c = 0 }}})), (*node->cond._v__ast__Ident).pos); } } } - else if (node->cond._typ == 287 /* v.ast.ArrayInit */) { + else if (node->cond._typ == 289 /* v.ast.ArrayInit */) { v__checker__Checker_error(c, _SLIT("array literal is immutable, it cannot be changed"), (*node->cond._v__ast__ArrayInit).pos); } - else if (node->cond._typ == 316 /* v.ast.MapInit */) { + else if (node->cond._typ == 318 /* v.ast.MapInit */) { v__checker__Checker_error(c, _SLIT("map literal is immutable, it cannot be changed"), (*node->cond._v__ast__MapInit).pos); } - else if (node->cond._typ == 327 /* v.ast.SelectorExpr */) { + else if (node->cond._typ == 329 /* v.ast.SelectorExpr */) { _option_v__ast__Ident _t2 = v__ast__SelectorExpr_root_ident(&(*node->cond._v__ast__SelectorExpr)); if (_t2.state != 0) { /*or block*/ IError err = _t2.err; - *(v__ast__Ident*) _t2.data = /* as */ *(v__ast__Ident*)__as_cast(((*node->cond._v__ast__SelectorExpr).expr)._v__ast__Ident,((*node->cond._v__ast__SelectorExpr).expr)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ; + *(v__ast__Ident*) _t2.data = /* as */ *(v__ast__Ident*)__as_cast(((*node->cond._v__ast__SelectorExpr).expr)._v__ast__Ident,((*node->cond._v__ast__SelectorExpr).expr)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ; } v__ast__Ident root_ident = (*(v__ast__Ident*)_t2.data); if (root_ident.kind != v__ast__IdentKind__unresolved) { - if (!(/* as */ *(v__ast__Var*)__as_cast((root_ident.obj)._v__ast__Var,(root_ident.obj)._typ, 365) /*expected idx: 365, name: v.ast.Var */ ).is_mut) { + if (!(/* as */ *(v__ast__Var*)__as_cast((root_ident.obj)._v__ast__Var,(root_ident.obj)._typ, 367) /*expected idx: 367, name: v.ast.Var */ ).is_mut) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = (*node->cond._v__ast__SelectorExpr).field_name}}, {_SLIT("` is immutable, it cannot be changed"), 0, { .d_c = 0 }}})), (*node->cond._v__ast__SelectorExpr).pos); } } @@ -58024,9 +56119,9 @@ VV_LOCAL_SYMBOL void v__checker__Checker_for_stmt(v__checker__Checker* c, v__ast if (!node->is_inf && v__ast__Type_idx(typ) != _const_v__ast__bool_type_idx && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("non-bool used as for condition"), node->pos); } - if ((node->cond)._typ == 311 /* v.ast.InfixExpr */) { + if ((node->cond)._typ == 313 /* v.ast.InfixExpr */) { if ((*node->cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { - if (((*node->cond._v__ast__InfixExpr).right)._typ == 333 /* v.ast.TypeNode */ && (((*node->cond._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */ || ((*node->cond._v__ast__InfixExpr).left)._typ == 327 /* v.ast.SelectorExpr */)) { + if (((*node->cond._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */ && (((*node->cond._v__ast__InfixExpr).left)._typ == 309 /* v.ast.Ident */ || ((*node->cond._v__ast__InfixExpr).left)._typ == 329 /* v.ast.SelectorExpr */)) { if (v__ast__Table_type_kind(c->table, (*node->cond._v__ast__InfixExpr).left_type) == v__ast__Kind__sum_type || v__ast__Table_type_kind(c->table, (*node->cond._v__ast__InfixExpr).left_type) == v__ast__Kind__interface_) { v__checker__Checker_smartcast(c, (*node->cond._v__ast__InfixExpr).left, (*node->cond._v__ast__InfixExpr).left_type, (*node->cond._v__ast__InfixExpr).right_type, node->scope); } @@ -58048,7 +56143,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool node_is_expr = false; if (node->branches.len > 0 && node->has_else) { Array_v__ast__Stmt stmts = (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, 0)).stmts; - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 347 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 349 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { node_is_expr = true; } } @@ -58069,7 +56164,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; bool is_comptime_type_is_expr = false; for (int i = 0; i < node->branches.len; ++i) { v__ast__IfBranch branch = (*(v__ast__IfBranch*)/*ee elem_sym */array_get(node->branches, i)); - if ((branch.cond)._typ == 322 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { + if ((branch.cond)._typ == 324 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("unnecessary `()` in `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT("` condition, use `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT(" expr {` instead of `"), /*115 &string*/0xfe10, {.d_s = if_kind}}, {_SLIT(" (expr) {`."), 0, { .d_c = 0 }}})), branch.pos); } if (!node->has_else || i < node->branches.len - 1) { @@ -58086,9 +56181,9 @@ bool v__checker__Checker_if_expr_defer_0 = false; } if (node->is_comptime) { string comptime_field_name = _SLIT(""); - if ((branch.cond)._typ == 311 /* v.ast.InfixExpr */) { + if ((branch.cond)._typ == 313 /* v.ast.InfixExpr */) { if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { - if (((*branch.cond._v__ast__InfixExpr).right)._typ != 333 /* v.ast.TypeNode */ && ((*branch.cond._v__ast__InfixExpr).right)._typ != 300 /* v.ast.ComptimeType */) { + if (((*branch.cond._v__ast__InfixExpr).right)._typ != 335 /* v.ast.TypeNode */ && ((*branch.cond._v__ast__InfixExpr).right)._typ != 302 /* v.ast.ComptimeType */) { v__checker__Checker_error(c, _SLIT("invalid `$if` condition: expected a type"), v__ast__Expr_pos((*branch.cond._v__ast__InfixExpr).right)); v__ast__Type _t1 = 0; // Defer begin @@ -58099,25 +56194,25 @@ bool v__checker__Checker_if_expr_defer_0 = false; return _t1; } v__ast__Expr left = (*branch.cond._v__ast__InfixExpr).left; - if (((*branch.cond._v__ast__InfixExpr).right)._typ == 300 /* v.ast.ComptimeType */ && (left)._typ == 333 /* v.ast.TypeNode */) { + if (((*branch.cond._v__ast__InfixExpr).right)._typ == 302 /* v.ast.ComptimeType */ && (left)._typ == 335 /* 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); - 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, 300) /*expected idx: 300, name: v.ast.ComptimeType */ ) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); + 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, 302) /*expected idx: 302, 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, 333) /*expected idx: 333, name: v.ast.TypeNode */ ).typ); + 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, 335) /*expected idx: 335, name: v.ast.TypeNode */ ).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, got_type); if (sym->kind == v__ast__Kind__placeholder || v__ast__Type_has_flag(got_type, v__ast__TypeFlag__generic)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos((*branch.cond._v__ast__InfixExpr).right)); } - if ((left)._typ == 327 /* v.ast.SelectorExpr */) { + if ((left)._typ == 329 /* v.ast.SelectorExpr */) { comptime_field_name = v__ast__Expr_str((*left._v__ast__SelectorExpr).expr); map_set(&c->comptime_fields_type, &(string[]){comptime_field_name}, &(v__ast__Type[]) { got_type }); is_comptime_type_is_expr = true; - } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 333 /* v.ast.TypeNode */ && (left)._typ == 333 /* v.ast.TypeNode */ && sym->kind == v__ast__Kind__interface_) { + } else if (((*branch.cond._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */ && (left)._typ == 335 /* 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); 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 == 333 /* v.ast.TypeNode */) { + } else if ((left)._typ == 335 /* 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); skip_state = (v__ast__Type_alias_eq(left_type, got_type) ? (v__checker__ComptimeBranchSkipState__eval) : (v__checker__ComptimeBranchSkipState__skip)); @@ -58147,7 +56242,7 @@ bool v__checker__Checker_if_expr_defer_0 = false; } } else if (c->pref->output_cross_c) { bool is_freestanding_block = false; - if ((branch.cond)._typ == 307 /* v.ast.Ident */) { + if ((branch.cond)._typ == 309 /* v.ast.Ident */) { if (string__eq((*branch.cond._v__ast__Ident).name, _SLIT("freestanding"))) { is_freestanding_block = true; } @@ -58182,8 +56277,8 @@ bool v__checker__Checker_if_expr_defer_0 = false; c->smartcast_cond_pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); } if (expr_required) { - if (branch.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(branch.stmts)))._typ == 347 /* v.ast.ExprStmt */) { - v__ast__ExprStmt last_expr = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ; + if (branch.stmts.len > 0 && ((*(v__ast__Stmt*)array_last(branch.stmts)))._typ == 349 /* v.ast.ExprStmt */) { + v__ast__ExprStmt last_expr = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ; c->expected_type = former_expected_type; if (v__ast__Type_has_flag(c->expected_type, v__ast__TypeFlag__optional)) { if (v__ast__Type_alias_eq(node->typ, _const_v__ast__void_type)) { @@ -58258,10 +56353,10 @@ bool v__checker__Checker_if_expr_defer_0 = false; ; } } - if ((branch.cond)._typ == 309 /* v.ast.IfGuardExpr */) { + if ((branch.cond)._typ == 311 /* v.ast.IfGuardExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; if ((*branch.cond._v__ast__IfGuardExpr).vars.len != mr_info.types.len) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("if guard expects "), /*100 &int*/0xfe07, {.d_i32 = mr_info.types.len}}, {_SLIT(" variables, but got "), /*100 &int*/0xfe07, {.d_i32 = (*branch.cond._v__ast__IfGuardExpr).vars.len}}, {_SLIT0, 0, { .d_c = 0 }}})), branch.pos); } else { @@ -58312,17 +56407,17 @@ bool v__checker__Checker_if_expr_defer_0 = false; } VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* c, v__ast__Expr node, v__ast__Scope* scope) { - if ((node)._typ == 311 /* v.ast.InfixExpr */) { + if ((node)._typ == 313 /* v.ast.InfixExpr */) { if ((*node._v__ast__InfixExpr).op == v__token__Kind__and) { v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__InfixExpr).left, scope); v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__InfixExpr).right, scope); } else if ((*node._v__ast__InfixExpr).op == v__token__Kind__key_is) { v__ast__Expr right_expr = (*node._v__ast__InfixExpr).right; v__ast__Type _t1 = 0; - if (right_expr._typ == 333 /* v.ast.TypeNode */) { + if (right_expr._typ == 335 /* v.ast.TypeNode */) { _t1 = (*right_expr._v__ast__TypeNode).typ; } - else if (right_expr._typ == 319 /* v.ast.None */) { + else if (right_expr._typ == 321 /* v.ast.None */) { _t1 = _const_v__ast__none_type_idx; } @@ -58336,7 +56431,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* v__ast__TypeSymbol* right_sym = v__ast__Table_sym(c->table, right_type); v__ast__Type expr_type = v__checker__Checker_expr(c, (*node._v__ast__InfixExpr).left); if (left_sym->kind == v__ast__Kind__aggregate) { - expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ).sum_type; + expr_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; } if (left_sym->kind == v__ast__Kind__interface_) { if (right_sym->kind != v__ast__Kind__interface_) { @@ -58349,10 +56444,10 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* string expr_str = v__ast__Table_type_to_str(c->table, expr_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot use type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` as type `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*node._v__ast__InfixExpr).pos); } - if ((((*node._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */ || ((*node._v__ast__InfixExpr).left)._typ == 327 /* v.ast.SelectorExpr */) && ((*node._v__ast__InfixExpr).right)._typ == 333 /* v.ast.TypeNode */) { - bool is_variable = (((*node._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */ ? ((*(*node._v__ast__InfixExpr).left._v__ast__Ident).kind == v__ast__IdentKind__variable) : (true)); + if ((((*node._v__ast__InfixExpr).left)._typ == 309 /* v.ast.Ident */ || ((*node._v__ast__InfixExpr).left)._typ == 329 /* v.ast.SelectorExpr */) && ((*node._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */) { + bool is_variable = (((*node._v__ast__InfixExpr).left)._typ == 309 /* v.ast.Ident */ ? ((*(*node._v__ast__InfixExpr).left._v__ast__Ident).kind == v__ast__IdentKind__variable) : (true)); if (is_variable) { - if ((((*node._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__Ident,((*node._v__ast__InfixExpr).left)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).is_mut) || (((*node._v__ast__InfixExpr).left)._typ == 327 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__SelectorExpr,((*node._v__ast__InfixExpr).left)._typ, 327) /*expected idx: 327, name: v.ast.SelectorExpr */ ).is_mut)) { + if ((((*node._v__ast__InfixExpr).left)._typ == 309 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__Ident,((*node._v__ast__InfixExpr).left)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).is_mut) || (((*node._v__ast__InfixExpr).left)._typ == 329 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast(((*node._v__ast__InfixExpr).left)._v__ast__SelectorExpr,((*node._v__ast__InfixExpr).left)._typ, 329) /*expected idx: 329, name: v.ast.SelectorExpr */ ).is_mut)) { v__checker__Checker_fail_if_immutable(c, (*node._v__ast__InfixExpr).left); } if (left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type) { @@ -58362,7 +56457,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_smartcast_if_conds(v__checker__Checker* } } } - } else if ((node)._typ == 314 /* v.ast.Likely */) { + } else if ((node)._typ == 316 /* v.ast.Likely */) { v__checker__Checker_smartcast_if_conds(c, (*node._v__ast__Likely).expr, scope); } } @@ -58406,12 +56501,12 @@ v__ast__Type former_expected_type; } v__ast__Type return_type = left_type; if (node->op != v__token__Kind__key_is) { - if (node->left._typ == 307 /* v.ast.Ident */) { + if (node->left._typ == 309 /* v.ast.Ident */) { if ((*node->left._v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->left._v__ast__Ident).mut_pos); } } - else if (node->left._typ == 327 /* v.ast.SelectorExpr */) { + else if (node->left._typ == 329 /* v.ast.SelectorExpr */) { if ((*node->left._v__ast__SelectorExpr).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->left._v__ast__SelectorExpr).mut_pos); } @@ -58421,12 +56516,12 @@ v__ast__Type former_expected_type; } ; } - if (node->right._typ == 307 /* v.ast.Ident */) { + if (node->right._typ == 309 /* v.ast.Ident */) { if ((*node->right._v__ast__Ident).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->right._v__ast__Ident).mut_pos); } } - else if (node->right._typ == 327 /* v.ast.SelectorExpr */) { + else if (node->right._typ == 329 /* v.ast.SelectorExpr */) { if ((*node->right._v__ast__SelectorExpr).is_mut) { v__checker__Checker_error(c, _SLIT("the `mut` keyword is invalid here"), (*node->right._v__ast__SelectorExpr).mut_pos); } @@ -58446,12 +56541,12 @@ v__ast__Type former_expected_type; } else if (Array_int_contains(_const_v__ast__integer_type_idxs, left_type) && Array_int_contains(_const_v__ast__integer_type_idxs, right_type)) { bool is_left_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, left_type); bool is_right_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, right_type); - if (!is_left_type_signed && (node->right)._typ == 312 /* v.ast.IntegerLiteral */) { + if (!is_left_type_signed && (node->right)._typ == 314 /* v.ast.IntegerLiteral */) { if (string_int((*node->right._v__ast__IntegerLiteral).val) < 0 && Array_int_contains(_const_v__ast__int_promoted_type_idxs, left_type)) { string lt = v__ast__Table_sym(c->table, left_type)->name; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = lt}}, {_SLIT("` cannot be compared with negative value"), 0, { .d_c = 0 }}})), (*node->right._v__ast__IntegerLiteral).pos); } - } else if (!is_right_type_signed && (node->left)._typ == 312 /* v.ast.IntegerLiteral */) { + } else if (!is_right_type_signed && (node->left)._typ == 314 /* v.ast.IntegerLiteral */) { if (string_int((*node->left._v__ast__IntegerLiteral).val) < 0 && Array_int_contains(_const_v__ast__int_promoted_type_idxs, right_type)) { string rt = v__ast__Table_sym(c->table, right_type)->name; 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); @@ -58533,15 +56628,15 @@ v__ast__Type former_expected_type; case v__token__Kind__amp: case v__token__Kind__pipe: { - if ((right_sym->info)._typ == 472 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type))) { - right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + if ((right_sym->info)._typ == 474 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, right_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type))) { + right_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); } - if ((left_sym->info)._typ == 472 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type))) { - left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + if ((left_sym->info)._typ == 474 /* v.ast.Alias */ && (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).language != v__ast__Language__c && string__eq(c->mod, (*(string*)/*ee elem_sym */array_get(string_split(v__ast__Table_type_to_str(c->table, left_type), _SLIT(".")), 0))) && v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type))) { + left_sym = v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); } if (c->pref->translated && (node->op == v__token__Kind__plus || node->op == v__token__Kind__minus || node->op == v__token__Kind__mul) && v__ast__Type_is_any_kind_of_pointer(left_type) && v__ast__Type_is_any_kind_of_pointer(right_type)) { return_type = left_type; - } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 472 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && left_sym->kind == v__ast__Kind__alias && (left_sym->info)._typ == 474 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((left_sym->info)._v__ast__Alias,(left_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(left_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t5; if (_t5 = v__ast__TypeSymbol_find_method(left_sym, v__token__Kind_str(node->op)), _t5.state == 0) { @@ -58560,7 +56655,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("mismatched types `"), /*115 &string*/0xfe10, {.d_s = left_name}}, {_SLIT("` and `"), /*115 &string*/0xfe10, {.d_s = right_name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); } } - } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 472 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type)))) { + } else if (!c->pref->translated && right_sym->kind == v__ast__Kind__alias && (right_sym->info)._typ == 474 /* v.ast.Alias */ && !(v__ast__TypeSymbol_is_primitive(v__ast__Table_sym(c->table, (/* as */ *(v__ast__Alias*)__as_cast((right_sym->info)._v__ast__Alias,(right_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type)))) { if (v__ast__TypeSymbol_has_method(right_sym, v__token__Kind_str(node->op))) { _option_v__ast__Fn _t6; if (_t6 = v__ast__TypeSymbol_find_method(right_sym, v__token__Kind_str(node->op)), _t6.state == 0) { @@ -58667,7 +56762,7 @@ v__ast__Type former_expected_type; { if ((left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed) && (right_sym->kind == v__ast__Kind__array || right_sym->kind == v__ast__Kind__array_fixed)) { v__checker__Checker_error(c, _SLIT("only `==` and `!=` are defined on arrays"), node->pos); - } else if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).generic_types.len > 0) { + } else if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { v__ast__Type _t9 = _const_v__ast__bool_type; // Defer begin if (v__checker__Checker_infix_expr_defer_0) { @@ -58708,13 +56803,13 @@ v__ast__Type former_expected_type; bool is_right_type_signed = Array_int_contains(_const_v__ast__signed_integer_type_idxs, right_type) || right_type == _const_v__ast__int_literal_type_idx; if (is_left_type_signed != is_right_type_signed) { if (is_right_type_signed) { - if ((node->right)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((node->right)._typ == 314 /* v.ast.IntegerLiteral */) { if (string_int((*node->right._v__ast__IntegerLiteral).val) < 0) { v__checker__Checker_error(c, _SLIT("unsigned integer cannot be compared with negative value"), (*node->right._v__ast__IntegerLiteral).pos); } } } else if (is_left_type_signed) { - if ((node->left)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((node->left)._typ == 314 /* v.ast.IntegerLiteral */) { if (string_int((*node->left._v__ast__IntegerLiteral).val) < 0) { v__checker__Checker_error(c, _SLIT("unsigned integer cannot be compared with negative value"), (*node->left._v__ast__IntegerLiteral).pos); } @@ -58876,10 +56971,10 @@ v__ast__Type former_expected_type; { v__ast__Expr right_expr = node->right; v__ast__Type _t20 = 0; - if (right_expr._typ == 333 /* v.ast.TypeNode */) { + if (right_expr._typ == 335 /* v.ast.TypeNode */) { _t20 = (*right_expr._v__ast__TypeNode).typ; } - else if (right_expr._typ == 319 /* v.ast.None */) { + else if (right_expr._typ == 321 /* v.ast.None */) { _t20 = _const_v__ast__none_type_idx; } @@ -58895,12 +56990,12 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT(": type `"), /*115 &string*/0xfe10, {.d_s = typ_sym->name}}, {_SLIT("` does not exist"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(right_expr)); } if (left_sym->kind == v__ast__Kind__aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(c->table, parent_left_type); } if (!(left_sym->kind == v__ast__Kind__interface_ || left_sym->kind == v__ast__Kind__sum_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = op}}, {_SLIT("` can only be used with interfaces and sum types"), 0, { .d_c = 0 }}})), node->pos); - } else if ((left_sym->info)._typ == 476 /* v.ast.SumType */) { + } else if ((left_sym->info)._typ == 478 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*left_sym->info._v__ast__SumType).variants, typ)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } @@ -58953,7 +57048,7 @@ v__ast__Type former_expected_type; v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("right operand for `"), /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str(node->op)}}, {_SLIT("` is not a boolean"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->right)); } } - if ((node->left)._typ == 311 /* v.ast.InfixExpr */) { + if ((node->left)._typ == 313 /* v.ast.InfixExpr */) { if ((*node->left._v__ast__InfixExpr).op != node->op && ((*node->left._v__ast__InfixExpr).op == v__token__Kind__logical_or || (*node->left._v__ast__InfixExpr).op == v__token__Kind__and)) { v__checker__Checker_error(c, _SLIT("ambiguous boolean expression. use `()` to ensure correct order of operations"), node->pos); } @@ -59062,8 +57157,8 @@ v__ast__Type former_expected_type; } else if (v__ast__Type_alias_eq(left_type, _const_v__ast__string_type) && !(node->op == v__token__Kind__plus || node->op == v__token__Kind__eq || node->op == v__token__Kind__ne || node->op == v__token__Kind__lt || node->op == v__token__Kind__gt || node->op == v__token__Kind__le || node->op == v__token__Kind__ge)) { v__checker__Checker_error(c, _SLIT("string types only have the following operators defined: `==`, `!=`, `<`, `>`, `<=`, `>=`, and `+`"), node->pos); } else if (left_sym->kind == v__ast__Kind__enum_ && right_sym->kind == v__ast__Kind__enum_ && !eq_ne) { - v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ; - v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ; + v__ast__Enum left_enum = /* as */ *(v__ast__Enum*)__as_cast((left_sym->info)._v__ast__Enum,(left_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ; + v__ast__Enum right_enum = /* as */ *(v__ast__Enum*)__as_cast((right_sym->info)._v__ast__Enum,(right_sym->info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ; if (left_enum.is_flag && right_enum.is_flag) { if (!(node->op == v__token__Kind__pipe || node->op == v__token__Kind__amp)) { v__checker__Checker_error(c, _SLIT("only `==`, `!=`, `|` and `&` are defined on `[flag]` tagged `enum`, use an explicit cast to `int` if needed"), node->pos); @@ -59105,6 +57200,12 @@ v__ast__Type former_expected_type; return _t24; } v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("infix expr: cannot use `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("` (right expression) as `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), left_right_pos); + } else if (v__ast__Type_is_ptr(left_type)) { + bool for_ptr_op = v__ast__Table_type_is_for_pointer_arithmetic(c->table, left_type); + if (left_sym->language == v__ast__Language__v && !c->pref->translated && !c->inside_unsafe && !for_ptr_op && v__ast__Type_is_int(right_type)) { + string sugg = _SLIT(" (you can use it inside an `unsafe` block)"); + v__checker__Checker_error(c, str_intp(4, _MOV((StrIntpData[]){{_SLIT("infix expr: cannot use `"), /*115 &string*/0xfe10, {.d_s = right_sym->name}}, {_SLIT("` (right expression) as `"), /*115 &string*/0xfe10, {.d_s = left_sym->name}}, {_SLIT("` "), /*115 &string*/0xfe10, {.d_s = sugg}}, {_SLIT0, 0, { .d_c = 0 }}})), left_right_pos); + } } v__ast__Type _t25 = (v__token__Kind_is_relational(node->op) ? (_const_v__ast__bool_type) : (return_type)); // Defer begin @@ -59116,19 +57217,19 @@ v__ast__Type former_expected_type; } VV_LOCAL_SYMBOL void v__checker__Checker_check_div_mod_by_zero(v__checker__Checker* c, v__ast__Expr expr, v__token__Kind op_kind) { - if (expr._typ == 305 /* v.ast.FloatLiteral */) { + if (expr._typ == 307 /* v.ast.FloatLiteral */) { if (string_f64((*expr._v__ast__FloatLiteral).val) == 0.0) { string oper = (op_kind == v__token__Kind__div ? (_SLIT("division")) : (_SLIT("modulo"))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = oper}}, {_SLIT(" by zero"), 0, { .d_c = 0 }}})), (*expr._v__ast__FloatLiteral).pos); } } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { if (string_int((*expr._v__ast__IntegerLiteral).val) == 0) { string oper = (op_kind == v__token__Kind__div ? (_SLIT("division")) : (_SLIT("modulo"))); v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = oper}}, {_SLIT(" by zero"), 0, { .d_c = 0 }}})), (*expr._v__ast__IntegerLiteral).pos); } } - else if (expr._typ == 294 /* v.ast.CastExpr */) { + else if (expr._typ == 296 /* v.ast.CastExpr */) { v__checker__Checker_check_div_mod_by_zero(c, (*expr._v__ast__CastExpr).expr, op_kind); } @@ -59141,15 +57242,20 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_check_valid_pascal_case(c, node->name, _SLIT("interface name"), node->pos); v__ast__TypeSymbol* decl_sym = v__ast__Table_sym(c->table, node->typ); bool is_js = node->language == v__ast__Language__js; - if ((decl_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((decl_sym->info)._typ == 477 /* v.ast.Interface */) { if (node->embeds.len > 0) { Array_v__ast__InterfaceEmbedding all_embeds = v__checker__Checker_expand_iface_embeds(c, node, 0, node->embeds); node->embeds = all_embeds; - Map_string_int emnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool emnames_ds = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool emnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int efnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_bool efnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int emnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool emnames_ds = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool emnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int efnames = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_bool efnames_ds_info = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < node->methods.len; ++i) { v__ast__FnDecl m = ((v__ast__FnDecl*)node->methods.data)[i]; map_set(&emnames, &(string[]){m.name}, &(int[]) { i }); @@ -59168,7 +57274,7 @@ void v__checker__Checker_interface_decl(v__checker__Checker* c, v__ast__Interfac v__checker__Checker_error(c, str_intp(5, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = node->name}}, {_SLIT("` tries to embed `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("`, but `"), /*115 &string*/0xfe10, {.d_s = isym->name}}, {_SLIT("` is not an interface, but `"), /*115 &v.ast.Kind*/0xfe10, {.d_s = v__ast__Kind_str(isym->kind)}}, {_SLIT("`"), 0, { .d_c = 0 }}})), embed.pos); continue; } - v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface isym_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; for (int _t2 = 0; _t2 < isym_info.fields.len; ++_t2) { v__ast__StructField f = ((v__ast__StructField*)isym_info.fields.data)[_t2]; if (!(*(bool*)map_get(ADDR(map, efnames_ds_info), &(string[]){f.name}, &(bool[]){ 0 }))) { @@ -59333,7 +57439,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type utyp = v__checker__Checker_unwrap_generic(c, typ); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(c->table, utyp); v__ast__TypeSymbol* inter_sym = v__ast__Table_sym(c->table, interface_type); - if ((inter_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((inter_sym->info)._typ == 477 /* v.ast.Interface */) { if ((*inter_sym->info._v__ast__Interface).is_generic) { Array_v__ast__Type inferred_types = __new_array_with_default(0, 0, sizeof(v__ast__Type), 0); Array_string _t1 = {0}; @@ -59390,7 +57496,7 @@ VV_LOCAL_SYMBOL v__ast__Type v__checker__Checker_resolve_generic_interface(v__ch v__ast__Type _t11 = 0; return _t11; } - if ((imret_sym->info)._typ == 483 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 483 /* v.ast.MultiReturn */) { + if ((imret_sym->info)._typ == 485 /* v.ast.MultiReturn */ && (mret_sym->info)._typ == 485 /* v.ast.MultiReturn */) { for (int i = 0; i < (*imret_sym->info._v__ast__MultiReturn).types.len; ++i) { v__ast__Type mr_typ = ((v__ast__Type*)(*imret_sym->info._v__ast__MultiReturn).types.data)[i]; if (v__ast__Type_has_flag(mr_typ, v__ast__TypeFlag__generic) && string__eq(v__ast__Table_get_type_name(c->table, mr_typ), gt_name)) { @@ -59453,7 +57559,7 @@ v__ast__Type v__checker__Checker_match_expr(v__checker__Checker* c, v__ast__Matc bool v__checker__Checker_match_expr_defer_0 = false; node->is_expr = !v__ast__Type_alias_eq(c->expected_type, _const_v__ast__void_type); node->expected_type = c->expected_type; - if ((node->cond)._typ == 322 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { + if ((node->cond)._typ == 324 /* v.ast.ParExpr */ && !c->pref->translated && !c->file->is_translated) { v__checker__Checker_error(c, _SLIT("unnecessary `()` in `match` condition, use `match expr {` instead of `match (expr) {`."), (*node->cond._v__ast__ParExpr).pos); } if (node->is_expr) { @@ -59462,7 +57568,7 @@ bool v__checker__Checker_match_expr_defer_0 = false; } v__ast__Type cond_type = v__checker__Checker_expr(c, node->cond); node->cond_type = v__ast__mktyp(cond_type); - if (((node->cond)._typ == 307 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->cond)._v__ast__Ident,(node->cond)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).is_mut) || ((node->cond)._typ == 327 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast((node->cond)._v__ast__SelectorExpr,(node->cond)._typ, 327) /*expected idx: 327, name: v.ast.SelectorExpr */ ).is_mut)) { + if (((node->cond)._typ == 309 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((node->cond)._v__ast__Ident,(node->cond)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).is_mut) || ((node->cond)._typ == 329 /* v.ast.SelectorExpr */ && (/* as */ *(v__ast__SelectorExpr*)__as_cast((node->cond)._v__ast__SelectorExpr,(node->cond)._typ, 329) /*expected idx: 329, name: v.ast.SelectorExpr */ ).is_mut)) { v__checker__Checker_fail_if_immutable(c, node->cond); } _option_void _t1 = v__checker__Checker_ensure_type_exists(c, node->cond_type, node->pos); @@ -59516,7 +57622,7 @@ bool v__checker__Checker_match_expr_defer_0 = false; } if (branch.stmts.len > 0) { v__ast__Stmt stmt = (*(v__ast__Stmt*)array_last(branch.stmts)); - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { if (node->is_expr) { c->expected_type = node->expected_type; } @@ -59619,22 +57725,23 @@ bool v__checker__Checker_match_expr_defer_0 = false; } VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ast__MatchExpr* node, v__ast__TypeSymbol cond_type_sym) { - Map_string_int branch_exprs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int branch_exprs = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int branch_i = 0; branch_i < node->branches.len; ++branch_i) { v__ast__MatchBranch branch = (*(v__ast__MatchBranch*)/*ee elem_sym */array_get(node->branches, branch_i)); Array_v__ast__TypeNode expr_types = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); for (int k = 0; k < branch.exprs.len; ++k) { v__ast__Expr expr = ((v__ast__Expr*)branch.exprs.data)[k]; string key = _SLIT(""); - if ((expr)._typ == 325 /* v.ast.RangeExpr */) { + if ((expr)._typ == 327 /* v.ast.RangeExpr */) { i64 low = ((i64)(0)); i64 high = ((i64)(0)); c->expected_type = node->expected_type; v__ast__Expr low_expr = (*expr._v__ast__RangeExpr).low; v__ast__Expr high_expr = (*expr._v__ast__RangeExpr).high; v__ast__TypeSymbol* final_cond_sym = v__ast__Table_final_sym(c->table, node->cond_type); - if ((low_expr)._typ == 312 /* v.ast.IntegerLiteral */) { - if ((high_expr)._typ == 312 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 486 /* v.ast.Enum */)) { + if ((low_expr)._typ == 314 /* v.ast.IntegerLiteral */) { + if ((high_expr)._typ == 314 /* v.ast.IntegerLiteral */ && (v__ast__TypeSymbol_is_int(final_cond_sym) || (final_cond_sym->info)._typ == 488 /* v.ast.Enum */)) { low = string_i64((*low_expr._v__ast__IntegerLiteral).val); high = string_i64((*high_expr._v__ast__IntegerLiteral).val); if (low > high) { @@ -59643,8 +57750,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } else { v__checker__Checker_error(c, _SLIT("mismatched range types"), (*low_expr._v__ast__IntegerLiteral).pos); } - } else if ((low_expr)._typ == 296 /* v.ast.CharLiteral */) { - if ((high_expr)._typ == 296 /* v.ast.CharLiteral */ && (final_cond_sym->kind == v__ast__Kind__u8 || final_cond_sym->kind == v__ast__Kind__char || final_cond_sym->kind == v__ast__Kind__rune)) { + } else if ((low_expr)._typ == 298 /* v.ast.CharLiteral */) { + if ((high_expr)._typ == 298 /* v.ast.CharLiteral */ && (final_cond_sym->kind == v__ast__Kind__u8 || final_cond_sym->kind == v__ast__Kind__char || final_cond_sym->kind == v__ast__Kind__rune)) { low = string_at((*low_expr._v__ast__CharLiteral).val, 0); high = string_at((*high_expr._v__ast__CharLiteral).val, 0); if (low > high) { @@ -59671,11 +57778,11 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } continue; } - if (expr._typ == 333 /* v.ast.TypeNode */) { + if (expr._typ == 335 /* v.ast.TypeNode */) { key = v__ast__Table_type_to_str(c->table, (*expr._v__ast__TypeNode).typ); array_push((array*)&expr_types, _MOV((v__ast__TypeNode[]){ (*expr._v__ast__TypeNode) })); } - else if (expr._typ == 304 /* v.ast.EnumVal */) { + else if (expr._typ == 306 /* v.ast.EnumVal */) { key = (*expr._v__ast__EnumVal).val; } @@ -59702,7 +57809,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - } else if ((cond_type_sym.info)._typ == 476 /* v.ast.SumType */) { + } else if ((cond_type_sym.info)._typ == 478 /* v.ast.SumType */) { if (!Array_v__ast__Type_contains((*cond_type_sym.info._v__ast__SumType).variants, expr_type)) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); @@ -59713,14 +57820,15 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ for (int _t3 = 0; _t3 < _t2_len; ++_t3) { v__ast__Type it = ((v__ast__Type*) _t2_orig.data)[_t3]; - string ti = v__ast__Table_type_to_str_using_aliases(c->table, it, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string ti = v__ast__Table_type_to_str_using_aliases(c->table, it, new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); array_push((array*)&_t2, &ti); } Array_string sumtype_variant_names =_t2; v__util__Suggestion suggestion = v__util__new_suggestion(expr_str, sumtype_variant_names); v__checker__Checker_error(c, v__util__Suggestion_say(suggestion, str_intp(3, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` has no variant `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), v__ast__Expr_pos(expr)); } - } else if ((cond_type_sym.info)._typ == 472 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 457 /* v.ast.Struct */) { + } else if ((cond_type_sym.info)._typ == 474 /* v.ast.Alias */ && (expr_type_sym->info)._typ == 459 /* v.ast.Struct */) { string expr_str = v__ast__Table_type_to_str(c->table, expr_type); string expect_str = v__ast__Table_type_to_str(c->table, node->cond_type); v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("cannot match alias type `"), /*115 &string*/0xfe10, {.d_s = expect_str}}, {_SLIT("` with `"), /*115 &string*/0xfe10, {.d_s = expr_str}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(expr)); @@ -59786,7 +57894,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } else { - if (cond_type_sym.info._typ == 476 /* v.ast.SumType */) { + if (cond_type_sym.info._typ == 478 /* v.ast.SumType */) { for (int _t8 = 0; _t8 < (*cond_type_sym.info._v__ast__SumType).variants.len; ++_t8) { v__ast__Type v = ((v__ast__Type*)(*cond_type_sym.info._v__ast__SumType).variants.data)[_t8]; string v_str = v__ast__Table_type_to_str(c->table, v); @@ -59796,7 +57904,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_match_exprs(v__checker__Checker* c, v__ } } } - else if (cond_type_sym.info._typ == 486 /* v.ast.Enum */) { + else if (cond_type_sym.info._typ == 488 /* v.ast.Enum */) { for (int _t10 = 0; _t10 < (*cond_type_sym.info._v__ast__Enum).vals.len; ++_t10) { string v = ((string*)(*cond_type_sym.info._v__ast__Enum).vals.data)[_t10]; if (!_IN_MAP(ADDR(string, v), ADDR(map, branch_exprs))) { @@ -59874,7 +57982,7 @@ v__ast__TypeSymbol old_ts; old_ts = c->cur_orm_ts; c->cur_orm_ts = *sym; v__checker__Checker_sql_expr_defer_1 = true; - if ((sym->info)._typ != 457 /* v.ast.Struct */) { + if ((sym->info)._typ != 459 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("The table symbol `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("` has to be a struct"), 0, { .d_c = 0 }}})), node->table_expr.pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin @@ -59889,9 +57997,10 @@ v__ast__TypeSymbol old_ts; // Defer end return _t3; } - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; Array_v__ast__StructField fields = v__checker__Checker_fetch_and_verify_orm_fields(c, info, node->table_expr.pos, sym->name); - Map_int_v__ast__SqlExpr 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); + Map_int_v__ast__SqlExpr 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) + ; Array_v__ast__StructField _t5 = {0}; Array_v__ast__StructField _t5_orig = fields; int _t5_len = _t5_orig.len; @@ -60020,7 +58129,7 @@ v__ast__TypeSymbol old_ts; old_ts = c->cur_orm_ts; c->cur_orm_ts = *table_sym; v__checker__Checker_sql_stmt_line_defer_1 = true; - if ((table_sym->info)._typ != 457 /* v.ast.Struct */) { + if ((table_sym->info)._typ != 459 /* v.ast.Struct */) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = table_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t3 = _const_v__ast__void_type; // Defer begin @@ -60035,9 +58144,10 @@ v__ast__TypeSymbol old_ts; // Defer end return _t3; } - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((table_sym->info)._v__ast__Struct,(table_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((table_sym->info)._v__ast__Struct,(table_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; Array_v__ast__StructField fields = v__checker__Checker_fetch_and_verify_orm_fields(c, info, node->table_expr.pos, table_sym->name); - Map_int_v__ast__SqlStmtLine sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlStmtLine), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop); + Map_int_v__ast__SqlStmtLine sub_structs = new_map(sizeof(int), sizeof(v__ast__SqlStmtLine), &map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop) + ; Array_v__ast__StructField _t5 = {0}; Array_v__ast__StructField _t5_orig = fields; int _t5_len = _t5_orig.len; @@ -60092,7 +58202,7 @@ v__ast__TypeSymbol old_ts; v__checker__Checker_expr(c, expr); } } - if ((node->where_expr)._typ != 303 /* v.ast.EmptyExpr */) { + if ((node->where_expr)._typ != 305 /* v.ast.EmptyExpr */) { v__checker__Checker_expr(c, node->where_expr); } v__ast__Type _t11 = _const_v__ast__void_type; @@ -60153,7 +58263,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod bool exp_is_optional = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional); bool exp_is_result = v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__result); Array_v__ast__Type expected_types = new_array_from_c_array(1, 1, sizeof(v__ast__Type), _MOV((v__ast__Type[1]){expected_type})); - if ((expected_type_sym->info)._typ == 483 /* v.ast.MultiReturn */) { + if ((expected_type_sym->info)._typ == 485 /* v.ast.MultiReturn */) { expected_types = (*expected_type_sym->info._v__ast__MultiReturn).types; if (c->table->cur_concrete_types.len > 0) { Array_v__ast__Type _t1 = {0}; @@ -60185,8 +58295,8 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod array_push((array*)&expr_idxs, _MOV((int[]){ i })); } } else { - if ((expr)._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__checker__Checker_unwrap_generic(c, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); } @@ -60248,8 +58358,8 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (v__ast__Type_is_ptr(exp_type) && v__ast__Type_is_ptr(got_typ)) { v__ast__Expr* r_expr = &(*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, (*(int*)/*ee elem_sym */array_get(expr_idxs, i)))); - if ((r_expr)->_typ == 307 /* v.ast.Ident */) { - if (((*r_expr->_v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((r_expr)->_typ == 309 /* v.ast.Ident */) { + if (((*r_expr->_v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Var* obj = &(*(*r_expr->_v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t8 = v__ast__Scope_find_var(c->fn_scope, (*(*r_expr->_v__ast__Ident).obj._v__ast__Var).name); @@ -60273,7 +58383,7 @@ void v__checker__Checker_return_stmt(v__checker__Checker* c, v__ast__Return* nod } if (exp_is_optional && node->exprs.len > 0) { v__ast__Expr expr0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node->exprs, 0)); - if ((expr0)._typ == 293 /* v.ast.CallExpr */) { + if ((expr0)._typ == 295 /* v.ast.CallExpr */) { if ((*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option && node->exprs.len == 1) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`?` is not needed, use `return "), /*115 &string*/0xfe10, {.d_s = (*expr0._v__ast__CallExpr).name}}, {_SLIT("()`"), 0, { .d_c = 0 }}})), (*expr0._v__ast__CallExpr).pos); } @@ -60285,8 +58395,8 @@ void v__checker__Checker_find_unreachable_statements_after_noreturn_calls(v__che bool prev_stmt_was_noreturn_call = false; for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t1]; - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 293 /* v.ast.CallExpr */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 295 /* v.ast.CallExpr */) { if (prev_stmt_was_noreturn_call) { v__checker__Checker_error(c, _SLIT("unreachable code after a [noreturn] call"), (*stmt._v__ast__ExprStmt).pos); return; @@ -60302,18 +58412,18 @@ void v__checker__Checker_find_unreachable_statements_after_noreturn_calls(v__che VV_LOCAL_SYMBOL bool v__checker__has_top_return(Array_v__ast__Stmt stmts) { for (int _t1 = 0; _t1 < stmts.len; ++_t1) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t1]; - if (stmt._typ == 358 /* v.ast.Return */) { + if (stmt._typ == 360 /* v.ast.Return */) { bool _t2 = true; return _t2; } - else if (stmt._typ == 340 /* v.ast.Block */) { + else if (stmt._typ == 342 /* v.ast.Block */) { if (v__checker__has_top_return((*stmt._v__ast__Block).stmts)) { bool _t3 = true; return _t3; } } - else if (stmt._typ == 347 /* v.ast.ExprStmt */) { - if (((*stmt._v__ast__ExprStmt).expr)._typ == 293 /* v.ast.CallExpr */) { + else if (stmt._typ == 349 /* v.ast.ExprStmt */) { + if (((*stmt._v__ast__ExprStmt).expr)._typ == 295 /* v.ast.CallExpr */) { if ((*(*stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).is_noreturn) { bool _t4 = true; return _t4; @@ -60345,8 +58455,8 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Chec if (node->stmts.len != 0) { bool is_valid_end_of_noreturn_fn = false; v__ast__Stmt last_stmt = (*(v__ast__Stmt*)array_last(node->stmts)); - if (last_stmt._typ == 347 /* v.ast.ExprStmt */) { - if (((*last_stmt._v__ast__ExprStmt).expr)._typ == 293 /* v.ast.CallExpr */) { + if (last_stmt._typ == 349 /* v.ast.ExprStmt */) { + if (((*last_stmt._v__ast__ExprStmt).expr)._typ == 295 /* v.ast.CallExpr */) { if ((*(*last_stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).should_be_skipped) { v__checker__Checker_error(c, _SLIT("[noreturn] functions cannot end with a skippable `[if ..]` call"), (*last_stmt._v__ast__ExprStmt).pos); return; @@ -60356,7 +58466,7 @@ VV_LOCAL_SYMBOL void v__checker__Checker_check_noreturn_fn_decl(v__checker__Chec } } } - else if (last_stmt._typ == 350 /* v.ast.ForStmt */) { + else if (last_stmt._typ == 352 /* v.ast.ForStmt */) { if ((*last_stmt._v__ast__ForStmt).is_inf && (*last_stmt._v__ast__ForStmt).stmts.len == 0) { is_valid_end_of_noreturn_fn = true; } @@ -60379,24 +58489,24 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } for (int _t2 = 0; _t2 < stmts.len; ++_t2) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[_t2]; - if (stmt._typ == 358 /* v.ast.Return */) { + if (stmt._typ == 360 /* v.ast.Return */) { bool _t3 = true; return _t3; } - else if (stmt._typ == 340 /* v.ast.Block */) { + else if (stmt._typ == 342 /* v.ast.Block */) { if (v__checker__uses_return_stmt((*stmt._v__ast__Block).stmts)) { bool _t4 = true; return _t4; } } - else if (stmt._typ == 347 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).expr._typ == 293 /* v.ast.CallExpr */) { + else if (stmt._typ == 349 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 295 /* v.ast.CallExpr */) { if (v__checker__uses_return_stmt((*(*stmt._v__ast__ExprStmt).expr._v__ast__CallExpr).or_block.stmts)) { bool _t5 = true; return _t5; } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 317 /* v.ast.MatchExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 319 /* v.ast.MatchExpr */) { for (int _t6 = 0; _t6 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.len; ++_t6) { v__ast__MatchBranch b = ((v__ast__MatchBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__MatchExpr).branches.data)[_t6]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -60405,7 +58515,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 326 /* v.ast.SelectExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 328 /* v.ast.SelectExpr */) { for (int _t8 = 0; _t8 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__SelectExpr).branches.len; ++_t8) { v__ast__SelectBranch b = ((v__ast__SelectBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__SelectExpr).branches.data)[_t8]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -60414,7 +58524,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } } } - else if ((*stmt._v__ast__ExprStmt).expr._typ == 308 /* v.ast.IfExpr */) { + else if ((*stmt._v__ast__ExprStmt).expr._typ == 310 /* v.ast.IfExpr */) { for (int _t10 = 0; _t10 < (*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.len; ++_t10) { v__ast__IfBranch b = ((v__ast__IfBranch*)(*(*stmt._v__ast__ExprStmt).expr._v__ast__IfExpr).branches.data)[_t10]; if (v__checker__uses_return_stmt(b.stmts)) { @@ -60428,19 +58538,19 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } ; } - else if (stmt._typ == 350 /* v.ast.ForStmt */) { + else if (stmt._typ == 352 /* v.ast.ForStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForStmt).stmts)) { bool _t12 = true; return _t12; } } - else if (stmt._typ == 348 /* v.ast.ForCStmt */) { + else if (stmt._typ == 350 /* v.ast.ForCStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForCStmt).stmts)) { bool _t13 = true; return _t13; } } - else if (stmt._typ == 349 /* v.ast.ForInStmt */) { + else if (stmt._typ == 351 /* v.ast.ForInStmt */) { if (v__checker__uses_return_stmt((*stmt._v__ast__ForInStmt).stmts)) { bool _t14 = true; return _t14; @@ -60456,7 +58566,7 @@ VV_LOCAL_SYMBOL bool v__checker__uses_return_stmt(Array_v__ast__Stmt stmts) { } VV_LOCAL_SYMBOL bool v__checker__is_noreturn_callexpr(v__ast__Expr expr) { - if ((expr)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 295 /* v.ast.CallExpr */) { bool _t1 = (*expr._v__ast__CallExpr).is_noreturn; return _t1; } @@ -60483,7 +58593,7 @@ u8 v__checker__Checker_get_default_fmt(v__checker__Checker* c, v__ast__Type ftyp } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, v__checker__Checker_unwrap_generic(c, ftyp)); if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; sym = v__ast__Table_sym(c->table, info.parent_type); if (v__ast__Type_alias_eq(info.parent_type, _const_v__ast__string_type)) { u8 _t6 = 's'; @@ -60659,7 +58769,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* v__ast__TypeSymbol* struct_sym = mr_405.arg0; int struct_typ_idx = mr_405.arg1; bool has_generic_types = false; - if ((struct_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((struct_sym->info)._typ == 459 /* v.ast.Struct */) { for (int _t1 = 0; _t1 < node->embeds.len; ++_t1) { v__ast__Embed embed = ((v__ast__Embed*)node->embeds.data)[_t1]; if (v__ast__Type_has_flag(embed.typ, v__ast__TypeFlag__generic)) { @@ -60669,7 +58779,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* if (embed_sym->kind != v__ast__Kind__struct_) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("`"), /*115 &string*/0xfe10, {.d_s = embed_sym->name}}, {_SLIT("` is not a struct"), 0, { .d_c = 0 }}})), embed.pos); } else { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (info.is_heap && !v__ast__Type_is_ptr(embed.typ)) { (*struct_sym->info._v__ast__Struct).is_heap = true; } @@ -60717,7 +58827,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } v__ast__TypeSymbol* field_sym = v__ast__Table_sym(c->table, field.typ); if (field_sym->kind == v__ast__Kind__function) { - v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType fn_info = /* as */ *(v__ast__FnType*)__as_cast((field_sym->info)._v__ast__FnType,(field_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; _option_void _t4 = v__checker__Checker_ensure_type_exists(c, fn_info.func.return_type, fn_info.func.return_type_pos); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { IError err = _t4.err; @@ -60738,7 +58848,7 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* } } if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (info.is_heap && !v__ast__Type_is_ptr(field.typ)) { (*struct_sym->info._v__ast__Struct).is_heap = true; } @@ -60770,15 +58880,15 @@ void v__checker__Checker_struct_decl(v__checker__Checker* c, v__ast__StructDecl* if (v__ast__Type_is_ptr(field.typ)) { continue; } - if ((field.default_expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((field.default_expr)._typ == 314 /* v.ast.IntegerLiteral */) { if (string__eq((*field.default_expr._v__ast__IntegerLiteral).val, _SLIT("0"))) { v__checker__Checker_warn(c, _SLIT("unnecessary default value of `0`: struct fields are zeroed by default"), (*field.default_expr._v__ast__IntegerLiteral).pos); } - } else if ((field.default_expr)._typ == 331 /* v.ast.StringLiteral */) { + } else if ((field.default_expr)._typ == 333 /* v.ast.StringLiteral */) { if (((*field.default_expr._v__ast__StringLiteral).val).len == 0) { v__checker__Checker_warn(c, _SLIT("unnecessary default value of '': struct fields are zeroed by default"), (*field.default_expr._v__ast__StringLiteral).pos); } - } else if ((field.default_expr)._typ == 291 /* v.ast.BoolLiteral */) { + } else if ((field.default_expr)._typ == 293 /* v.ast.BoolLiteral */) { if ((*field.default_expr._v__ast__BoolLiteral).val == false) { v__checker__Checker_warn(c, _SLIT("unnecessary default value `false`: struct fields are zeroed by default"), (*field.default_expr._v__ast__BoolLiteral).pos); } @@ -60810,18 +58920,18 @@ VV_LOCAL_SYMBOL int v__checker__minify_sort_fn(v__ast__StructField* a, v__ast__S v__ast__Table* t = global_table; v__ast__TypeSymbol* a_sym = v__ast__Table_sym(t, a->typ); v__ast__TypeSymbol* b_sym = v__ast__Table_sym(t, b->typ); - if ((a_sym->info)._typ == 486 /* v.ast.Enum */) { + if ((a_sym->info)._typ == 488 /* 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, 486) /*expected idx: 486, name: v.ast.Enum */ ).vals.len; + int b_nr_vals = (/* as */ *(v__ast__Enum*)__as_cast((b_sym->info)._v__ast__Enum,(b_sym->info)._typ, 488) /*expected idx: 488, 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 == 486 /* v.ast.Enum */) { + } else if ((b_sym->info)._typ == 488 /* 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; @@ -60852,7 +58962,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } } v__ast__TypeSymbol* struct_sym = v__ast__Table_sym(c->table, node->typ); - if ((struct_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((struct_sym->info)._typ == 459 /* v.ast.Struct */) { for (int _t2 = 0; _t2 < (*struct_sym->info._v__ast__Struct).concrete_types.len; ++_t2) { v__ast__Type ct = ((v__ast__Type*)(*struct_sym->info._v__ast__Struct).concrete_types.data)[_t2]; v__ast__TypeSymbol* ct_sym = v__ast__Table_sym(c->table, ct); @@ -60882,7 +58992,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (node->generic_types.len > 0 && (*struct_sym->info._v__ast__Struct).generic_types.len == node->generic_types.len && !Array_v__ast__Type_arr_eq((*struct_sym->info._v__ast__Struct).generic_types, node->generic_types)) { v__ast__Table_replace_generic_type(c->table, node->typ, node->generic_types); } - } else if ((struct_sym->info)._typ == 472 /* v.ast.Alias */) { + } else if ((struct_sym->info)._typ == 474 /* v.ast.Alias */) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(c->table, (*struct_sym->info._v__ast__Alias).parent_type); if (parent_sym->kind == v__ast__Kind__map) { string alias_str = v__ast__Table_type_to_str(c->table, node->typ); @@ -60925,7 +59035,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str if (type_sym->kind == v__ast__Kind__interface_ && type_sym->language != v__ast__Language__js) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate interface `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); } - if ((type_sym->info)._typ == 472 /* v.ast.Alias */) { + if ((type_sym->info)._typ == 474 /* v.ast.Alias */) { if (v__ast__Type_is_number((*type_sym->info._v__ast__Alias).parent_type)) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot instantiate number type alias `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node->pos); v__ast__Type _t7 = _const_v__ast__void_type; @@ -60936,7 +59046,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("type `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is private"), 0, { .d_c = 0 }}})), node->pos); } if (type_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (info.attrs.len > 0 && string__eq((*(v__ast__Attr*)/*ee elem_sym */array_get(info.attrs, 0)).name, _SLIT("noinit")) && !string__eq(type_sym->mod, c->mod)) { v__checker__Checker_error(c, string__plus( str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("` is declared with a `[noinit]` attribute, so "), 0, { .d_c = 0 }}})), str_intp(2, _MOV((StrIntpData[]){{_SLIT("it cannot be initialized with `"), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT("{}`"), 0, { .d_c = 0 }}}))), node->pos); } @@ -60955,7 +59065,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str else if (type_sym->kind == (v__ast__Kind__struct_) || type_sym->kind == (v__ast__Kind__string) || type_sym->kind == (v__ast__Kind__array) || type_sym->kind == (v__ast__Kind__alias)) { v__ast__Struct info = ((v__ast__Struct){.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.embeds = __new_array(0, 0, sizeof(v__ast__Type)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.concrete_types = __new_array(0, 0, sizeof(v__ast__Type)),.parent_type = 0,.is_typedef = 0,.is_union = 0,.is_heap = 0,.is_minify = 0,.is_generic = 0,}); if (type_sym->kind == v__ast__Kind__alias) { - v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias info_t = /* as */ *(v__ast__Alias*)__as_cast((type_sym->info)._v__ast__Alias,(type_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; v__ast__TypeSymbol* sym = v__ast__Table_sym(c->table, info_t.parent_type); if (sym->kind == v__ast__Kind__placeholder) { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown struct: "), /*115 &string*/0xfe10, {.d_s = type_sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})), node->pos); @@ -60963,12 +59073,12 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str return _t10; } if (sym->kind == v__ast__Kind__struct_) { - info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; } else { v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("alias type name: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not struct type"), 0, { .d_c = 0 }}})), node->pos); } } else { - info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; } if (node->is_short) { int exp_len = info.fields.len; @@ -61053,7 +59163,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } if (field_type_sym->kind == v__ast__Kind__function && field_type_sym->language == v__ast__Language__v) { v__token__Pos pos = v__ast__Expr_pos(field->expr); - if ((field->expr)._typ == 285 /* v.ast.AnonFn */) { + if ((field->expr)._typ == 287 /* v.ast.AnonFn */) { if ((*field->expr._v__ast__AnonFn).decl.no_body) { v__checker__Checker_error(c, _SLIT("cannot initialize the fn field with anonymous fn that does not have a body"), pos); } @@ -61065,8 +59175,8 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str v__checker__Checker_error(c, str_intp(2, _MOV((StrIntpData[]){{_SLIT("field `"), /*115 &string*/0xfe10, {.d_s = field_info.name}}, {_SLIT("` is optional, but initialization of optional fields currently unsupported"), 0, { .d_c = 0 }}})), field->pos); } if (v__ast__Type_is_ptr(expr_type) && v__ast__Type_is_ptr(expected_type)) { - if ((field->expr)._typ == 307 /* v.ast.Ident */) { - if (((*field->expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((field->expr)._typ == 309 /* v.ast.Ident */) { + if (((*field->expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { v__ast__Var* obj = &(*(*field->expr._v__ast__Ident).obj._v__ast__Var); if (c->fn_scope != ((voidptr)(0))) { _option_v__ast__Var_ptr _t14 = v__ast__Scope_find_var(c->fn_scope, obj->name); @@ -61095,7 +59205,7 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } if (field.has_default_expr) { if (field.default_expr_typ == 0) { - if ((field.default_expr)._typ == 332 /* v.ast.StructInit */) { + if ((field.default_expr)._typ == 334 /* v.ast.StructInit */) { int idx = v__ast__Table_find_type_idx(c->table, (*field.default_expr._v__ast__StructInit).typ_str); if (idx != 0) { (*(v__ast__StructField*)/*ee elem_sym */array_get(info.fields, i)).default_expr_typ = v__ast__new_type(idx); @@ -61151,8 +59261,8 @@ v__ast__Type v__checker__Checker_struct_init(v__checker__Checker* c, v__ast__Str } else if (!v__ast__Type_alias_eq(update_type, node->typ)) { v__ast__TypeSymbol* from_sym = v__ast__Table_sym(c->table, update_type); v__ast__TypeSymbol* to_sym = v__ast__Table_sym(c->table, node->typ); - v__ast__Struct from_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; - v__ast__Struct to_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct from_info = /* as */ *(v__ast__Struct*)__as_cast((from_sym->info)._v__ast__Struct,(from_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; + v__ast__Struct to_info = /* as */ *(v__ast__Struct*)__as_cast((to_sym->info)._v__ast__Struct,(to_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (!v__checker__Checker_check_struct_signature(c, from_info, to_info)) { v__checker__Checker_error(c, str_intp(3, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = from_sym->name}}, {_SLIT("` is not compatible with struct `"), /*115 &string*/0xfe10, {.d_s = to_sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), v__ast__Expr_pos(node->update_expr)); } @@ -61312,9 +59422,9 @@ void v__transformer__Transformer_find_new_array_len(v__transformer__Transformer* return; } v__ast__Expr right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if ((right)._typ == 287 /* v.ast.ArrayInit */) { + if ((right)._typ == 289 /* v.ast.ArrayInit */) { v__ast__Expr left = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left)._typ == 307 /* v.ast.Ident */) { + if ((left)._typ == 309 /* v.ast.Ident */) { if ((*left._v__ast__Ident).is_mut) { v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, -2); return; @@ -61325,7 +59435,7 @@ void v__transformer__Transformer_find_new_array_len(v__transformer__Transformer* } int len = ((int)(0)); v__ast__Expr value = (*right._v__ast__ArrayInit).len_expr; - if ((value)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((value)._typ == 314 /* v.ast.IntegerLiteral */) { len = string_int((*value._v__ast__IntegerLiteral).val) + 1; } v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, len); @@ -61338,19 +59448,19 @@ void v__transformer__Transformer_find_new_range(v__transformer__Transformer* t, return; } v__ast__Expr right = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if ((right)._typ == 310 /* v.ast.IndexExpr */) { + if ((right)._typ == 312 /* v.ast.IndexExpr */) { v__ast__Expr left = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left)._typ == 307 /* v.ast.Ident */) { + if ((left)._typ == 309 /* v.ast.Ident */) { if ((*left._v__ast__Ident).is_mut) { v__transformer__IndexState_safe_access(t->index, (*left._v__ast__Ident).name, -2); return; } v__ast__Expr index = (*right._v__ast__IndexExpr).index; - if ((index)._typ == 325 /* v.ast.RangeExpr */) { + if ((index)._typ == 327 /* v.ast.RangeExpr */) { v__ast__Expr range_low = (*index._v__ast__RangeExpr).low; - if ((range_low)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((range_low)._typ == 314 /* v.ast.IntegerLiteral */) { v__ast__Expr sub_left = (*right._v__ast__IndexExpr).left; - if ((sub_left)._typ == 307 /* v.ast.Ident */) { + if ((sub_left)._typ == 309 /* v.ast.Ident */) { int safe = v__transformer__IndexState_safe_offset(t->index, (*sub_left._v__ast__Ident).name); int low = string_int((*range_low._v__ast__IntegerLiteral).val); if (safe >= low) { @@ -61378,40 +59488,40 @@ void v__transformer__Transformer_check_safe_array(v__transformer__Transformer* t } v__ast__Expr index = node->index; v__ast__Expr name = node->left; - if (index._typ == 312 /* v.ast.IntegerLiteral */) { + if (index._typ == 314 /* v.ast.IntegerLiteral */) { bool is_direct = v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*index._v__ast__IntegerLiteral).val)); node->is_direct = is_direct; } - else if (index._typ == 325 /* v.ast.RangeExpr */) { + else if (index._typ == 327 /* v.ast.RangeExpr */) { if ((*index._v__ast__RangeExpr).has_high) { v__ast__Expr high = (*index._v__ast__RangeExpr).high; - if ((high)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((high)._typ == 314 /* v.ast.IntegerLiteral */) { v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*high._v__ast__IntegerLiteral).val)); return; } } if ((*index._v__ast__RangeExpr).has_low) { v__ast__Expr low = (*index._v__ast__RangeExpr).low; - if ((low)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((low)._typ == 314 /* v.ast.IntegerLiteral */) { v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int((*low._v__ast__IntegerLiteral).val)); return; } } } - else if (index._typ == 294 /* v.ast.CastExpr */) { + else if (index._typ == 296 /* v.ast.CastExpr */) { if (!string__eq((*index._v__ast__CastExpr).typname, _SLIT("int"))) { return; } v__ast__Expr index_expr = (*index._v__ast__CastExpr).expr; - if ((index_expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((index_expr)._typ == 314 /* v.ast.IntegerLiteral */) { string val = (*index_expr._v__ast__IntegerLiteral).val; node->is_direct = v__transformer__IndexState_safe_access(t->index, v__ast__Expr_str(name), string_int(val)); } } - else if (index._typ == 304 /* v.ast.EnumVal */) { + else if (index._typ == 306 /* v.ast.EnumVal */) { ; } - else if (index._typ == 307 /* v.ast.Ident */) { + else if (index._typ == 309 /* v.ast.Ident */) { } else { @@ -61420,17 +59530,17 @@ void v__transformer__Transformer_check_safe_array(v__transformer__Transformer* t } v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v__ast__Stmt* node) { - if (node->_typ == 345 /* v.ast.EmptyStmt */) { + if (node->_typ == 347 /* v.ast.EmptyStmt */) { } - else if (node->_typ == 318 /* v.ast.NodeError */) { + else if (node->_typ == 320 /* v.ast.NodeError */) { } - else if (node->_typ == 337 /* v.ast.AsmStmt */) { + else if (node->_typ == 339 /* v.ast.AsmStmt */) { } - else if (node->_typ == 338 /* v.ast.AssertStmt */) { + else if (node->_typ == 340 /* v.ast.AssertStmt */) { v__ast__Stmt _t1 = v__transformer__Transformer_assert_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__AssertStmt)); return _t1; } - else if (node->_typ == 339 /* v.ast.AssignStmt */) { + else if (node->_typ == 341 /* v.ast.AssignStmt */) { v__transformer__Transformer_find_new_array_len(t, (*node->_v__ast__AssignStmt)); v__transformer__Transformer_find_new_range(t, (*node->_v__ast__AssignStmt)); v__transformer__Transformer_find_mut_self_assign(t, (*node->_v__ast__AssignStmt)); @@ -61443,7 +59553,7 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ *left = v__transformer__Transformer_expr(t, left); } } - else if (node->_typ == 340 /* v.ast.Block */) { + else if (node->_typ == 342 /* v.ast.Block */) { v__transformer__IndexState_indent(t->index, false); for (int _t4 = 0; _t4 < (*node->_v__ast__Block).stmts.len; ++_t4) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__Block).stmts.data) + _t4; @@ -61451,35 +59561,35 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 341 /* v.ast.BranchStmt */) { + else if (node->_typ == 343 /* v.ast.BranchStmt */) { t->index->disabled = true; } - else if (node->_typ == 342 /* v.ast.ComptimeFor */) { + else if (node->_typ == 344 /* v.ast.ComptimeFor */) { for (int _t5 = 0; _t5 < (*node->_v__ast__ComptimeFor).stmts.len; ++_t5) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__ComptimeFor).stmts.data) + _t5; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 343 /* v.ast.ConstDecl */) { + else if (node->_typ == 345 /* v.ast.ConstDecl */) { for (int _t6 = 0; _t6 < (*node->_v__ast__ConstDecl).fields.len; ++_t6) { v__ast__ConstField* field = ((v__ast__ConstField*)(*node->_v__ast__ConstDecl).fields.data) + _t6; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } } - else if (node->_typ == 344 /* v.ast.DeferStmt */) { + else if (node->_typ == 346 /* v.ast.DeferStmt */) { for (int _t7 = 0; _t7 < (*node->_v__ast__DeferStmt).stmts.len; ++_t7) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__DeferStmt).stmts.data) + _t7; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 346 /* v.ast.EnumDecl */) { + else if (node->_typ == 348 /* v.ast.EnumDecl */) { } - else if (node->_typ == 347 /* v.ast.ExprStmt */) { + else if (node->_typ == 349 /* v.ast.ExprStmt */) { v__ast__Expr _t8 = {0}; - if ((*node->_v__ast__ExprStmt).expr._typ == 308 /* v.ast.IfExpr */) { + if ((*node->_v__ast__ExprStmt).expr._typ == 310 /* v.ast.IfExpr */) { _t8 = v__transformer__Transformer_expr_stmt_if_expr(t, (voidptr)&/*qq*/(*(*node->_v__ast__ExprStmt).expr._v__ast__IfExpr)); } - else if ((*node->_v__ast__ExprStmt).expr._typ == 317 /* v.ast.MatchExpr */) { + else if ((*node->_v__ast__ExprStmt).expr._typ == 319 /* v.ast.MatchExpr */) { _t8 = v__transformer__Transformer_expr_stmt_match_expr(t, (voidptr)&/*qq*/(*(*node->_v__ast__ExprStmt).expr._v__ast__MatchExpr)); } @@ -61496,11 +59606,11 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 348 /* v.ast.ForCStmt */) { + else if (node->_typ == 350 /* v.ast.ForCStmt */) { v__ast__Stmt _t10 = v__transformer__Transformer_for_c_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__ForCStmt)); return _t10; } - else if (node->_typ == 349 /* v.ast.ForInStmt */) { + else if (node->_typ == 351 /* v.ast.ForInStmt */) { v__transformer__IndexState_indent(t->index, false); for (int _t11 = 0; _t11 < (*node->_v__ast__ForInStmt).stmts.len; ++_t11) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__ForInStmt).stmts.data) + _t11; @@ -61508,50 +59618,50 @@ v__ast__Stmt v__transformer__Transformer_stmt(v__transformer__Transformer* t, v_ } v__transformer__IndexState_unindent(t->index); } - else if (node->_typ == 350 /* v.ast.ForStmt */) { + else if (node->_typ == 352 /* v.ast.ForStmt */) { v__ast__Stmt _t12 = v__transformer__Transformer_for_stmt(t, (voidptr)&/*qq*/(*node->_v__ast__ForStmt)); return _t12; } - else if (node->_typ == 351 /* v.ast.GlobalDecl */) { + else if (node->_typ == 353 /* v.ast.GlobalDecl */) { for (int _t13 = 0; _t13 < (*node->_v__ast__GlobalDecl).fields.len; ++_t13) { v__ast__GlobalField* field = ((v__ast__GlobalField*)(*node->_v__ast__GlobalDecl).fields.data) + _t13; field->expr = v__transformer__Transformer_expr(t, &/*sum*/field->expr); } } - else if (node->_typ == 352 /* v.ast.GotoLabel */) { + else if (node->_typ == 354 /* v.ast.GotoLabel */) { } - else if (node->_typ == 353 /* v.ast.GotoStmt */) { + else if (node->_typ == 355 /* v.ast.GotoStmt */) { t->index->disabled = true; } - else if (node->_typ == 354 /* v.ast.HashStmt */) { + else if (node->_typ == 356 /* v.ast.HashStmt */) { for (int _t14 = 0; _t14 < (*node->_v__ast__HashStmt).ct_conds.len; ++_t14) { v__ast__Expr* cond = ((v__ast__Expr*)(*node->_v__ast__HashStmt).ct_conds.data) + _t14; *cond = v__transformer__Transformer_expr(t, cond); } } - else if (node->_typ == 355 /* v.ast.Import */) { + else if (node->_typ == 357 /* v.ast.Import */) { } - else if (node->_typ == 356 /* v.ast.InterfaceDecl */) { + else if (node->_typ == 358 /* v.ast.InterfaceDecl */) { v__ast__Stmt _t15 = v__transformer__Transformer_interface_decl(t, (voidptr)&/*qq*/(*node->_v__ast__InterfaceDecl)); return _t15; } - else if (node->_typ == 357 /* v.ast.Module */) { + else if (node->_typ == 359 /* v.ast.Module */) { } - else if (node->_typ == 358 /* v.ast.Return */) { + else if (node->_typ == 360 /* v.ast.Return */) { for (int _t16 = 0; _t16 < (*node->_v__ast__Return).exprs.len; ++_t16) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__Return).exprs.data) + _t16; *expr = v__transformer__Transformer_expr(t, expr); } } - else if (node->_typ == 359 /* v.ast.SqlStmt */) { + else if (node->_typ == 361 /* v.ast.SqlStmt */) { } - else if (node->_typ == 360 /* v.ast.StructDecl */) { + else if (node->_typ == 362 /* v.ast.StructDecl */) { for (int _t17 = 0; _t17 < (*node->_v__ast__StructDecl).fields.len; ++_t17) { v__ast__StructField* field = ((v__ast__StructField*)(*node->_v__ast__StructDecl).fields.data) + _t17; field->default_expr = v__transformer__Transformer_expr(t, &/*sum*/field->default_expr); } } - else if (node->_typ == 284 /* v.ast.TypeDecl */) { + else if (node->_typ == 286 /* v.ast.TypeDecl */) { } ; v__ast__Stmt _t18 = *node; @@ -61565,11 +59675,11 @@ v__ast__Stmt v__transformer__Transformer_assert_stmt(v__transformer__Transformer v__ast__Stmt _t1 = v__ast__AssertStmt_to_sumtype_v__ast__Stmt(node); return _t1; } - if ((node->expr)._typ == 311 /* v.ast.InfixExpr */) { + if ((node->expr)._typ == 313 /* v.ast.InfixExpr */) { v__ast__Expr right = (*node->expr._v__ast__InfixExpr).right; - if (right._typ == 312 /* v.ast.IntegerLiteral */) { + if (right._typ == 314 /* v.ast.IntegerLiteral */) { v__ast__Expr left = (*node->expr._v__ast__InfixExpr).left; - if ((left)._typ == 327 /* v.ast.SelectorExpr */) { + if ((left)._typ == 329 /* v.ast.SelectorExpr */) { int len = string_int((*right._v__ast__IntegerLiteral).val); if (string__eq((*left._v__ast__SelectorExpr).field_name, _SLIT("len"))) { @@ -61587,9 +59697,9 @@ v__ast__Stmt v__transformer__Transformer_assert_stmt(v__transformer__Transformer } } } - else if (right._typ == 327 /* v.ast.SelectorExpr */) { + else if (right._typ == 329 /* v.ast.SelectorExpr */) { v__ast__Expr left = (*node->expr._v__ast__InfixExpr).left; - if ((left)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((left)._typ == 314 /* v.ast.IntegerLiteral */) { int len = string_int((*left._v__ast__IntegerLiteral).val); if (string__eq((*right._v__ast__SelectorExpr).field_name, _SLIT("len"))) { @@ -61628,7 +59738,7 @@ v__ast__Expr v__transformer__Transformer_expr_stmt_if_expr(v__transformer__Trans v__ast__IfBranch* branch = ((v__ast__IfBranch*)node->branches.data) + i; v__ast__Expr cond = v__transformer__Transformer_expr(t, &/*sum*/branch->cond); *branch = ((v__ast__IfBranch){(*branch).pos,(*branch).body_pos,(*branch).comments,.cond = cond,(*branch).pkg_exist,(*branch).stmts,(*branch).scope,}); - if ((cond)._typ == 291 /* v.ast.BoolLiteral */) { + if ((cond)._typ == 293 /* v.ast.BoolLiteral */) { if ((*cond._v__ast__BoolLiteral).val) { stop_index = i; break; @@ -61687,36 +59797,36 @@ v__ast__Expr v__transformer__Transformer_expr_stmt_match_expr(v__transformer__Tr for (int _t3 = 0; _t3 < branch->exprs.len; ++_t3) { v__ast__Expr* expr = ((v__ast__Expr*)branch->exprs.data) + _t3; *expr = v__transformer__Transformer_expr(t, expr); - if (cond._typ == 291 /* v.ast.BoolLiteral */) { - if ((expr)->_typ == 291 /* v.ast.BoolLiteral */) { - if ((*cond._v__ast__BoolLiteral).val == (/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)->_v__ast__BoolLiteral,(expr)->_typ, 291) /*expected idx: 291, name: v.ast.BoolLiteral */ ).val) { + if (cond._typ == 293 /* v.ast.BoolLiteral */) { + if ((expr)->_typ == 293 /* v.ast.BoolLiteral */) { + if ((*cond._v__ast__BoolLiteral).val == (/* as */ *(v__ast__BoolLiteral*)__as_cast((expr)->_v__ast__BoolLiteral,(expr)->_typ, 293) /*expected idx: 293, name: v.ast.BoolLiteral */ ).val) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 312 /* v.ast.IntegerLiteral */) { - if ((expr)->_typ == 312 /* v.ast.IntegerLiteral */) { - if (string_int((*cond._v__ast__IntegerLiteral).val) == string_int((/* as */ *(v__ast__IntegerLiteral*)__as_cast((expr)->_v__ast__IntegerLiteral,(expr)->_typ, 312) /*expected idx: 312, name: v.ast.IntegerLiteral */ ).val)) { + else if (cond._typ == 314 /* v.ast.IntegerLiteral */) { + if ((expr)->_typ == 314 /* v.ast.IntegerLiteral */) { + if (string_int((*cond._v__ast__IntegerLiteral).val) == string_int((/* as */ *(v__ast__IntegerLiteral*)__as_cast((expr)->_v__ast__IntegerLiteral,(expr)->_typ, 314) /*expected idx: 314, name: v.ast.IntegerLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 305 /* v.ast.FloatLiteral */) { - if ((expr)->_typ == 305 /* v.ast.FloatLiteral */) { - if (string_f32((*cond._v__ast__FloatLiteral).val) == string_f32((/* as */ *(v__ast__FloatLiteral*)__as_cast((expr)->_v__ast__FloatLiteral,(expr)->_typ, 305) /*expected idx: 305, name: v.ast.FloatLiteral */ ).val)) { + else if (cond._typ == 307 /* v.ast.FloatLiteral */) { + if ((expr)->_typ == 307 /* v.ast.FloatLiteral */) { + if (string_f32((*cond._v__ast__FloatLiteral).val) == string_f32((/* as */ *(v__ast__FloatLiteral*)__as_cast((expr)->_v__ast__FloatLiteral,(expr)->_typ, 307) /*expected idx: 307, name: v.ast.FloatLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; } } } - else if (cond._typ == 331 /* v.ast.StringLiteral */) { - if ((expr)->_typ == 331 /* v.ast.StringLiteral */) { - if (string__eq((*cond._v__ast__StringLiteral).val, (/* as */ *(v__ast__StringLiteral*)__as_cast((expr)->_v__ast__StringLiteral,(expr)->_typ, 331) /*expected idx: 331, name: v.ast.StringLiteral */ ).val)) { + else if (cond._typ == 333 /* v.ast.StringLiteral */) { + if ((expr)->_typ == 333 /* v.ast.StringLiteral */) { + if (string__eq((*cond._v__ast__StringLiteral).val, (/* as */ *(v__ast__StringLiteral*)__as_cast((expr)->_v__ast__StringLiteral,(expr)->_typ, 333) /*expected idx: 333, name: v.ast.StringLiteral */ ).val)) { branch->exprs = new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){*expr})); node->branches = new_array_from_c_array(1, 1, sizeof(v__ast__MatchBranch), _MOV((v__ast__MatchBranch[1]){*branch})); terminate = true; @@ -61764,8 +59874,8 @@ v__ast__Stmt v__transformer__Transformer_for_c_stmt(v__transformer__Transformer* v__ast__Stmt v__transformer__Transformer_for_stmt(v__transformer__Transformer* t, v__ast__ForStmt* node) { node->cond = v__transformer__Transformer_expr(t, &/*sum*/node->cond); - if (node->cond._typ == 291 /* v.ast.BoolLiteral */) { - if (!(/* as */ *(v__ast__BoolLiteral*)__as_cast((node->cond)._v__ast__BoolLiteral,(node->cond)._typ, 291) /*expected idx: 291, name: v.ast.BoolLiteral */ ).val) { + if (node->cond._typ == 293 /* v.ast.BoolLiteral */) { + if (!(/* as */ *(v__ast__BoolLiteral*)__as_cast((node->cond)._v__ast__BoolLiteral,(node->cond)._typ, 293) /*expected idx: 293, name: v.ast.BoolLiteral */ ).val) { v__ast__Stmt _t1 = v__ast__EmptyStmt_to_sumtype_v__ast__Stmt(ADDR(v__ast__EmptyStmt, (((v__ast__EmptyStmt){.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); return _t1; } @@ -61800,13 +59910,13 @@ v__ast__Stmt v__transformer__Transformer_interface_decl(v__transformer__Transfor } v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v__ast__Expr* node) { - if (node->_typ == 285 /* v.ast.AnonFn */) { + if (node->_typ == 287 /* v.ast.AnonFn */) { (*node->_v__ast__AnonFn).decl = /* as */ *(v__ast__FnDecl*)__as_cast((v__transformer__Transformer_stmt(t, HEAP(v__ast__Stmt, v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*node->_v__ast__AnonFn).decl))))._v__ast__FnDecl,(v__transformer__Transformer_stmt(t, HEAP(v__ast__Stmt, v__ast__FnDecl_to_sumtype_v__ast__Stmt(&(*node->_v__ast__AnonFn).decl))))._typ, 220) /*expected idx: 220, name: v.ast.FnDecl */ ; } - else if (node->_typ == 286 /* v.ast.ArrayDecompose */) { + else if (node->_typ == 288 /* v.ast.ArrayDecompose */) { (*node->_v__ast__ArrayDecompose).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayDecompose).expr); } - else if (node->_typ == 287 /* v.ast.ArrayInit */) { + else if (node->_typ == 289 /* v.ast.ArrayInit */) { for (int _t1 = 0; _t1 < (*node->_v__ast__ArrayInit).exprs.len; ++_t1) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__ArrayInit).exprs.data) + _t1; *expr = v__transformer__Transformer_expr(t, expr); @@ -61815,73 +59925,73 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ (*node->_v__ast__ArrayInit).cap_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayInit).cap_expr); (*node->_v__ast__ArrayInit).default_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ArrayInit).default_expr); } - else if (node->_typ == 288 /* v.ast.AsCast */) { + else if (node->_typ == 290 /* v.ast.AsCast */) { (*node->_v__ast__AsCast).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__AsCast).expr); } - else if (node->_typ == 292 /* v.ast.CTempVar */) { + else if (node->_typ == 294 /* v.ast.CTempVar */) { (*node->_v__ast__CTempVar).orig = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CTempVar).orig); } - else if (node->_typ == 293 /* v.ast.CallExpr */) { + else if (node->_typ == 295 /* v.ast.CallExpr */) { (*node->_v__ast__CallExpr).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CallExpr).left); for (int _t2 = 0; _t2 < (*node->_v__ast__CallExpr).args.len; ++_t2) { v__ast__CallArg* arg = ((v__ast__CallArg*)(*node->_v__ast__CallExpr).args.data) + _t2; arg->expr = v__transformer__Transformer_expr(t, &/*sum*/arg->expr); } - (*node->_v__ast__CallExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._typ, 321) /*expected idx: 321, name: v.ast.OrExpr */ ; + (*node->_v__ast__CallExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__CallExpr).or_block))))._typ, 323) /*expected idx: 323, name: v.ast.OrExpr */ ; } - else if (node->_typ == 294 /* v.ast.CastExpr */) { + else if (node->_typ == 296 /* v.ast.CastExpr */) { (*node->_v__ast__CastExpr).arg = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CastExpr).arg); (*node->_v__ast__CastExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__CastExpr).expr); } - else if (node->_typ == 295 /* v.ast.ChanInit */) { + else if (node->_typ == 297 /* v.ast.ChanInit */) { (*node->_v__ast__ChanInit).cap_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ChanInit).cap_expr); } - else if (node->_typ == 298 /* v.ast.ComptimeCall */) { + else if (node->_typ == 300 /* v.ast.ComptimeCall */) { for (int _t3 = 0; _t3 < (*node->_v__ast__ComptimeCall).args.len; ++_t3) { v__ast__CallArg* arg = ((v__ast__CallArg*)(*node->_v__ast__ComptimeCall).args.data) + _t3; arg->expr = v__transformer__Transformer_expr(t, &/*sum*/arg->expr); } } - else if (node->_typ == 299 /* v.ast.ComptimeSelector */) { + else if (node->_typ == 301 /* v.ast.ComptimeSelector */) { (*node->_v__ast__ComptimeSelector).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ComptimeSelector).left); (*node->_v__ast__ComptimeSelector).field_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ComptimeSelector).field_expr); } - else if (node->_typ == 301 /* v.ast.ConcatExpr */) { + else if (node->_typ == 303 /* v.ast.ConcatExpr */) { for (int _t4 = 0; _t4 < (*node->_v__ast__ConcatExpr).vals.len; ++_t4) { v__ast__Expr* val = ((v__ast__Expr*)(*node->_v__ast__ConcatExpr).vals.data) + _t4; *val = v__transformer__Transformer_expr(t, val); } } - else if (node->_typ == 302 /* v.ast.DumpExpr */) { + else if (node->_typ == 304 /* v.ast.DumpExpr */) { (*node->_v__ast__DumpExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__DumpExpr).expr); } - else if (node->_typ == 306 /* v.ast.GoExpr */) { - (*node->_v__ast__GoExpr).call_expr = /* as */ *(v__ast__CallExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._v__ast__CallExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._typ, 293) /*expected idx: 293, name: v.ast.CallExpr */ ; + else if (node->_typ == 308 /* v.ast.GoExpr */) { + (*node->_v__ast__GoExpr).call_expr = /* as */ *(v__ast__CallExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._v__ast__CallExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__GoExpr).call_expr))))._typ, 295) /*expected idx: 295, name: v.ast.CallExpr */ ; } - else if (node->_typ == 308 /* v.ast.IfExpr */) { + else if (node->_typ == 310 /* v.ast.IfExpr */) { v__ast__Expr _t5 = v__transformer__Transformer_if_expr(t, (voidptr)&/*qq*/(*node->_v__ast__IfExpr)); return _t5; } - else if (node->_typ == 309 /* v.ast.IfGuardExpr */) { + else if (node->_typ == 311 /* v.ast.IfGuardExpr */) { (*node->_v__ast__IfGuardExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IfGuardExpr).expr); } - else if (node->_typ == 310 /* v.ast.IndexExpr */) { + else if (node->_typ == 312 /* v.ast.IndexExpr */) { v__transformer__Transformer_check_safe_array(t, (voidptr)&/*qq*/(*node->_v__ast__IndexExpr)); (*node->_v__ast__IndexExpr).left = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IndexExpr).left); (*node->_v__ast__IndexExpr).index = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IndexExpr).index); - (*node->_v__ast__IndexExpr).or_expr = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._typ, 321) /*expected idx: 321, name: v.ast.OrExpr */ ; + (*node->_v__ast__IndexExpr).or_expr = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__IndexExpr).or_expr))))._typ, 323) /*expected idx: 323, name: v.ast.OrExpr */ ; } - else if (node->_typ == 311 /* v.ast.InfixExpr */) { + else if (node->_typ == 313 /* v.ast.InfixExpr */) { v__ast__Expr _t6 = v__transformer__Transformer_infix_expr(t, (voidptr)&/*qq*/(*node->_v__ast__InfixExpr)); return _t6; } - else if (node->_typ == 313 /* v.ast.IsRefType */) { + else if (node->_typ == 315 /* v.ast.IsRefType */) { (*node->_v__ast__IsRefType).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__IsRefType).expr); } - else if (node->_typ == 314 /* v.ast.Likely */) { + else if (node->_typ == 316 /* v.ast.Likely */) { (*node->_v__ast__Likely).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__Likely).expr); } - else if (node->_typ == 315 /* v.ast.LockExpr */) { + else if (node->_typ == 317 /* v.ast.LockExpr */) { for (int _t7 = 0; _t7 < (*node->_v__ast__LockExpr).stmts.len; ++_t7) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__LockExpr).stmts.data) + _t7; *stmt = v__transformer__Transformer_stmt(t, stmt); @@ -61891,7 +60001,7 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ *locked = v__transformer__Transformer_expr(t, locked); } } - else if (node->_typ == 316 /* v.ast.MapInit */) { + else if (node->_typ == 318 /* v.ast.MapInit */) { for (int _t9 = 0; _t9 < (*node->_v__ast__MapInit).keys.len; ++_t9) { v__ast__Expr* key = ((v__ast__Expr*)(*node->_v__ast__MapInit).keys.data) + _t9; *key = v__transformer__Transformer_expr(t, key); @@ -61901,31 +60011,31 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ *val = v__transformer__Transformer_expr(t, val); } } - else if (node->_typ == 317 /* v.ast.MatchExpr */) { + else if (node->_typ == 319 /* v.ast.MatchExpr */) { v__ast__Expr _t11 = v__transformer__Transformer_match_expr(t, (voidptr)&/*qq*/(*node->_v__ast__MatchExpr)); return _t11; } - else if (node->_typ == 321 /* v.ast.OrExpr */) { + else if (node->_typ == 323 /* v.ast.OrExpr */) { for (int _t12 = 0; _t12 < (*node->_v__ast__OrExpr).stmts.len; ++_t12) { v__ast__Stmt* stmt = ((v__ast__Stmt*)(*node->_v__ast__OrExpr).stmts.data) + _t12; *stmt = v__transformer__Transformer_stmt(t, stmt); } } - else if (node->_typ == 322 /* v.ast.ParExpr */) { + else if (node->_typ == 324 /* v.ast.ParExpr */) { (*node->_v__ast__ParExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__ParExpr).expr); } - else if (node->_typ == 323 /* v.ast.PostfixExpr */) { + else if (node->_typ == 325 /* v.ast.PostfixExpr */) { (*node->_v__ast__PostfixExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__PostfixExpr).expr); } - else if (node->_typ == 324 /* v.ast.PrefixExpr */) { + else if (node->_typ == 326 /* v.ast.PrefixExpr */) { (*node->_v__ast__PrefixExpr).right = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__PrefixExpr).right); - (*node->_v__ast__PrefixExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._typ, 321) /*expected idx: 321, name: v.ast.OrExpr */ ; + (*node->_v__ast__PrefixExpr).or_block = /* as */ *(v__ast__OrExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._v__ast__OrExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__OrExpr_to_sumtype_v__ast__Expr(&(*node->_v__ast__PrefixExpr).or_block))))._typ, 323) /*expected idx: 323, name: v.ast.OrExpr */ ; } - else if (node->_typ == 325 /* v.ast.RangeExpr */) { + else if (node->_typ == 327 /* v.ast.RangeExpr */) { (*node->_v__ast__RangeExpr).low = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__RangeExpr).low); (*node->_v__ast__RangeExpr).high = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__RangeExpr).high); } - else if (node->_typ == 326 /* v.ast.SelectExpr */) { + else if (node->_typ == 328 /* v.ast.SelectExpr */) { for (int _t13 = 0; _t13 < (*node->_v__ast__SelectExpr).branches.len; ++_t13) { v__ast__SelectBranch* branch = ((v__ast__SelectBranch*)(*node->_v__ast__SelectExpr).branches.data) + _t13; branch->stmt = v__transformer__Transformer_stmt(t, &/*sum*/branch->stmt); @@ -61935,27 +60045,27 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ } } } - else if (node->_typ == 327 /* v.ast.SelectorExpr */) { + else if (node->_typ == 329 /* v.ast.SelectorExpr */) { (*node->_v__ast__SelectorExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SelectorExpr).expr); - if (((*node->_v__ast__SelectorExpr).expr)._typ == 331 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { + if (((*node->_v__ast__SelectorExpr).expr)._typ == 333 /* v.ast.StringLiteral */ && string__eq((*node->_v__ast__SelectorExpr).field_name, _SLIT("len"))) { v__ast__Expr _t15 = v__ast__IntegerLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__IntegerLiteral, (((v__ast__IntegerLiteral){.val = int_str((*(*node->_v__ast__SelectorExpr).expr._v__ast__StringLiteral).val.len),.pos = (*node->_v__ast__SelectorExpr).pos,})))); return _t15; } } - else if (node->_typ == 328 /* v.ast.SizeOf */) { + else if (node->_typ == 330 /* v.ast.SizeOf */) { (*node->_v__ast__SizeOf).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__SizeOf).expr); } - else if (node->_typ == 329 /* v.ast.SqlExpr */) { + else if (node->_typ == 331 /* v.ast.SqlExpr */) { v__ast__Expr _t16 = v__transformer__Transformer_sql_expr(t, (voidptr)&/*qq*/(*node->_v__ast__SqlExpr)); return _t16; } - else if (node->_typ == 330 /* v.ast.StringInterLiteral */) { + else if (node->_typ == 332 /* v.ast.StringInterLiteral */) { for (int _t17 = 0; _t17 < (*node->_v__ast__StringInterLiteral).exprs.len; ++_t17) { v__ast__Expr* expr = ((v__ast__Expr*)(*node->_v__ast__StringInterLiteral).exprs.data) + _t17; *expr = v__transformer__Transformer_expr(t, expr); } } - else if (node->_typ == 332 /* v.ast.StructInit */) { + else if (node->_typ == 334 /* v.ast.StructInit */) { (*node->_v__ast__StructInit).update_expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__StructInit).update_expr); for (int _t18 = 0; _t18 < (*node->_v__ast__StructInit).fields.len; ++_t18) { v__ast__StructInitField* field = ((v__ast__StructInitField*)(*node->_v__ast__StructInit).fields.data) + _t18; @@ -61966,7 +60076,7 @@ v__ast__Expr v__transformer__Transformer_expr(v__transformer__Transformer* t, v_ embed->expr = v__transformer__Transformer_expr(t, &/*sum*/embed->expr); } } - else if (node->_typ == 335 /* v.ast.UnsafeExpr */) { + else if (node->_typ == 337 /* v.ast.UnsafeExpr */) { (*node->_v__ast__UnsafeExpr).expr = v__transformer__Transformer_expr(t, &/*sum*/(*node->_v__ast__UnsafeExpr).expr); } @@ -61996,8 +60106,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* v__ast__Expr _t1 = v__ast__InfixExpr_to_sumtype_v__ast__Expr(node); return _t1; } else { - if (node->left._typ == 291 /* v.ast.BoolLiteral */) { - if (node->right._typ == 291 /* v.ast.BoolLiteral */) { + if (node->left._typ == 293 /* v.ast.BoolLiteral */) { + if (node->right._typ == 293 /* v.ast.BoolLiteral */) { if (node->op == (v__token__Kind__eq)) { v__ast__Expr _t2 = v__ast__BoolLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__BoolLiteral, (((v__ast__BoolLiteral){.val = (*node->left._v__ast__BoolLiteral).val == (*node->right._v__ast__BoolLiteral).val,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); @@ -62023,8 +60133,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 331 /* v.ast.StringLiteral */) { - if (node->right._typ == 331 /* v.ast.StringLiteral */) { + else if (node->left._typ == 333 /* v.ast.StringLiteral */) { + if (node->right._typ == 333 /* v.ast.StringLiteral */) { if (node->op == (v__token__Kind__eq)) { v__ast__Expr _t6 = v__ast__BoolLiteral_to_sumtype_v__ast__Expr(ADDR(v__ast__BoolLiteral, (((v__ast__BoolLiteral){.val = string__eq((*node->left._v__ast__StringLiteral).val, (*node->right._v__ast__StringLiteral).val),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},})))); @@ -62046,8 +60156,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 312 /* v.ast.IntegerLiteral */) { - if (node->right._typ == 312 /* v.ast.IntegerLiteral */) { + else if (node->left._typ == 314 /* v.ast.IntegerLiteral */) { + if (node->right._typ == 314 /* v.ast.IntegerLiteral */) { i64 left_val = string_i64((*node->left._v__ast__IntegerLiteral).val); i64 right_val = string_i64((*node->right._v__ast__IntegerLiteral).val); switch (node->op) { @@ -62267,8 +60377,8 @@ v__ast__Expr v__transformer__Transformer_infix_expr(v__transformer__Transformer* } ; } - else if (node->left._typ == 305 /* v.ast.FloatLiteral */) { - if (node->right._typ == 305 /* v.ast.FloatLiteral */) { + else if (node->left._typ == 307 /* v.ast.FloatLiteral */) { + if (node->right._typ == 307 /* v.ast.FloatLiteral */) { f32 left_val = string_f32((*node->left._v__ast__FloatLiteral).val); f32 right_val = string_f32((*node->right._v__ast__FloatLiteral).val); switch (node->op) { @@ -62468,16 +60578,16 @@ v__ast__Expr v__transformer__Transformer_if_expr(v__transformer__Transformer* t, v__ast__Stmt* stmt = ((v__ast__Stmt*)branch->stmts.data) + i; *stmt = v__transformer__Transformer_stmt(t, stmt); if (i == branch->stmts.len - 1) { - if ((stmt)->_typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 349 /* v.ast.ExprStmt */) { v__ast__Expr expr = (*stmt->_v__ast__ExprStmt).expr; - if (expr._typ == 308 /* v.ast.IfExpr */) { + if (expr._typ == 310 /* v.ast.IfExpr */) { if ((*expr._v__ast__IfExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__IfBranch*)/*ee elem_sym */array_get((*expr._v__ast__IfExpr).branches, 0)).stmts), _t2, Array_v__ast__Stmt); break; } } - else if (expr._typ == 317 /* v.ast.MatchExpr */) { + else if (expr._typ == 319 /* v.ast.MatchExpr */) { if ((*expr._v__ast__MatchExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__MatchBranch*)/*ee elem_sym */array_get((*expr._v__ast__MatchExpr).branches, 0)).stmts), _t3, Array_v__ast__Stmt); @@ -62511,16 +60621,16 @@ v__ast__Expr v__transformer__Transformer_match_expr(v__transformer__Transformer* v__ast__Stmt* stmt = ((v__ast__Stmt*)branch->stmts.data) + i; *stmt = v__transformer__Transformer_stmt(t, stmt); if (i == branch->stmts.len - 1) { - if ((stmt)->_typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)->_typ == 349 /* v.ast.ExprStmt */) { v__ast__Expr expr = (*stmt->_v__ast__ExprStmt).expr; - if (expr._typ == 308 /* v.ast.IfExpr */) { + if (expr._typ == 310 /* v.ast.IfExpr */) { if ((*expr._v__ast__IfExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__IfBranch*)/*ee elem_sym */array_get((*expr._v__ast__IfExpr).branches, 0)).stmts), _t3, Array_v__ast__Stmt); break; } } - else if (expr._typ == 317 /* v.ast.MatchExpr */) { + else if (expr._typ == 319 /* v.ast.MatchExpr */) { if ((*expr._v__ast__MatchExpr).branches.len == 1) { (*(v__ast__Stmt*)array_pop(&branch->stmts)); _PUSH_MANY(&branch->stmts, ((*(v__ast__MatchBranch*)/*ee elem_sym */array_get((*expr._v__ast__MatchExpr).branches, 0)).stmts), _t4, Array_v__ast__Stmt); @@ -62569,7 +60679,7 @@ v__ast__Expr v__transformer__Transformer_sql_expr(v__transformer__Transformer* t } if (!DenseArray_has_index(&_t2.key_values, _t3)) {continue;} v__ast__SqlExpr* sub_struct = &(*(v__ast__SqlExpr*)DenseArray_value(&_t2.key_values, _t3)); - *sub_struct = /* as */ *(v__ast__SqlExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._v__ast__SqlExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._typ, 329) /*expected idx: 329, name: v.ast.SqlExpr */ ; + *sub_struct = /* as */ *(v__ast__SqlExpr*)__as_cast((v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._v__ast__SqlExpr,(v__transformer__Transformer_expr(t, HEAP(v__ast__Expr, v__ast__SqlExpr_to_sumtype_v__ast__Expr(sub_struct))))._typ, 331) /*expected idx: 331, name: v.ast.SqlExpr */ ; } v__ast__Expr _t6 = v__ast__SqlExpr_to_sumtype_v__ast__Expr(node); return _t6; @@ -62583,20 +60693,20 @@ bool v__markused__mark_used_defer_0 = false; Map_string_v__ast__GlobalField all_globals = mr_434.arg2; v__util__timing_start(_SLIT("mark_used")); v__markused__mark_used_defer_0 = true; - Array_string all_fn_root_names = new_array_from_c_array(100, 100, sizeof(string), _MOV((string[100]){ + Array_string all_fn_root_names = new_array_from_c_array(101, 101, sizeof(string), _MOV((string[101]){ _SLIT("main.main"), _SLIT("__new_array"), _SLIT("str_intp"), _SLIT("format_sb"), _SLIT("__new_array_with_default"), _SLIT("__new_array_with_array_default"), _SLIT("v_realloc"), _SLIT("malloc"), _SLIT("malloc_noscan"), _SLIT("vcalloc"), _SLIT("vcalloc_noscan"), _SLIT("new_array_from_c_array"), _SLIT("v_fixed_index"), _SLIT("memdup"), _SLIT("vstrlen"), _SLIT("__as_cast"), _SLIT("tos"), - _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok"), _SLIT("opt_ok2"), _SLIT("error"), _SLIT("utf8_str_visible_length"), _SLIT("compare_ints"), - _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), _SLIT("3.vstring_with_len"), - _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), _SLIT("20.repeat"), - _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), _SLIT("20.at_with_check"), - _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), _SLIT("fast_string_eq"), - _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), _SLIT("22.first"), - _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), _SLIT("61.get"), - _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), _SLIT("65558.set"), - _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), _SLIT("json.encode_bool"), - _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), _SLIT("os.getwd"), - _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); + _SLIT("tos2"), _SLIT("tos3"), _SLIT("isnil"), _SLIT("opt_ok2"), _SLIT("_option_ok"), _SLIT("_result_ok"), _SLIT("error"), _SLIT("utf8_str_visible_length"), + _SLIT("compare_ints"), _SLIT("compare_u64s"), _SLIT("compare_strings"), _SLIT("compare_ints_reverse"), _SLIT("compare_u64s_reverse"), _SLIT("compare_strings_reverse"), _SLIT("builtin_init"), _SLIT("3.vstring"), + _SLIT("3.vstring_with_len"), _SLIT("3.vstring_literal"), _SLIT("4.vstring"), _SLIT("4.vstring_with_len"), _SLIT("4.vstring_literal"), _SLIT("10.str_escaped"), _SLIT("20.add"), _SLIT("20.trim_space"), + _SLIT("20.repeat"), _SLIT("20.replace"), _SLIT("20.clone"), _SLIT("20.clone_static"), _SLIT("20.trim"), _SLIT("20.substr"), _SLIT("20.substr_ni"), _SLIT("20.at"), + _SLIT("20.at_with_check"), _SLIT("20.index_kmp"), _SLIT("20.eq"), _SLIT("20.ne"), _SLIT("20.lt"), _SLIT("20.gt"), _SLIT("20.le"), _SLIT("20.ge"), + _SLIT("fast_string_eq"), _SLIT("22.get"), _SLIT("22.set"), _SLIT("22.get_unsafe"), _SLIT("22.set_unsafe"), _SLIT("22.get_with_check"), _SLIT("22.clone_static_to_depth"), _SLIT("22.clone_to_depth"), + _SLIT("22.first"), _SLIT("22.last"), _SLIT("22.pointers"), _SLIT("22.reverse"), _SLIT("22.repeat_to_depth"), _SLIT("22.slice"), _SLIT("22.slice_ni"), _SLIT("22.slice2"), + _SLIT("61.get"), _SLIT("61.set"), _SLIT("65558.last"), _SLIT("65558.pop"), _SLIT("65558.push"), _SLIT("65558.insert_many"), _SLIT("65558.prepend_many"), _SLIT("65558.reverse"), + _SLIT("65558.set"), _SLIT("65558.set_unsafe"), _SLIT("json.decode_string"), _SLIT("json.decode_int"), _SLIT("json.decode_bool"), _SLIT("json.decode_u64"), _SLIT("json.encode_int"), _SLIT("json.encode_string"), + _SLIT("json.encode_bool"), _SLIT("json.encode_u64"), _SLIT("json.json_print"), _SLIT("json.json_parse"), _SLIT("main.nasserts"), _SLIT("main.vtest_init"), _SLIT("main.vtest_new_metainfo"), _SLIT("main.vtest_new_filemetainfo"), + _SLIT("os.getwd"), _SLIT("os.init_os_args"), _SLIT("os.init_os_args_wide"), _SLIT("v.embed_file.find_index_entry_by_path")})); if (pref->is_bare) { _PUSH_MANY(&all_fn_root_names, (new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("strlen"), _SLIT("memcmp"), _SLIT("memcpy"), _SLIT("realloc"), _SLIT("vsnprintf"), _SLIT("vsprintf")}))), _t1, Array_string); } @@ -62706,10 +60816,10 @@ bool v__markused__mark_used_defer_0 = false; if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 475 /* v.ast.Interface */) { + if ((isym->info)._typ != 477 /* v.ast.Interface */) { continue; } - v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface interface_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (interface_info.methods.len == 0) { continue; } @@ -62896,9 +61006,12 @@ VV_LOCAL_SYMBOL multi_return_Map_string_v__ast__FnDecl_Map_string_v__ast__ConstF bool v__markused__all_fn_const_and_global_defer_0 = false; v__util__timing_start(_SLIT("all_fn_const_and_global")); v__markused__all_fn_const_and_global_defer_0 = true; - Map_string_v__ast__FnDecl all_fns = new_map(sizeof(string), sizeof(v__ast__FnDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_v__ast__ConstField all_consts = new_map(sizeof(string), sizeof(v__ast__ConstField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_v__ast__GlobalField all_globals = new_map(sizeof(string), sizeof(v__ast__GlobalField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_v__ast__FnDecl all_fns = new_map(sizeof(string), sizeof(v__ast__FnDecl), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_v__ast__ConstField all_consts = new_map(sizeof(string), sizeof(v__ast__ConstField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_v__ast__GlobalField all_globals = new_map(sizeof(string), sizeof(v__ast__GlobalField), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < ast_files.len; ++i) { v__ast__File* file = (*(v__ast__File**)/*ee elem_sym */array_get(ast_files, i)); for (int _t1 = 0; _t1 < file->stmts.len; ++_t1) { @@ -62907,14 +61020,14 @@ bool v__markused__all_fn_const_and_global_defer_0 = false; string fkey = v__ast__FnDecl_fkey(&(*node._v__ast__FnDecl)); (*(v__ast__FnDecl*)map_get_and_set((map*)&all_fns, &(string[]){fkey}, &(v__ast__FnDecl[]){ (v__ast__FnDecl){.receiver = (v__ast__StructField){.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.default_val = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.i = 0,.default_expr_typ = 0,.typ = 0,.has_default_expr = 0,.is_pub = 0,.is_mut = 0,.is_global = 0,.is_volatile = 0,},.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.params = __new_array(0, 0, sizeof(v__ast__Param)),.stmts = __new_array(0, 0, sizeof(v__ast__Stmt)),.defer_stmts = __new_array(0, 0, sizeof(v__ast__DeferStmt)),.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.next_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.label_names = __new_array(0, 0, sizeof(string)),.name = (string){.str=(byteptr)"", .is_lit=1},.short_name = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.source_file = 0,.scope = 0,.receiver_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.body_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.method_idx = 0,.ctdefine_idx = -1,.idx = 0,.return_type = 0,.ninstances = 0,.is_deprecated = 0,.is_pub = 0,.is_variadic = 0,.is_anon = 0,.is_noreturn = 0,.is_manualfree = 0,.is_main = 0,.is_test = 0,.is_conditional = 0,.is_exported = 0,.is_keep_alive = 0,.is_unsafe = 0,.is_markused = 0,.is_method = 0,.rec_mut = 0,.no_body = 0,.is_builtin = 0,.is_direct_arr = 0,.has_return = 0,.should_be_skipped = 0,.has_await = 0,} })) = (*node._v__ast__FnDecl); } - else if (node._typ == 343 /* v.ast.ConstDecl */) { + else if (node._typ == 345 /* v.ast.ConstDecl */) { for (int _t2 = 0; _t2 < (*node._v__ast__ConstDecl).fields.len; ++_t2) { v__ast__ConstField cfield = ((v__ast__ConstField*)(*node._v__ast__ConstDecl).fields.data)[_t2]; string ckey = cfield.name; (*(v__ast__ConstField*)map_get_and_set((map*)&all_consts, &(string[]){ckey}, &(v__ast__ConstField[]){ (v__ast__ConstField){.mod = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.is_pub = 0,.is_markused = 0,.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.comments = __new_array(0, 0, sizeof(v__ast__Comment)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.comptime_expr_value = v__ast__empty_comptime_const_expr(),} })) = cfield; } } - else if (node._typ == 351 /* v.ast.GlobalDecl */) { + else if (node._typ == 353 /* v.ast.GlobalDecl */) { 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; @@ -63071,43 +61184,43 @@ void v__markused__Walker_mark_markused_globals(v__markused__Walker* w) { void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { v__ast__Stmt node = node_; - if (node._typ == 345 /* v.ast.EmptyStmt */) { + if (node._typ == 347 /* v.ast.EmptyStmt */) { } - else if (node._typ == 337 /* v.ast.AsmStmt */) { + else if (node._typ == 339 /* v.ast.AsmStmt */) { v__markused__Walker_asm_io(w, (*node._v__ast__AsmStmt).output); v__markused__Walker_asm_io(w, (*node._v__ast__AsmStmt).input); } - else if (node._typ == 338 /* v.ast.AssertStmt */) { + else if (node._typ == 340 /* v.ast.AssertStmt */) { if ((*node._v__ast__AssertStmt).is_used) { v__markused__Walker_expr(w, (*node._v__ast__AssertStmt).expr); w->n_asserts++; } } - else if (node._typ == 339 /* v.ast.AssignStmt */) { + else if (node._typ == 341 /* v.ast.AssignStmt */) { v__markused__Walker_exprs(w, (*node._v__ast__AssignStmt).left); v__markused__Walker_exprs(w, (*node._v__ast__AssignStmt).right); } - else if (node._typ == 340 /* v.ast.Block */) { + else if (node._typ == 342 /* v.ast.Block */) { v__markused__Walker_stmts(w, (*node._v__ast__Block).stmts); } - else if (node._typ == 342 /* v.ast.ComptimeFor */) { + else if (node._typ == 344 /* v.ast.ComptimeFor */) { v__markused__Walker_stmts(w, (*node._v__ast__ComptimeFor).stmts); } - else if (node._typ == 343 /* v.ast.ConstDecl */) { + else if (node._typ == 345 /* v.ast.ConstDecl */) { v__markused__Walker_const_fields(w, (*node._v__ast__ConstDecl).fields); } - else if (node._typ == 347 /* v.ast.ExprStmt */) { + else if (node._typ == 349 /* v.ast.ExprStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ExprStmt).expr); } else if (node._typ == 220 /* v.ast.FnDecl */) { v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*node._v__ast__FnDecl)); } - else if (node._typ == 348 /* v.ast.ForCStmt */) { + else if (node._typ == 350 /* v.ast.ForCStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForCStmt).cond); v__markused__Walker_stmt(w, (*node._v__ast__ForCStmt).inc); v__markused__Walker_stmts(w, (*node._v__ast__ForCStmt).stmts); } - else if (node._typ == 349 /* v.ast.ForInStmt */) { + else if (node._typ == 351 /* v.ast.ForInStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForInStmt).cond); v__markused__Walker_expr(w, (*node._v__ast__ForInStmt).high); v__markused__Walker_stmts(w, (*node._v__ast__ForInStmt).stmts); @@ -63126,14 +61239,14 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { } } } - else if (node._typ == 350 /* v.ast.ForStmt */) { + else if (node._typ == 352 /* v.ast.ForStmt */) { v__markused__Walker_expr(w, (*node._v__ast__ForStmt).cond); v__markused__Walker_stmts(w, (*node._v__ast__ForStmt).stmts); } - else if (node._typ == 358 /* v.ast.Return */) { + else if (node._typ == 360 /* v.ast.Return */) { v__markused__Walker_exprs(w, (*node._v__ast__Return).exprs); } - else if (node._typ == 359 /* v.ast.SqlStmt */) { + else if (node._typ == 361 /* v.ast.SqlStmt */) { v__markused__Walker_expr(w, (*node._v__ast__SqlStmt).db_expr); for (int _t2 = 0; _t2 < (*node._v__ast__SqlStmt).lines.len; ++_t2) { v__ast__SqlStmtLine line = ((v__ast__SqlStmtLine*)(*node._v__ast__SqlStmt).lines.data)[_t2]; @@ -63141,13 +61254,13 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { v__markused__Walker_exprs(w, line.update_exprs); } } - else if (node._typ == 360 /* v.ast.StructDecl */) { + else if (node._typ == 362 /* v.ast.StructDecl */) { v__markused__Walker_struct_fields(w, (*node._v__ast__StructDecl).fields); } - else if (node._typ == 344 /* v.ast.DeferStmt */) { + else if (node._typ == 346 /* v.ast.DeferStmt */) { v__markused__Walker_stmts(w, (*node._v__ast__DeferStmt).stmts); } - else if (node._typ == 351 /* v.ast.GlobalDecl */) { + else if (node._typ == 353 /* v.ast.GlobalDecl */) { for (int _t3 = 0; _t3 < (*node._v__ast__GlobalDecl).fields.len; ++_t3) { v__ast__GlobalField gf = ((v__ast__GlobalField*)(*node._v__ast__GlobalDecl).fields.data)[_t3]; if (gf.has_expr) { @@ -63155,25 +61268,25 @@ void v__markused__Walker_stmt(v__markused__Walker* w, v__ast__Stmt node_) { } } } - else if (node._typ == 341 /* v.ast.BranchStmt */) { + else if (node._typ == 343 /* v.ast.BranchStmt */) { } - else if (node._typ == 346 /* v.ast.EnumDecl */) { + else if (node._typ == 348 /* v.ast.EnumDecl */) { } - else if (node._typ == 352 /* v.ast.GotoLabel */) { + else if (node._typ == 354 /* v.ast.GotoLabel */) { } - else if (node._typ == 353 /* v.ast.GotoStmt */) { + else if (node._typ == 355 /* v.ast.GotoStmt */) { } - else if (node._typ == 354 /* v.ast.HashStmt */) { + else if (node._typ == 356 /* v.ast.HashStmt */) { } - else if (node._typ == 355 /* v.ast.Import */) { + else if (node._typ == 357 /* v.ast.Import */) { } - else if (node._typ == 356 /* v.ast.InterfaceDecl */) { + else if (node._typ == 358 /* v.ast.InterfaceDecl */) { } - else if (node._typ == 357 /* v.ast.Module */) { + else if (node._typ == 359 /* v.ast.Module */) { } - else if (node._typ == 284 /* v.ast.TypeDecl */) { + else if (node._typ == 286 /* v.ast.TypeDecl */) { } - else if (node._typ == 318 /* v.ast.NodeError */) { + else if (node._typ == 320 /* v.ast.NodeError */) { } ; } @@ -63208,54 +61321,54 @@ VV_LOCAL_SYMBOL void v__markused__Walker_exprs(v__markused__Walker* w, Array_v__ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Expr node_) { v__ast__Expr node = node_; - if (node._typ == 303 /* v.ast.EmptyExpr */) { + if (node._typ == 305 /* v.ast.EmptyExpr */) { } - else if (node._typ == 300 /* v.ast.ComptimeType */) { + else if (node._typ == 302 /* v.ast.ComptimeType */) { } - else if (node._typ == 285 /* v.ast.AnonFn */) { + else if (node._typ == 287 /* v.ast.AnonFn */) { v__markused__Walker_fn_decl(w, (voidptr)&/*qq*/(*node._v__ast__AnonFn).decl); } - else if (node._typ == 287 /* v.ast.ArrayInit */) { + else if (node._typ == 289 /* v.ast.ArrayInit */) { v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).len_expr); v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).cap_expr); v__markused__Walker_expr(w, (*node._v__ast__ArrayInit).default_expr); v__markused__Walker_exprs(w, (*node._v__ast__ArrayInit).exprs); } - else if (node._typ == 289 /* v.ast.Assoc */) { + else if (node._typ == 291 /* v.ast.Assoc */) { v__markused__Walker_exprs(w, (*node._v__ast__Assoc).exprs); } - else if (node._typ == 286 /* v.ast.ArrayDecompose */) { + else if (node._typ == 288 /* v.ast.ArrayDecompose */) { v__markused__Walker_expr(w, (*node._v__ast__ArrayDecompose).expr); } - else if (node._typ == 293 /* v.ast.CallExpr */) { + else if (node._typ == 295 /* v.ast.CallExpr */) { v__markused__Walker_call_expr(w, (voidptr)&/*qq*/(*node._v__ast__CallExpr)); } - else if (node._typ == 294 /* v.ast.CastExpr */) { + else if (node._typ == 296 /* v.ast.CastExpr */) { v__markused__Walker_expr(w, (*node._v__ast__CastExpr).expr); v__markused__Walker_expr(w, (*node._v__ast__CastExpr).arg); } - else if (node._typ == 295 /* v.ast.ChanInit */) { + else if (node._typ == 297 /* v.ast.ChanInit */) { v__markused__Walker_expr(w, (*node._v__ast__ChanInit).cap_expr); } - else if (node._typ == 301 /* v.ast.ConcatExpr */) { + else if (node._typ == 303 /* v.ast.ConcatExpr */) { v__markused__Walker_exprs(w, (*node._v__ast__ConcatExpr).vals); } - else if (node._typ == 299 /* v.ast.ComptimeSelector */) { + else if (node._typ == 301 /* v.ast.ComptimeSelector */) { v__markused__Walker_expr(w, (*node._v__ast__ComptimeSelector).left); v__markused__Walker_expr(w, (*node._v__ast__ComptimeSelector).field_expr); } - else if (node._typ == 298 /* v.ast.ComptimeCall */) { + else if (node._typ == 300 /* v.ast.ComptimeCall */) { v__markused__Walker_expr(w, (*node._v__ast__ComptimeCall).left); if ((*node._v__ast__ComptimeCall).is_vweb) { v__markused__Walker_stmts(w, (*node._v__ast__ComptimeCall).vweb_tmpl.stmts); } } - else if (node._typ == 302 /* v.ast.DumpExpr */) { + else if (node._typ == 304 /* v.ast.DumpExpr */) { v__markused__Walker_expr(w, (*node._v__ast__DumpExpr).expr); v__markused__Walker_fn_by_name(w, _SLIT("eprint")); v__markused__Walker_fn_by_name(w, _SLIT("eprintln")); } - else if (node._typ == 306 /* v.ast.GoExpr */) { + else if (node._typ == 308 /* v.ast.GoExpr */) { v__markused__Walker_expr(w, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*node._v__ast__GoExpr).call_expr)); if (w->pref->os == v__pref__OS__windows) { v__markused__Walker_fn_by_name(w, _SLIT("panic_lasterr")); @@ -63265,7 +61378,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_fn_by_name(w, _SLIT("panic_error_number")); } } - else if (node._typ == 310 /* v.ast.IndexExpr */) { + else if (node._typ == 312 /* v.ast.IndexExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IndexExpr).left); v__markused__Walker_expr(w, (*node._v__ast__IndexExpr).index); v__markused__Walker_or_block(w, (*node._v__ast__IndexExpr).or_expr); @@ -63277,7 +61390,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex w->table->used_maps++; } } - else if (node._typ == 311 /* v.ast.InfixExpr */) { + else if (node._typ == 313 /* v.ast.InfixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__InfixExpr).left); v__markused__Walker_expr(w, (*node._v__ast__InfixExpr).right); v__markused__Walker_or_block(w, (*node._v__ast__InfixExpr).or_block); @@ -63300,10 +61413,10 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex w->table->used_maps++; } } - else if (node._typ == 309 /* v.ast.IfGuardExpr */) { + else if (node._typ == 311 /* v.ast.IfGuardExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IfGuardExpr).expr); } - else if (node._typ == 308 /* v.ast.IfExpr */) { + else if (node._typ == 310 /* v.ast.IfExpr */) { v__markused__Walker_expr(w, (*node._v__ast__IfExpr).left); for (int _t2 = 0; _t2 < (*node._v__ast__IfExpr).branches.len; ++_t2) { v__ast__IfBranch b = ((v__ast__IfBranch*)(*node._v__ast__IfExpr).branches.data)[_t2]; @@ -63311,7 +61424,7 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_stmts(w, b.stmts); } } - else if (node._typ == 307 /* v.ast.Ident */) { + else if (node._typ == 309 /* v.ast.Ident */) { if ((*node._v__ast__Ident).kind == (v__ast__IdentKind__constant)) { v__markused__Walker_mark_const_as_used(w, (*node._v__ast__Ident).name); @@ -63325,15 +61438,15 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex else { }; } - else if (node._typ == 314 /* v.ast.Likely */) { + else if (node._typ == 316 /* v.ast.Likely */) { v__markused__Walker_expr(w, (*node._v__ast__Likely).expr); } - else if (node._typ == 316 /* v.ast.MapInit */) { + else if (node._typ == 318 /* v.ast.MapInit */) { v__markused__Walker_exprs(w, (*node._v__ast__MapInit).keys); v__markused__Walker_exprs(w, (*node._v__ast__MapInit).vals); w->table->used_maps++; } - else if (node._typ == 317 /* v.ast.MatchExpr */) { + else if (node._typ == 319 /* v.ast.MatchExpr */) { v__markused__Walker_expr(w, (*node._v__ast__MatchExpr).cond); for (int _t3 = 0; _t3 < (*node._v__ast__MatchExpr).branches.len; ++_t3) { v__ast__MatchBranch b = ((v__ast__MatchBranch*)(*node._v__ast__MatchExpr).branches.data)[_t3]; @@ -63341,18 +61454,18 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_stmts(w, b.stmts); } } - else if (node._typ == 319 /* v.ast.None */) { + else if (node._typ == 321 /* v.ast.None */) { } - else if (node._typ == 322 /* v.ast.ParExpr */) { + else if (node._typ == 324 /* v.ast.ParExpr */) { v__markused__Walker_expr(w, (*node._v__ast__ParExpr).expr); } - else if (node._typ == 324 /* v.ast.PrefixExpr */) { + else if (node._typ == 326 /* v.ast.PrefixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__PrefixExpr).right); } - else if (node._typ == 323 /* v.ast.PostfixExpr */) { + else if (node._typ == 325 /* v.ast.PostfixExpr */) { v__markused__Walker_expr(w, (*node._v__ast__PostfixExpr).expr); } - else if (node._typ == 325 /* v.ast.RangeExpr */) { + else if (node._typ == 327 /* v.ast.RangeExpr */) { if ((*node._v__ast__RangeExpr).has_low) { v__markused__Walker_expr(w, (*node._v__ast__RangeExpr).low); } @@ -63360,16 +61473,16 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_expr(w, (*node._v__ast__RangeExpr).high); } } - else if (node._typ == 328 /* v.ast.SizeOf */) { + else if (node._typ == 330 /* v.ast.SizeOf */) { v__markused__Walker_expr(w, (*node._v__ast__SizeOf).expr); } - else if (node._typ == 313 /* v.ast.IsRefType */) { + else if (node._typ == 315 /* v.ast.IsRefType */) { v__markused__Walker_expr(w, (*node._v__ast__IsRefType).expr); } - else if (node._typ == 330 /* v.ast.StringInterLiteral */) { + else if (node._typ == 332 /* v.ast.StringInterLiteral */) { v__markused__Walker_exprs(w, (*node._v__ast__StringInterLiteral).exprs); } - else if (node._typ == 327 /* v.ast.SelectorExpr */) { + else if (node._typ == 329 /* v.ast.SelectorExpr */) { v__markused__Walker_expr(w, (*node._v__ast__SelectorExpr).expr); if ((*node._v__ast__SelectorExpr).expr_type != 0) { _option_v__ast__Fn _t4; @@ -63379,20 +61492,20 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex } } } - else if (node._typ == 329 /* v.ast.SqlExpr */) { + else if (node._typ == 331 /* v.ast.SqlExpr */) { v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).db_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).offset_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).order_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).limit_expr); v__markused__Walker_expr(w, (*node._v__ast__SqlExpr).where_expr); } - else if (node._typ == 332 /* v.ast.StructInit */) { + else if (node._typ == 334 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).typ == 0) { return; } v__ast__TypeSymbol* sym = v__ast__Table_sym(w->table, (*node._v__ast__StructInit).typ); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; for (int _t5 = 0; _t5 < info.fields.len; ++_t5) { v__ast__StructField ifield = ((v__ast__StructField*)info.fields.data)[_t5]; if (ifield.has_default_expr) { @@ -63418,52 +61531,52 @@ VV_LOCAL_SYMBOL void v__markused__Walker_expr(v__markused__Walker* w, v__ast__Ex v__markused__Walker_expr(w, sie.expr); } } - else if (node._typ == 334 /* v.ast.TypeOf */) { + else if (node._typ == 336 /* v.ast.TypeOf */) { v__markused__Walker_expr(w, (*node._v__ast__TypeOf).expr); } - else if (node._typ == 288 /* v.ast.AsCast */) { + else if (node._typ == 290 /* v.ast.AsCast */) { v__markused__Walker_expr(w, (*node._v__ast__AsCast).expr); } - else if (node._typ == 290 /* v.ast.AtExpr */) { + else if (node._typ == 292 /* v.ast.AtExpr */) { } - else if (node._typ == 291 /* v.ast.BoolLiteral */) { + else if (node._typ == 293 /* v.ast.BoolLiteral */) { } - else if (node._typ == 305 /* v.ast.FloatLiteral */) { + else if (node._typ == 307 /* v.ast.FloatLiteral */) { } - else if (node._typ == 296 /* v.ast.CharLiteral */) { + else if (node._typ == 298 /* v.ast.CharLiteral */) { } - else if (node._typ == 312 /* v.ast.IntegerLiteral */) { + else if (node._typ == 314 /* v.ast.IntegerLiteral */) { } - else if (node._typ == 331 /* v.ast.StringLiteral */) { + else if (node._typ == 333 /* v.ast.StringLiteral */) { } - else if (node._typ == 292 /* v.ast.CTempVar */) { + else if (node._typ == 294 /* v.ast.CTempVar */) { v__markused__Walker_expr(w, (*node._v__ast__CTempVar).orig); } - else if (node._typ == 297 /* v.ast.Comment */) { + else if (node._typ == 299 /* v.ast.Comment */) { } - else if (node._typ == 304 /* v.ast.EnumVal */) { + else if (node._typ == 306 /* v.ast.EnumVal */) { } - else if (node._typ == 315 /* v.ast.LockExpr */) { + else if (node._typ == 317 /* v.ast.LockExpr */) { v__markused__Walker_stmts(w, (*node._v__ast__LockExpr).stmts); } - else if (node._typ == 320 /* v.ast.OffsetOf */) { + else if (node._typ == 322 /* v.ast.OffsetOf */) { } - else if (node._typ == 321 /* v.ast.OrExpr */) { + else if (node._typ == 323 /* v.ast.OrExpr */) { v__markused__Walker_or_block(w, (*node._v__ast__OrExpr)); } - else if (node._typ == 326 /* v.ast.SelectExpr */) { + else if (node._typ == 328 /* v.ast.SelectExpr */) { for (int _t8 = 0; _t8 < (*node._v__ast__SelectExpr).branches.len; ++_t8) { v__ast__SelectBranch branch = ((v__ast__SelectBranch*)(*node._v__ast__SelectExpr).branches.data)[_t8]; v__markused__Walker_stmt(w, branch.stmt); v__markused__Walker_stmts(w, branch.stmts); } } - else if (node._typ == 333 /* v.ast.TypeNode */) { + else if (node._typ == 335 /* v.ast.TypeNode */) { } - else if (node._typ == 335 /* v.ast.UnsafeExpr */) { + else if (node._typ == 337 /* v.ast.UnsafeExpr */) { v__markused__Walker_expr(w, (*node._v__ast__UnsafeExpr).expr); } - else if (node._typ == 318 /* v.ast.NodeError */) { + else if (node._typ == 320 /* v.ast.NodeError */) { } ; } @@ -63602,7 +61715,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_array_init(v__gen__c__Gen* g, v__ast__ArrayI } for (int i = 0; i < node.exprs.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.exprs.data)[i]; - if (v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i)), _const_v__ast__string_type) && (expr)._typ != 331 /* v.ast.StringLiteral */ && (expr)._typ != 330 /* v.ast.StringInterLiteral */) { + if (v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i)), _const_v__ast__string_type) && (expr)._typ != 333 /* v.ast.StringLiteral */ && (expr)._typ != 332 /* v.ast.StringInterLiteral */) { v__gen__c__Gen_write(g, _SLIT("string_clone(")); v__gen__c__Gen_expr(g, expr); v__gen__c__Gen_write(g, _SLIT(")")); @@ -63659,7 +61772,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_write(g, _SLIT("0")); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; for (int _t1 = 1; _t1 < info.size; ++_t1) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_write(g, _SLIT("0")); @@ -63717,7 +61830,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fixed_array_init(v__gen__c__Gen* g, v__ast__ } } else if (node.has_default) { v__gen__c__Gen_expr(g, node.default_expr); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((array_type.unaliased_sym->info)._v__ast__ArrayFixed,(array_type.unaliased_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; for (int _t2 = 1; _t2 < info.size; ++_t2) { v__gen__c__Gen_write(g, _SLIT(", ")); v__gen__c__Gen_expr(g, node.default_expr); @@ -63882,9 +61995,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal string ret_typ = v__gen__c__Gen_typ(g, node.return_type); v__ast__TypeSymbol* ret_sym = v__ast__Table_sym(g->table, node.return_type); v__ast__TypeSymbol* inp_sym = v__ast__Table_sym(g->table, node.receiver_type); - v__ast__Array ret_info = /* as */ *(v__ast__Array*)__as_cast((ret_sym->info)._v__ast__Array,(ret_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array ret_info = /* as */ *(v__ast__Array*)__as_cast((ret_sym->info)._v__ast__Array,(ret_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string ret_elem_type = v__gen__c__Gen_typ(g, ret_info.elem_type); - v__ast__Array inp_info = /* as */ *(v__ast__Array*)__as_cast((inp_sym->info)._v__ast__Array,(inp_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array inp_info = /* as */ *(v__ast__Array*)__as_cast((inp_sym->info)._v__ast__Array,(inp_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string inp_elem_type = v__gen__c__Gen_typ(g, inp_info.elem_type); if (inp_sym->kind != v__ast__Kind__array) { v__gen__c__verror(_SLIT("map() requires an array")); @@ -63915,12 +62028,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 285 /* v.ast.AnonFn */) { + if (expr._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_elem_type}}, {_SLIT(" ti = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_elem_type}}, {_SLIT(" ti = "), 0, { .d_c = 0 }}}))); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -63936,7 +62049,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_map(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -63982,7 +62095,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca v__gen__c__Gen_writeln(g, _SLIT("bare_panic(_SLIT(\"sort does not work with -freestanding\"))")); return; } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((rec_sym->info)._v__ast__Array,(rec_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((rec_sym->info)._v__ast__Array,(rec_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_stype = v__gen__c__Gen_typ(g, info.elem_type); string compare_fn = str_intp(3, _MOV((StrIntpData[]){{_SLIT("compare_"), /*117 &u64*/0xfe08, {.d_u64 = g->unique_file_path_hash}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = string_replace(elem_stype, _SLIT("*"), _SLIT("_ptr"))}}, {_SLIT0, 0, { .d_c = 0 }}})); v__gen__c__Type comparison_type = v__gen__c__Gen_unwrap(g, _const_v__ast__void_type); @@ -64001,7 +62114,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca left_expr = _SLIT("*a"); right_expr = _SLIT("*b"); } else { - v__ast__InfixExpr infix_expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__InfixExpr,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ; + v__ast__InfixExpr infix_expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__InfixExpr,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ; comparison_type = v__gen__c__Gen_unwrap(g, v__ast__Type_set_nr_muls(infix_expr.left_type, 0)); string left_name = v__ast__Expr_str(infix_expr.left); if (left_name.len > 1) { @@ -64022,19 +62135,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_sort(v__gen__c__Gen* g, v__ast__Ca if (string_starts_with(left_name, _SLIT("a")) != is_reverse) { left_expr = v__gen__c__Gen_expr_string(g, infix_expr.left); right_expr = v__gen__c__Gen_expr_string(g, infix_expr.right); - if ((infix_expr.left)._typ == 307 /* v.ast.Ident */) { + if ((infix_expr.left)._typ == 309 /* v.ast.Ident */) { left_expr = string__plus(_SLIT("*"), left_expr); } - if ((infix_expr.right)._typ == 307 /* v.ast.Ident */) { + if ((infix_expr.right)._typ == 309 /* v.ast.Ident */) { right_expr = string__plus(_SLIT("*"), right_expr); } } else { left_expr = v__gen__c__Gen_expr_string(g, infix_expr.right); right_expr = v__gen__c__Gen_expr_string(g, infix_expr.left); - if ((infix_expr.left)._typ == 307 /* v.ast.Ident */) { + if ((infix_expr.left)._typ == 309 /* v.ast.Ident */) { right_expr = string__plus(_SLIT("*"), right_expr); } - if ((infix_expr.right)._typ == 307 /* v.ast.Ident */) { + if ((infix_expr.right)._typ == 309 /* v.ast.Ident */) { left_expr = string__plus(_SLIT("*"), left_expr); } } @@ -64075,7 +62188,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__verror(_SLIT("filter() requires an array")); VUNREACHABLE(); } - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string styp = v__gen__c__Gen_typ(g, node.return_type); string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; @@ -64103,12 +62216,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 285 /* v.ast.AnonFn */) { + if (expr._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -64124,7 +62237,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -64160,7 +62273,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_filter(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_insert(v__gen__c__Gen* g, v__ast__CallExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); v__ast__TypeSymbol* arg2_sym = v__ast__Table_sym(g->table, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 1)).typ); bool is_arg2_array = arg2_sym->kind == v__ast__Kind__array && v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 1)).typ, node.left_type); @@ -64194,7 +62307,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_insert(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_prepend(v__gen__c__Gen* g, v__ast__CallExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array left_info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.elem_type); v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(g->table, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).typ); bool is_arg_array = arg_sym->kind == v__ast__Kind__array && v__ast__Type_alias_eq((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).typ, node.left_type); @@ -64238,7 +62351,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g 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 }}})); 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, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_final_sym->info)._v__ast__Array,(left_final_sym->info)._typ, 454) /*expected idx: 454, 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; @@ -64275,7 +62388,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_contains_methods(v__gen__c__Gen* g strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif ((("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)a.data)[i] == v) {"), 0, { .d_c = 0 }}}))); } } else if (left_final_sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed left_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((left_final_sym->info)._v__ast__ArrayFixed,(left_final_sym->info)._typ, 482) /*expected idx: 482, 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); @@ -64360,7 +62473,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_index_methods(v__gen__c__Gen* g) { v__ast__TypeSymbol* final_left_sym = v__ast__Table_final_sym(g->table, t); 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("_index"), 0, { .d_c = 0 }}})); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((final_left_sym->info)._v__ast__Array,(final_left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((final_left_sym->info)._v__ast__Array,(final_left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (elem_sym->kind == v__ast__Kind__function) { @@ -64439,7 +62552,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("bool "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = false;"), 0, { .d_c = 0 }}}))); @@ -64460,12 +62573,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 285 /* v.ast.AnonFn */) { + if (expr._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -64481,7 +62594,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_any(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -64522,7 +62635,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal bool s_ends_with_ln = string_ends_with(s, _SLIT("\n")); s = string_trim_space(s); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string elem_type_str = v__gen__c__Gen_typ(g, info.elem_type); g->empty_line = true; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("bool "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); @@ -64544,12 +62657,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); bool is_embed_map_filter = false; v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; - if (expr._typ == 285 /* v.ast.AnonFn */) { + if (expr._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_write(g, _SLIT("if (!(")); v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr._v__ast__AnonFn)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*expr._v__ast__AnonFn).decl.name}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { v__gen__c__Gen_write(g, _SLIT("if (!(")); if ((*expr._v__ast__Ident).kind == v__ast__IdentKind__function) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*expr._v__ast__Ident).name)}}, {_SLIT("(it)"), 0, { .d_c = 0 }}}))); @@ -64565,7 +62678,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_array_all(v__gen__c__Gen* g, v__ast__Cal v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr); } } - else if (expr._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 295 /* v.ast.CallExpr */) { if (string__eq((*expr._v__ast__CallExpr).name, _SLIT("map")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*expr._v__ast__CallExpr).name, _SLIT("any"))) { is_embed_map_filter = true; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -64606,7 +62719,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__A } v__ast__AssertStmt node = original_assert_statement; v__gen__c__Gen_writeln(g, _SLIT("// assert")); - if ((node.expr)._typ == 311 /* v.ast.InfixExpr */) { + if ((node.expr)._typ == 313 /* v.ast.InfixExpr */) { _option_v__ast__Expr _t1; if (_t1 = v__gen__c__Gen_assert_subexpression_to_ctemp(g, (*node.expr._v__ast__InfixExpr).left, (*node.expr._v__ast__InfixExpr).left_type), _t1.state == 0) { v__ast__Expr subst_expr = *(v__ast__Expr*)_t1.data; @@ -64650,23 +62763,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_stmt(v__gen__c__Gen* g, v__ast__A } VV_LOCAL_SYMBOL _option_v__ast__Expr v__gen__c__Gen_assert_subexpression_to_ctemp(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type expr_type) { - if (expr._typ == 293 /* v.ast.CallExpr */) { + if (expr._typ == 295 /* v.ast.CallExpr */) { _option_v__ast__Expr _t1; opt_ok2(&(v__ast__Expr[]) { v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*expr._v__ast__CallExpr)), expr_type)))) }, (_option*)(&_t1), sizeof(v__ast__Expr)); return _t1; } - else if (expr._typ == 322 /* v.ast.ParExpr */) { - if (((*expr._v__ast__ParExpr).expr)._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 324 /* v.ast.ParExpr */) { + if (((*expr._v__ast__ParExpr).expr)._typ == 295 /* v.ast.CallExpr */) { _option_v__ast__Expr _t2; opt_ok2(&(v__ast__Expr[]) { v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, v__ast__CallExpr_to_sumtype_v__ast__Expr(&(*(*expr._v__ast__ParExpr).expr._v__ast__CallExpr)), expr_type)))) }, (_option*)(&_t2), sizeof(v__ast__Expr)); return _t2; } } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { - if (((*expr._v__ast__SelectorExpr).expr)._typ == 293 /* v.ast.CallExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { + if (((*expr._v__ast__SelectorExpr).expr)._typ == 295 /* v.ast.CallExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*(*expr._v__ast__SelectorExpr).expr._v__ast__CallExpr).return_type)); if (sym->kind == v__ast__Kind__struct_) { - if ((/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).is_union) { + if ((/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_union) { return (_option_v__ast__Expr){ .state=2, .err=_const_v__gen__c__unsupported_ctemp_assert_transform, .data={EMPTY_STRUCT_INITIALIZATION} }; } } @@ -64707,7 +62820,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".fn_name = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(fn_name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); string metasrc = v__gen__c__cnewlines(v__gen__c__ctoslit(src)); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".src = "), /*115 &string*/0xfe10, {.d_s = metasrc}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - if (node.expr._typ == 311 /* v.ast.InfixExpr */) { + if (node.expr._typ == 313 /* v.ast.InfixExpr */) { string expr_op_str = v__gen__c__ctoslit(v__token__Kind_str((*node.expr._v__ast__InfixExpr).op)); string expr_left_str = v__gen__c__cnewlines(v__gen__c__ctoslit(v__ast__Expr_str((*node.expr._v__ast__InfixExpr).left))); string expr_right_str = v__gen__c__cnewlines(v__gen__c__ctoslit(v__ast__Expr_str((*node.expr._v__ast__InfixExpr).right))); @@ -64721,7 +62834,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ v__gen__c__Gen_gen_assert_single_expr(g, (*node.expr._v__ast__InfixExpr).right, (*node.expr._v__ast__InfixExpr).right_type); v__gen__c__Gen_writeln(g, _SLIT(";")); } - else if (node.expr._typ == 293 /* v.ast.CallExpr */) { + else if (node.expr._typ == 295 /* v.ast.CallExpr */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = metaname}}, {_SLIT(".op = _SLIT(\"call\");"), 0, { .d_c = 0 }}}))); } @@ -64734,37 +62847,37 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_assert_metainfo(v__gen__c__Gen* g, v__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assert_single_expr(v__gen__c__Gen* g, v__ast__Expr expr, v__ast__Type typ) { string unknown_value = _SLIT("*unknown value*"); - if (expr._typ == 294 /* v.ast.CastExpr */) { + if (expr._typ == 296 /* v.ast.CastExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 308 /* v.ast.IfExpr */) { + else if (expr._typ == 310 /* v.ast.IfExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 310 /* v.ast.IndexExpr */) { + else if (expr._typ == 312 /* v.ast.IndexExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 317 /* v.ast.MatchExpr */) { + else if (expr._typ == 319 /* v.ast.MatchExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } - else if (expr._typ == 324 /* v.ast.PrefixExpr */) { - if (((*expr._v__ast__PrefixExpr).right)._typ == 294 /* v.ast.CastExpr */) { + else if (expr._typ == 326 /* v.ast.PrefixExpr */) { + if (((*expr._v__ast__PrefixExpr).right)._typ == 296 /* v.ast.CastExpr */) { v__gen__c__Gen_write(g, v__gen__c__ctoslit(unknown_value)); } else { v__gen__c__Gen_gen_expr_to_string(g, expr, typ); } } - else if (expr._typ == 333 /* v.ast.TypeNode */) { + else if (expr._typ == 335 /* v.ast.TypeNode */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); v__gen__c__Gen_write(g, v__gen__c__ctoslit( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT0, 0, { .d_c = 0 }}})))); } else { bool should_clone = true; - if (v__ast__Type_alias_eq(typ, _const_v__ast__string_type) && (expr)._typ == 331 /* v.ast.StringLiteral */) { + if (v__ast__Type_alias_eq(typ, _const_v__ast__string_type) && (expr)._typ == 333 /* v.ast.StringLiteral */) { should_clone = false; } - if ((expr)._typ == 292 /* v.ast.CTempVar */) { - if (((*expr._v__ast__CTempVar).orig)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 294 /* v.ast.CTempVar */) { + if (((*expr._v__ast__CTempVar).orig)._typ == 295 /* v.ast.CallExpr */) { should_clone = false; if ((*(*expr._v__ast__CTempVar).orig._v__ast__CallExpr).or_block.kind == v__ast__OrKind__propagate_option) { should_clone = true; @@ -64805,23 +62918,23 @@ string sref_name; v__gen__c__Gen_gen_assign_stmt_defer_0 = true; v__token__Kind op = (is_decl ? (v__token__Kind__assign) : (node.op)); v__ast__Expr right_expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.right, 0)); - if (right_expr._typ == 293 /* v.ast.CallExpr */) { + if (right_expr._typ == 295 /* v.ast.CallExpr */) { return_type = (*right_expr._v__ast__CallExpr).return_type; } - else if (right_expr._typ == 315 /* v.ast.LockExpr */) { + else if (right_expr._typ == 317 /* v.ast.LockExpr */) { return_type = (*right_expr._v__ast__LockExpr).typ; } - else if (right_expr._typ == 317 /* v.ast.MatchExpr */) { + else if (right_expr._typ == 319 /* v.ast.MatchExpr */) { return_type = (*right_expr._v__ast__MatchExpr).return_type; } - else if (right_expr._typ == 308 /* v.ast.IfExpr */) { + else if (right_expr._typ == 310 /* v.ast.IfExpr */) { return_type = (*right_expr._v__ast__IfExpr).typ; } else { } ; - af = g->is_autofree && !g->is_builtin_mod && node.op == v__token__Kind__assign && node.left_types.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 307 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 327 /* v.ast.SelectorExpr */); + af = g->is_autofree && !g->is_builtin_mod && node.op == v__token__Kind__assign && node.left_types.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 309 /* v.ast.Ident */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)))._typ == 329 /* v.ast.SelectorExpr */); sref_name = _SLIT(""); type_to_free = _SLIT(""); if (af) { @@ -64831,7 +62944,7 @@ string sref_name; type_to_free = (v__ast__Type_alias_eq(first_left_type, _const_v__ast__string_type) ? (_SLIT("string")) : (_SLIT("array"))); bool ok = true; v__ast__Expr left0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.left, 0)); - if ((left0)._typ == 307 /* v.ast.Ident */) { + if ((left0)._typ == 309 /* v.ast.Ident */) { if (string__eq((*left0._v__ast__Ident).name, _SLIT("_"))) { ok = false; } @@ -64891,11 +63004,11 @@ string sref_name; bool blank_assign = false; 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 == 307 /* v.ast.Ident */) { + if ((left)->_typ == 309 /* v.ast.Ident */) { ident = (*left->_v__ast__Ident); blank_assign = (*left->_v__ast__Ident).kind == v__ast__IdentKind__blank_ident; v__ast__IdentInfo left_info = (*left->_v__ast__Ident).info; - if ((left_info)._typ == 417 /* v.ast.IdentVar */) { + if ((left_info)._typ == 419 /* v.ast.IdentVar */) { v__ast__ShareType share = (*left_info._v__ast__IdentVar).share; if (share == v__ast__ShareType__shared_t) { var_type = v__ast__Type_set_flag(var_type, v__ast__TypeFlag__shared_f); @@ -64904,10 +63017,10 @@ string sref_name; var_type = v__ast__Type_set_flag(var_type, v__ast__TypeFlag__atomic_f); } } - if (((*left->_v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { - if ((val)._typ == 299 /* v.ast.ComptimeSelector */) { - if (((*val._v__ast__ComptimeSelector).field_expr)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 307 /* v.ast.Ident */) { + if (((*left->_v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { + if ((val)._typ == 301 /* v.ast.ComptimeSelector */) { + if (((*val._v__ast__ComptimeSelector).field_expr)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 309 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*val._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t2 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t1 = {0}; @@ -64926,7 +63039,7 @@ string sref_name; (*(*left->_v__ast__Ident).obj._v__ast__Var).typ = var_type; } } - } else if ((val)._typ == 298 /* v.ast.ComptimeCall */) { + } else if ((val)._typ == 300 /* v.ast.ComptimeCall */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*val._v__ast__ComptimeCall).method_name}}, {_SLIT(".return_type"), 0, { .d_c = 0 }}})); v__ast__Type* _t4 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t3 = {0}; @@ -64950,19 +63063,19 @@ string sref_name; string styp = v__gen__c__Gen_typ(g, var_type); bool is_fixed_array_init = false; bool has_val = false; - if (val._typ == 287 /* v.ast.ArrayInit */) { + if (val._typ == 289 /* v.ast.ArrayInit */) { is_fixed_array_init = (*val._v__ast__ArrayInit).is_fixed; has_val = (*val._v__ast__ArrayInit).has_val; } - else if (val._typ == 293 /* v.ast.CallExpr */) { + else if (val._typ == 295 /* v.ast.CallExpr */) { is_call = true; return_type = (*val._v__ast__CallExpr).return_type; } - else if (val._typ == 285 /* v.ast.AnonFn */) { + else if (val._typ == 287 /* v.ast.AnonFn */) { if (blank_assign) { v__gen__c__Gen_write(g, _SLIT("{")); } - if ((is_decl || blank_assign) && (left)->_typ == 307 /* v.ast.Ident */) { + if ((is_decl || blank_assign) && (left)->_typ == 309 /* v.ast.Ident */) { string ret_styp = v__gen__c__Gen_typ(g, (*val._v__ast__AnonFn).decl.return_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = ident.name}}, {_SLIT(") ("), 0, { .d_c = 0 }}}))); int def_pos = g->definitions.len; @@ -64975,7 +63088,7 @@ string sref_name; v__gen__c__Gen_expr(g, *left); g->is_assign_lhs = false; g->is_arraymap_set = false; - if ((left)->_typ == 310 /* v.ast.IndexExpr */) { + if ((left)->_typ == 312 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*left->_v__ast__IndexExpr).left_type); if (sym->kind == v__ast__Kind__map || sym->kind == v__ast__Kind__array) { v__gen__c__Gen_expr(g, val); @@ -64999,14 +63112,14 @@ string sref_name; v__ast__Type unwrapped_val_type = v__gen__c__Gen_unwrap_generic(g, val_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, unwrapped_val_type); v__ast__TypeSymbol* unaliased_right_sym = v__ast__Table_final_sym(g->table, unwrapped_val_type); - bool is_fixed_array_var = unaliased_right_sym->kind == v__ast__Kind__array_fixed && (val)._typ != 287 /* v.ast.ArrayInit */ && (((val)._typ == 307 /* v.ast.Ident */ || (val)._typ == 310 /* v.ast.IndexExpr */ || (val)._typ == 293 /* v.ast.CallExpr */ || (val)._typ == 327 /* v.ast.SelectorExpr */) || ((val)._typ == 294 /* v.ast.CastExpr */ && ((/* as */ *(v__ast__CastExpr*)__as_cast((val)._v__ast__CastExpr,(val)._typ, 294) /*expected idx: 294, name: v.ast.CastExpr */ ).expr)._typ != 287 /* v.ast.ArrayInit */)) && !g->pref->translated; + bool is_fixed_array_var = unaliased_right_sym->kind == v__ast__Kind__array_fixed && (val)._typ != 289 /* v.ast.ArrayInit */ && (((val)._typ == 309 /* v.ast.Ident */ || (val)._typ == 312 /* v.ast.IndexExpr */ || (val)._typ == 295 /* v.ast.CallExpr */ || (val)._typ == 329 /* v.ast.SelectorExpr */) || ((val)._typ == 296 /* v.ast.CastExpr */ && ((/* as */ *(v__ast__CastExpr*)__as_cast((val)._v__ast__CastExpr,(val)._typ, 296) /*expected idx: 296, name: v.ast.CastExpr */ ).expr)._typ != 289 /* v.ast.ArrayInit */)) && !g->pref->translated; g->is_assign_lhs = true; g->assign_op = node.op; if (v__ast__Type_has_flag(val_type, v__ast__TypeFlag__optional)) { g->right_is_opt = true; } if (blank_assign) { - if ((val)._typ == 310 /* v.ast.IndexExpr */) { + if ((val)._typ == 312 /* v.ast.IndexExpr */) { g->assign_op = v__token__Kind__decl_assign; } g->is_assign_lhs = false; @@ -65026,17 +63139,17 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_writeln(g, _SLIT(";}")); } - } else if (node.op == v__token__Kind__assign && !g->pref->translated && (is_fixed_array_init || (right_sym->kind == v__ast__Kind__array_fixed && (val)._typ == 307 /* v.ast.Ident */))) { + } else if (node.op == v__token__Kind__assign && !g->pref->translated && (is_fixed_array_init || (right_sym->kind == v__ast__Kind__array_fixed && (val)._typ == 309 /* v.ast.Ident */))) { string v_var = _SLIT(""); string arr_typ = string_trim(styp, _SLIT("*")); if (is_fixed_array_init) { - v__ast__ArrayInit right = /* as */ *(v__ast__ArrayInit*)__as_cast((val)._v__ast__ArrayInit,(val)._typ, 287) /*expected idx: 287, name: v.ast.ArrayInit */ ; + v__ast__ArrayInit right = /* as */ *(v__ast__ArrayInit*)__as_cast((val)._v__ast__ArrayInit,(val)._typ, 289) /*expected idx: 289, name: v.ast.ArrayInit */ ; v_var = v__gen__c__Gen_new_tmp_var(g); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = arr_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v_var}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, v__ast__ArrayInit_to_sumtype_v__ast__Expr(&right)); v__gen__c__Gen_writeln(g, _SLIT(";")); } else { - v__ast__Ident right = /* as */ *(v__ast__Ident*)__as_cast((val)._v__ast__Ident,(val)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ; + v__ast__Ident right = /* as */ *(v__ast__Ident*)__as_cast((val)._v__ast__Ident,(val)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ; v_var = right.name; } int pos = g->out.len; @@ -65073,7 +63186,7 @@ string sref_name; v__ast__Type op_expected_left = ((v__ast__Type)(0)); v__ast__Type op_expected_right = ((v__ast__Type)(0)); if (var_type == _const_v__ast__string_type_idx && node.op == v__token__Kind__plus_assign) { - if ((left)->_typ == 310 /* v.ast.IndexExpr */) { + if ((left)->_typ == 312 /* v.ast.IndexExpr */) { v__gen__c__Gen_expr(g, *left); v__gen__c__Gen_write(g, _SLIT("string__plus(")); } else { @@ -65105,8 +63218,8 @@ string sref_name; _t6 = _SLIT("unknown op"); }string extracted_op = _t6; v__gen__c__Gen_expr(g, *left); - if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).generic_types.len > 0) { - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).concrete_types; + if (left_sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left_sym->info)._v__ast__Struct,(left_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(string__plus(left_sym->cname, _SLIT("_")), v__util__replace_op(extracted_op)); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = method_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -65147,7 +63260,7 @@ string sref_name; if (is_inside_ternary && is_decl) { strings__Builder_write_string(&g->out, v__util__tabs(g->indent - g->inside_ternary)); } - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((right_sym->info)._v__ast__FnType,(right_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); string call_conv = _SLIT(""); string msvc_call_conv = _SLIT(""); @@ -65178,14 +63291,14 @@ string sref_name; bool is_used_var_styp = false; if (!Array_string_contains(g->defer_vars, ident.name)) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_type); - if ((val_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((val_sym->info)._typ == 459 /* v.ast.Struct */) { if ((*val_sym->info._v__ast__Struct).generic_types.len > 0) { - if ((val)._typ == 332 /* v.ast.StructInit */) { + if ((val)._typ == 334 /* v.ast.StructInit */) { string var_styp = v__gen__c__Gen_typ(g, (*val._v__ast__StructInit).typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = var_styp}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); is_used_var_styp = true; - } else if ((val)._typ == 324 /* v.ast.PrefixExpr */) { - if ((*val._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*val._v__ast__PrefixExpr).right)._typ == 332 /* v.ast.StructInit */) { + } else if ((val)._typ == 326 /* v.ast.PrefixExpr */) { + if ((*val._v__ast__PrefixExpr).op == v__token__Kind__amp && ((*val._v__ast__PrefixExpr).right)._typ == 334 /* v.ast.StructInit */) { string var_styp = v__gen__c__Gen_typ(g, v__ast__Type_ref((*(*val._v__ast__PrefixExpr).right._v__ast__StructInit).typ)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = var_styp}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); is_used_var_styp = true; @@ -65201,7 +63314,7 @@ string sref_name; } } } - if ((left)->_typ == 307 /* v.ast.Ident */ || (left)->_typ == 327 /* v.ast.SelectorExpr */) { + if ((left)->_typ == 309 /* v.ast.Ident */ || (left)->_typ == 329 /* v.ast.SelectorExpr */) { g->prevent_sum_type_unwrapping_once = true; } if (!is_fixed_array_var || is_decl) { @@ -65212,6 +63325,9 @@ string sref_name; v__gen__c__Gen_write(g, _SLIT("*")); } v__gen__c__Gen_expr(g, *left); + if (!is_decl && v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f)) { + v__gen__c__Gen_write(g, _SLIT("->val")); + } } } } @@ -65239,7 +63355,6 @@ string sref_name; bool unwrap_optional = !v__ast__Type_has_flag(var_type, v__ast__TypeFlag__optional) && v__ast__Type_has_flag(val_type, v__ast__TypeFlag__optional); if (unwrap_optional) { } - g->is_shared = v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f); if (!cloned) { if (is_fixed_array_var) { string typ_str = string_trim(v__gen__c__Gen_typ(g, val_type), _SLIT("*")); @@ -65250,8 +63365,9 @@ string sref_name; v__gen__c__Gen_expr(g, val); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = typ_str}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } else if (is_decl) { + g->is_shared = v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f); if (is_fixed_array_init && !has_val) { - if ((val)._typ == 287 /* v.ast.ArrayInit */) { + if ((val)._typ == 289 /* 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}")); @@ -65263,7 +63379,7 @@ string sref_name; if (v__ast__Expr_is_auto_deref_var(val)) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((val)._typ == 287 /* v.ast.ArrayInit */) { + if ((val)._typ == 289 /* v.ast.ArrayInit */) { v__gen__c__Gen_array_init(g, (*val._v__ast__ArrayInit), ident.name); } else if (v__ast__Type_has_flag(val_type, v__ast__TypeFlag__shared_f)) { v__gen__c__Gen_expr_with_cast(g, val, val_type, var_type); @@ -65281,7 +63397,7 @@ string sref_name; if (op_overloaded) { v__gen__c__Gen_op_arg(g, val, op_expected_right, val_type); } else { - v__ast__Type exp_type = (v__ast__Expr_is_auto_deref_var(/*rec*/*left) ? (v__ast__Type_deref(var_type)) : (var_type)); + v__ast__Type exp_type = v__ast__Type_clear_flag((v__ast__Expr_is_auto_deref_var(/*rec*/*left) || v__ast__Type_has_flag(var_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(var_type)) : (var_type)), v__ast__TypeFlag__shared_f); v__gen__c__Gen_expr_with_cast(g, val, val_type, exp_type); } } @@ -65326,12 +63442,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_multi_return_assign(v__gen__c__Gen* g, v v__ast__Expr lx = ((v__ast__Expr*)node->left.data)[i]; bool is_auto_heap = false; 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 == 307 /* v.ast.Ident */) { + if ((lx)._typ == 309 /* v.ast.Ident */) { ident = (*lx._v__ast__Ident); if ((*lx._v__ast__Ident).kind == v__ast__IdentKind__blank_ident) { continue; } - if (((*lx._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if (((*lx._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { is_auto_heap = (*(*lx._v__ast__Ident).obj._v__ast__Var).is_auto_heap; } } @@ -65390,26 +63506,26 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_assign_vars_autofree(v__gen__c__Gen* g, VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__ast__AssignStmt* node) { for (int i = 0; i < node->left.len; ++i) { v__ast__Expr left = ((v__ast__Expr*)node->left.data)[i]; - if (left._typ == 307 /* v.ast.Ident */) { + if (left._typ == 309 /* v.ast.Ident */) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); if (left_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } else { string styp = v__gen__c__Gen_typ(g, left_typ); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__Ident).pos.pos}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*left._v__ast__Ident).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (left._typ == 310 /* v.ast.IndexExpr */) { + else if (left._typ == 312 /* v.ast.IndexExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*left._v__ast__IndexExpr).left_type); if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__TypeSymbol* elem_typ = v__ast__Table_sym(g->table, info.elem_type); if (elem_typ->kind == v__ast__Kind__function) { v__ast__Type left_typ = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_typ); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)array_get(")); } else { string styp = v__gen__c__Gen_typ(g, info.elem_type); @@ -65430,7 +63546,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a v__gen__c__Gen_expr(g, (*left._v__ast__IndexExpr).index); v__gen__c__Gen_writeln(g, _SLIT(");")); } else if (sym->kind == v__ast__Kind__map) { - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; string skeytyp = v__gen__c__Gen_typ(g, info.key_type); string styp = v__gen__c__Gen_typ(g, info.value_type); string zero = v__gen__c__Gen_type_default(g, info.value_type); @@ -65438,7 +63554,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a if (val_typ->kind == v__ast__Kind__function) { v__ast__Type left_type = (*(v__ast__Type*)/*ee elem_sym */array_get(node->left_types, i)); v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, left_type); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((left_sym->info)._v__ast__FnType,(left_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), str_intp(2, _MOV((StrIntpData[]){{_SLIT("_var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT0, 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT(" = *(voidptr*)map_get(")); } else { v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__IndexExpr).pos.pos}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)map_get("), 0, { .d_c = 0 }}}))); @@ -65460,7 +63576,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a } } } - else if (left._typ == 327 /* v.ast.SelectorExpr */) { + else if (left._typ == 329 /* v.ast.SelectorExpr */) { string styp = v__gen__c__Gen_typ(g, (*left._v__ast__SelectorExpr).typ); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" _var_"), /*100 &int*/0xfe07, {.d_i32 = (*left._v__ast__SelectorExpr).pos.pos}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*left._v__ast__SelectorExpr).expr); @@ -65483,11 +63599,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_var_assign(v__gen__c__Gen* g, v__a VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Array_v__ast__Expr left, v__ast__Expr val) { v__ast__Expr val_ = val; - if (val._typ == 307 /* v.ast.Ident */) { + if (val._typ == 309 /* v.ast.Ident */) { bool has_var = false; for (int _t1 = 0; _t1 < left.len; ++_t1) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t1]; - if ((lx)._typ == 307 /* v.ast.Ident */) { + if ((lx)._typ == 309 /* v.ast.Ident */) { if (string__eq((*val._v__ast__Ident).name, (*lx._v__ast__Ident).name)) { v__gen__c__Gen_write(g, _SLIT("_var_")); v__gen__c__Gen_write(g, int_str((*lx._v__ast__Ident).pos.pos)); @@ -65500,7 +63616,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_expr(g, val_); } } - else if (val._typ == 310 /* v.ast.IndexExpr */) { + else if (val._typ == 312 /* v.ast.IndexExpr */) { bool has_var = false; for (int _t2 = 0; _t2 < left.len; ++_t2) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t2]; @@ -65515,7 +63631,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_expr(g, val_); } } - else if (val._typ == 311 /* v.ast.InfixExpr */) { + else if (val._typ == 313 /* v.ast.InfixExpr */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*val._v__ast__InfixExpr).left_type); _option_v__ast__Fn _t3; if (_t3 = v__ast__Table_find_method(g->table, sym, v__token__Kind_str((*val._v__ast__InfixExpr).op)), _t3.state == 0) { @@ -65535,15 +63651,15 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_cross_tmp_variable(v__gen__c__Gen* g, Ar v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__InfixExpr).right); } } - else if (val._typ == 324 /* v.ast.PrefixExpr */) { + else if (val._typ == 326 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PrefixExpr).op)); v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PrefixExpr).right); } - else if (val._typ == 323 /* v.ast.PostfixExpr */) { + else if (val._typ == 325 /* v.ast.PostfixExpr */) { v__gen__c__Gen_gen_cross_tmp_variable(g, left, (*val._v__ast__PostfixExpr).expr); v__gen__c__Gen_write(g, v__token__Kind_str((*val._v__ast__PostfixExpr).op)); } - else if (val._typ == 327 /* v.ast.SelectorExpr */) { + else if (val._typ == 329 /* v.ast.SelectorExpr */) { bool has_var = false; for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr lx = ((v__ast__Expr*)left.data)[_t4]; @@ -65750,7 +63866,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_alias_equality_fn(v__gen__c__Gen* g, v return _t1; } array_push((array*)&g->generated_eq_fns, _MOV((v__ast__Type[]){ left_type })); - v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias info = /* as */ *(v__ast__Alias*)__as_cast((left.sym->info)._v__ast__Alias,(left.sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; strings__Builder_writeln(&g->definitions, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b); // auto"), 0, { .d_c = 0 }}}))); strings__Builder fn_builder = strings__new_builder(512); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("_alias_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); @@ -65916,7 +64032,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_map_equality_fn(v__gen__c__Gen* g, v__ strings__Builder_writeln(&fn_builder, _SLIT("\t\tif (!map_exists(&b, k)) return false;")); v__ast__Kind kind = v__ast__Table_type_kind(g->table, value.typ); if (kind == v__ast__Kind__function) { - v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType func = /* as */ *(v__ast__FnType*)__as_cast((value.sym->info)._v__ast__FnType,(value.sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; string ret_styp = v__gen__c__Gen_typ(g, func.func.return_type); strings__Builder_write_string(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t"), /*115 &string*/0xfe10, {.d_s = ret_styp}}, {_SLIT(" (*v) ("), 0, { .d_c = 0 }}}))); int arg_len = func.func.params.len; @@ -66051,7 +64167,7 @@ strings__Builder fn_builder; strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static bool "), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("_interface_eq("), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" a, "), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT(" b) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, _SLIT("\tif (a._typ == b._typ) {")); strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tint idx = v_typeof_interface_idx_"), /*115 &string*/0xfe10, {.d_s = ptr_styp}}, {_SLIT("(a._typ);"), 0, { .d_c = 0 }}}))); - if ((info)._typ == 475 /* v.ast.Interface */) { + if ((info)._typ == 477 /* v.ast.Interface */) { for (int _t3 = 0; _t3 < (*info._v__ast__Interface).types.len; ++_t3) { v__ast__Type typ = ((v__ast__Type*)(*info._v__ast__Interface).types.data)[_t3]; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tif (idx == "), /*100 &int*/0xfe07, {.d_i32 = v__ast__Type_idx(typ)}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); @@ -66107,7 +64223,7 @@ strings__Builder fn_builder; VV_LOCAL_SYMBOL string v__gen__c__Gen_get_free_method(v__gen__c__Gen* g, v__ast__Type typ) { map_set(&g->autofree_methods, &(int[]){typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 472 /* v.ast.Alias */) { + if ((sym->info)._typ == 474 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -66148,7 +64264,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ } map_set(&g->generated_free_methods, &(int[]){deref_typ}, &(bool[]) { true }); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); - if ((sym->info)._typ == 472 /* v.ast.Alias */) { + if ((sym->info)._typ == 474 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); } @@ -66157,13 +64273,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_gen_free_method(v__gen__c__Gen* g, v__ast_ string _t2 = fn_name; return _t2; } - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { v__gen__c__Gen_gen_free_for_struct(g, (*sym->info._v__ast__Struct), styp, fn_name); } - else if (sym->info._typ == 452 /* v.ast.Array */) { + else if (sym->info._typ == 454 /* v.ast.Array */) { v__gen__c__Gen_gen_free_for_array(g, (*sym->info._v__ast__Array), styp, fn_name); } - else if (sym->info._typ == 453 /* v.ast.Map */) { + else if (sym->info._typ == 455 /* v.ast.Map */) { v__gen__c__Gen_gen_free_for_map(g, (*sym->info._v__ast__Map), styp, fn_name); } @@ -66256,253 +64372,6 @@ inline VV_LOCAL_SYMBOL string v__gen__c__styp_to_free_fn_name(string styp) { return _t1; } -string v__gen__c__type_to_str(StrIntpType x) { - switch (x) { - case StrIntpType__si_no_str: - { - string _t1 = _SLIT("no_str"); - return _t1; - break; - } - case StrIntpType__si_c: - { - string _t2 = _SLIT("c"); - return _t2; - break; - } - case StrIntpType__si_u8: - { - string _t3 = _SLIT("u8"); - return _t3; - break; - } - case StrIntpType__si_i8: - { - string _t4 = _SLIT("i8"); - return _t4; - break; - } - case StrIntpType__si_u16: - { - string _t5 = _SLIT("u16"); - return _t5; - break; - } - case StrIntpType__si_i16: - { - string _t6 = _SLIT("i16"); - return _t6; - break; - } - case StrIntpType__si_u32: - { - string _t7 = _SLIT("u32"); - return _t7; - break; - } - case StrIntpType__si_i32: - { - string _t8 = _SLIT("i32"); - return _t8; - break; - } - case StrIntpType__si_u64: - { - string _t9 = _SLIT("u64"); - return _t9; - break; - } - case StrIntpType__si_i64: - { - string _t10 = _SLIT("i64"); - return _t10; - break; - } - case StrIntpType__si_f32: - { - string _t11 = _SLIT("f32"); - return _t11; - break; - } - case StrIntpType__si_f64: - { - string _t12 = _SLIT("f64"); - return _t12; - break; - } - case StrIntpType__si_g32: - { - string _t13 = _SLIT("f32"); - return _t13; - break; - } - case StrIntpType__si_g64: - { - string _t14 = _SLIT("f64"); - return _t14; - break; - } - case StrIntpType__si_e32: - { - string _t15 = _SLIT("f32"); - return _t15; - break; - } - case StrIntpType__si_e64: - { - string _t16 = _SLIT("f64"); - return _t16; - break; - } - case StrIntpType__si_s: - { - string _t17 = _SLIT("s"); - return _t17; - break; - } - case StrIntpType__si_p: - { - string _t18 = _SLIT("p"); - return _t18; - break; - } - case StrIntpType__si_vp: - { - string _t19 = _SLIT("vp"); - return _t19; - break; - } - } - ; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -string v__gen__c__data_str(StrIntpType x) { - switch (x) { - case StrIntpType__si_no_str: - { - string _t1 = _SLIT("no_str"); - return _t1; - break; - } - case StrIntpType__si_c: - { - string _t2 = _SLIT("d_c"); - return _t2; - break; - } - case StrIntpType__si_u8: - { - string _t3 = _SLIT("d_u8"); - return _t3; - break; - } - case StrIntpType__si_i8: - { - string _t4 = _SLIT("d_i8"); - return _t4; - break; - } - case StrIntpType__si_u16: - { - string _t5 = _SLIT("d_u16"); - return _t5; - break; - } - case StrIntpType__si_i16: - { - string _t6 = _SLIT("d_i16"); - return _t6; - break; - } - case StrIntpType__si_u32: - { - string _t7 = _SLIT("d_u32"); - return _t7; - break; - } - case StrIntpType__si_i32: - { - string _t8 = _SLIT("d_i32"); - return _t8; - break; - } - case StrIntpType__si_u64: - { - string _t9 = _SLIT("d_u64"); - return _t9; - break; - } - case StrIntpType__si_i64: - { - string _t10 = _SLIT("d_i64"); - return _t10; - break; - } - case StrIntpType__si_f32: - { - string _t11 = _SLIT("d_f32"); - return _t11; - break; - } - case StrIntpType__si_f64: - { - string _t12 = _SLIT("d_f64"); - return _t12; - break; - } - case StrIntpType__si_g32: - { - string _t13 = _SLIT("d_f32"); - return _t13; - break; - } - case StrIntpType__si_g64: - { - string _t14 = _SLIT("d_f64"); - return _t14; - break; - } - case StrIntpType__si_e32: - { - string _t15 = _SLIT("d_f32"); - return _t15; - break; - } - case StrIntpType__si_e64: - { - string _t16 = _SLIT("d_f64"); - return _t16; - break; - } - case StrIntpType__si_s: - { - string _t17 = _SLIT("d_s"); - return _t17; - break; - } - case StrIntpType__si_p: - { - string _t18 = _SLIT("d_p"); - return _t18; - break; - } - case StrIntpType__si_vp: - { - string _t19 = _SLIT("d_vp"); - return _t19; - break; - } - } - ; - return (string){.str=(byteptr)"", .is_lit=1}; -} - -VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind) { - bool _t1 = (kind == v__ast__Kind__struct_ || kind == v__ast__Kind__alias || kind == v__ast__Kind__array || kind == v__ast__Kind__array_fixed || kind == v__ast__Kind__map || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__interface_); - return _t1; -} - VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_default(v__gen__c__Gen* g, v__ast__TypeSymbol sym, string styp, string str_fn_name) { string convertor = _SLIT(""); string typename_ = _SLIT(""); @@ -66550,13 +64419,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_str_fn(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, unwrapped); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped); string str_fn_name = v__gen__c__styp_to_str_fn_name(styp); - if ((sym->info)._typ == 472 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 474 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { if ((*sym->info._v__ast__Alias).is_import) { sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); str_fn_name = v__gen__c__styp_to_str_fn_name(sym->name); } } - if (v__ast__TypeSymbol_has_method_with_generic_parent(sym, _SLIT("str")) && (sym->info)._typ == 457 /* v.ast.Struct */) { + if (v__ast__TypeSymbol_has_method_with_generic_parent(sym, _SLIT("str")) && (sym->info)._typ == 459 /* v.ast.Struct */) { str_fn_name = v__gen__c__Gen_generic_fn_name(g, (*sym->info._v__ast__Struct).concrete_types, str_fn_name, false); } array_push((array*)&g->str_types, _MOV((v__gen__c__StrType[]){ ((v__gen__c__StrType){.styp = styp,.typ = unwrapped,}) })); @@ -66583,44 +64452,44 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ v__gen__c__Gen_gen_str_for_result(g, typ.typ, styp, str_fn_name); return; } - if (sym->info._typ == 472 /* v.ast.Alias */) { + if (sym->info._typ == 474 /* v.ast.Alias */) { if ((*sym->info._v__ast__Alias).is_import) { v__gen__c__Gen_gen_str_default(g, *sym, styp, str_fn_name); } else { v__gen__c__Gen_gen_str_for_alias(g, (*sym->info._v__ast__Alias), styp, str_fn_name); } } - else if (sym->info._typ == 452 /* v.ast.Array */) { + else if (sym->info._typ == 454 /* v.ast.Array */) { v__gen__c__Gen_gen_str_for_array(g, (*sym->info._v__ast__Array), styp, str_fn_name); } - else if (sym->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { v__gen__c__Gen_gen_str_for_array_fixed(g, (*sym->info._v__ast__ArrayFixed), styp, str_fn_name); } - else if (sym->info._typ == 486 /* v.ast.Enum */) { + else if (sym->info._typ == 488 /* v.ast.Enum */) { v__gen__c__Gen_gen_str_for_enum(g, (*sym->info._v__ast__Enum), styp, str_fn_name); } - else if (sym->info._typ == 484 /* v.ast.FnType */) { + else if (sym->info._typ == 486 /* v.ast.FnType */) { v__gen__c__Gen_gen_str_for_fn_type(g, (*sym->info._v__ast__FnType), styp, str_fn_name); } - else if (sym->info._typ == 457 /* v.ast.Struct */) { + else if (sym->info._typ == 459 /* v.ast.Struct */) { v__gen__c__Gen_gen_str_for_struct(g, (*sym->info._v__ast__Struct), styp, str_fn_name); } - else if (sym->info._typ == 453 /* v.ast.Map */) { + else if (sym->info._typ == 455 /* v.ast.Map */) { v__gen__c__Gen_gen_str_for_map(g, (*sym->info._v__ast__Map), styp, str_fn_name); } - else if (sym->info._typ == 483 /* v.ast.MultiReturn */) { + else if (sym->info._typ == 485 /* v.ast.MultiReturn */) { v__gen__c__Gen_gen_str_for_multi_return(g, (*sym->info._v__ast__MultiReturn), styp, str_fn_name); } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { v__gen__c__Gen_gen_str_for_union_sum_type(g, (*sym->info._v__ast__SumType), styp, str_fn_name); } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { v__gen__c__Gen_gen_str_for_interface(g, (*sym->info._v__ast__Interface), styp, str_fn_name); } - else if (sym->info._typ == 481 /* v.ast.Chan */) { + else if (sym->info._typ == 483 /* v.ast.Chan */) { v__gen__c__Gen_gen_str_for_chan(g, (*sym->info._v__ast__Chan), styp, str_fn_name); } - else if (sym->info._typ == 482 /* v.ast.Thread */) { + else if (sym->info._typ == 484 /* v.ast.Thread */) { v__gen__c__Gen_gen_str_for_thread(g, (*sym->info._v__ast__Thread), styp, str_fn_name); } @@ -66634,8 +64503,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_final_gen_str(v__gen__c__Gen* g, v__gen__c__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_option(v__gen__c__Gen* g, v__ast__Type typ, string styp, string str_fn_name) { v__ast__Type parent_type = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__optional); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, parent_type); - multi_return_bool_bool_int mr_6348 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_6348.arg0; + multi_return_bool_bool_int mr_4622 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_4622.arg0; string parent_str_fn_name = v__gen__c__Gen_get_str_fn(g, parent_type); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(it, 0); }"), 0, { .d_c = 0 }}}))); @@ -66662,8 +64531,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_option(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_result(v__gen__c__Gen* g, v__ast__Type typ, string styp, string str_fn_name) { v__ast__Type parent_type = v__ast__Type_clear_flag(typ, v__ast__TypeFlag__result); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, parent_type); - multi_return_bool_bool_int mr_7867 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_7867.arg0; + multi_return_bool_bool_int mr_6141 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_6141.arg0; string parent_str_fn_name = v__gen__c__Gen_get_str_fn(g, parent_type); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" it) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(it, 0); }"), 0, { .d_c = 0 }}}))); @@ -66713,9 +64582,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_multi_return(v__gen__c__Gen* g, v__ast__Type typ = ((v__ast__Type*)info.types.data)[i]; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); bool is_arg_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_11059 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_11059.arg0; - bool str_method_expects_ptr = mr_11059.arg1; + multi_return_bool_bool_int mr_9333 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_9333.arg0; + bool str_method_expects_ptr = mr_9333.arg1; string arg_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { strings__Builder_writeln(&fn_builder, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("(a.arg"), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); @@ -66733,9 +64602,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_multi_return(v__gen__c__Gen* g, } else if (sym->kind == v__ast__Kind__function) { strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("());"), 0, { .d_c = 0 }}}))); } else { - multi_return_string_string mr_11884 = v__gen__c__deref_kind(str_method_expects_ptr, is_arg_ptr, typ); - string deref = mr_11884.arg0; - string deref_label = mr_11884.arg1; + multi_return_string_string mr_10158 = v__gen__c__deref_kind(str_method_expects_ptr, is_arg_ptr, typ); + string deref = mr_10158.arg0; + string deref_label = mr_10158.arg1; strings__Builder_writeln(&fn_builder, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&fn_builder, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tstrings__Builder_write_string(&sb, "), /*115 &string*/0xfe10, {.d_s = arg_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" a.arg"), /*100 &int*/0xfe07, {.d_i32 = i}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } @@ -66801,9 +64670,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_interface(v__gen__c__Gen* g, v__ v__ast__Type typ = ((v__ast__Type*)info.types.data)[_t1]; v__ast__TypeSymbol* sub_sym = v__ast__Table_sym(g->table, v__ast__mktyp(typ)); string func_name = v__gen__c__Gen_get_str_fn(g, typ); - multi_return_bool_bool_int mr_15318 = v__ast__TypeSymbol_str_method_info(sub_sym); - bool sym_has_str_method = mr_15318.arg0; - bool str_method_expects_ptr = mr_15318.arg1; + multi_return_bool_bool_int mr_13592 = v__ast__TypeSymbol_str_method_info(sub_sym); + bool sym_has_str_method = mr_13592.arg0; + bool str_method_expects_ptr = mr_13592.arg1; if (v__gen__c__should_use_indent_func(sub_sym->kind) && !sym_has_str_method) { func_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = func_name}}, {_SLIT0, 0, { .d_c = 0 }}})); } @@ -66869,9 +64738,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_union_sum_type(v__gen__c__Gen* g string typ_str = v__gen__c__Gen_typ(g, typ); string func_name = v__gen__c__Gen_get_str_fn(g, typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - multi_return_bool_bool_int mr_18235 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_18235.arg0; - bool str_method_expects_ptr = mr_18235.arg1; + multi_return_bool_bool_int mr_16509 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_16509.arg0; + bool str_method_expects_ptr = mr_16509.arg1; string deref = (sym_has_str_method && str_method_expects_ptr ? (_SLIT(" ")) : (_SLIT("*"))); if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { func_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = func_name}}, {_SLIT0, 0, { .d_c = 0 }}})); @@ -66966,15 +64835,15 @@ VV_LOCAL_SYMBOL multi_return_string_string v__gen__c__deref_kind(bool str_method VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast__Array info, string styp, string str_fn_name) { v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 472 /* v.ast.Alias */) { + if ((sym->info)._typ == 474 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } string field_styp = v__gen__c__Gen_typ(g, typ); bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_22381 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_22381.arg0; - bool str_method_expects_ptr = mr_22381.arg1; + multi_return_bool_bool_int mr_20655 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_20655.arg0; + bool str_method_expects_ptr = mr_20655.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); if (sym->kind == v__ast__Kind__u8) { elem_str_fn_name = string__plus(elem_str_fn_name, _SLIT("_escaped")); @@ -67016,9 +64885,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = str_intp(2, _MOV((StrIntpData[]){{_SLIT(\"\'\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s = it }}, {_SLIT(\"\'\"), 0, {.d_c = 0 }}}));\n"), 0, { .d_c = 0 }}}))); } } else { - multi_return_string_string mr_24905 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_24905.arg0; - string deref_label = mr_24905.arg1; + multi_return_string_string mr_23179 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_23179.arg0; + string deref_label = mr_23179.arg1; strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("( "), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" it);"), 0, { .d_c = 0 }}}))); } @@ -67041,14 +64910,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array(v__gen__c__Gen* g, v__ast_ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v__ast__ArrayFixed info, string styp, string str_fn_name) { v__ast__Type typ = info.elem_type; v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, info.elem_type); - if ((sym->info)._typ == 472 /* v.ast.Alias */) { + if ((sym->info)._typ == 474 /* v.ast.Alias */) { typ = (*sym->info._v__ast__Alias).parent_type; sym = v__ast__Table_sym(g->table, typ); } bool is_elem_ptr = v__ast__Type_is_ptr(typ); - multi_return_bool_bool_int mr_26287 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_26287.arg0; - bool str_method_expects_ptr = mr_26287.arg1; + multi_return_bool_bool_int mr_24561 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_24561.arg0; + bool str_method_expects_ptr = mr_24561.arg1; string elem_str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a); // auto"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, str_intp(4, _MOV((StrIntpData[]){{_SLIT("static string "), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" a) { return indent_"), /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("(a, 0);}"), 0, { .d_c = 0 }}}))); @@ -67061,9 +64930,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstring x = "), /*115 &string*/0xfe10, {.d_s = elem_str_fn_name}}, {_SLIT("();"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->auto_str_funcs, _SLIT("\t\tstrings__Builder_write_string(&sb, x);")); } else { - multi_return_string_string mr_27164 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); - string deref = mr_27164.arg0; - string deref_label = mr_27164.arg1; + multi_return_string_string mr_25438 = v__gen__c__deref_kind(str_method_expects_ptr, is_elem_ptr, typ); + string deref = mr_25438.arg0; + string deref_label = mr_25438.arg1; if (v__gen__c__should_use_indent_func(sym->kind) && !sym_has_str_method) { if (is_elem_ptr) { strings__Builder_writeln(&g->auto_str_funcs, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\tstrings__Builder_write_string(&sb, _SLIT(\""), /*115 &string*/0xfe10, {.d_s = deref_label}}, {_SLIT("\"));"), 0, { .d_c = 0 }}}))); @@ -67104,7 +64973,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_array_fixed(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__Map info, string styp, string str_fn_name) { v__ast__Type key_typ = info.key_type; v__ast__TypeSymbol* key_sym = v__ast__Table_sym(g->table, key_typ); - if ((key_sym->info)._typ == 472 /* v.ast.Alias */) { + if ((key_sym->info)._typ == 474 /* v.ast.Alias */) { key_typ = (*key_sym->info._v__ast__Alias).parent_type; key_sym = v__ast__Table_sym(g->table, key_typ); } @@ -67115,7 +64984,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_str_for_map(v__gen__c__Gen* g, v__ast__M } v__ast__Type val_typ = info.value_type; v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, val_typ); - if ((val_sym->info)._typ == 472 /* v.ast.Alias */) { + if ((val_sym->info)._typ == 474 /* v.ast.Alias */) { val_typ = (*val_sym->info._v__ast__Alias).parent_type; val_sym = v__ast__Table_sym(g->table, val_typ); } @@ -67264,7 +65133,8 @@ strings__Builder fn_body; strings__Builder_writeln(&fn_body, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = clean_struct_v_type_name}}, {_SLIT("{\\n\"), 0, {.d_c=0}},"), 0, { .d_c = 0 }}}))); for (int i = 0; i < info.fields.len; ++i) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[i]; - string ptr_amp = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("&")) : (_SLIT(""))); + v__ast__Type ftyp_noshared = (v__ast__Type_has_flag(field.typ, v__ast__TypeFlag__shared_f) ? (v__ast__Type_clear_flag(v__ast__Type_deref(field.typ), v__ast__TypeFlag__shared_f)) : (field.typ)); + string ptr_amp = (v__ast__Type_is_ptr(ftyp_noshared) ? (_SLIT("&")) : (_SLIT(""))); StrIntpType base_fmt = v__gen__c__Gen_type_to_fmt(g, v__gen__c__Gen_unwrap_generic(g, field.typ)); string quote_str = _SLIT(""); string prefix = _SLIT(""); @@ -67280,20 +65150,20 @@ strings__Builder fn_body; } else { strings__Builder_write_string(&fn_body, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t\t{_SLIT(\"\\n\"), "), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__si_s_code}}, {_SLIT(", {.d_s=indents}}, {_SLIT(\" "), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT(": "), /*115 &string*/0xfe10, {.d_s = ptr_amp}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = prefix}}, {_SLIT("\"), 0, {.d_c=0}}, "), 0, { .d_c = 0 }}}))); } - multi_return_bool_bool_int mr_36986 = v__ast__TypeSymbol_str_method_info(sym); - bool sym_has_str_method = mr_36986.arg0; - bool str_method_expects_ptr = mr_36986.arg1; - string sftyp = v__gen__c__Gen_typ(g, field.typ); + multi_return_bool_bool_int mr_35399 = v__ast__TypeSymbol_str_method_info(sym); + bool sym_has_str_method = mr_35399.arg0; + bool str_method_expects_ptr = mr_35399.arg1; + string sftyp = v__gen__c__Gen_typ(g, ftyp_noshared); string field_styp = string_replace(sftyp, _SLIT("*"), _SLIT("")); string _t2; /* if prepend */ if (sym_has_str_method) { string field_fn_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = field_styp}}, {_SLIT("_str"), 0, { .d_c = 0 }}})); - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { field_fn_name = v__gen__c__Gen_generic_fn_name(g, (*sym->info._v__ast__Struct).concrete_types, field_fn_name, false); } _t2 = field_fn_name; } else { - _t2 = v__gen__c__Gen_get_str_fn(g, field.typ); + _t2 = v__gen__c__Gen_get_str_fn(g, ftyp_noshared); } string field_styp_fn_name = _t2; if (!(sym->kind == v__ast__Kind__f32 || sym->kind == v__ast__Kind__f64)) { @@ -67303,13 +65173,13 @@ strings__Builder fn_body; strings__Builder_write_string(&fn_body, str_intp(4, _MOV((StrIntpData[]){{_SLIT("{_SLIT(\""), /*115 &string*/0xfe10, {.d_s = quote_str}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = g_fmt}}, {_SLIT(", {."), /*115 &string*/0xfe10, {.d_s = v__gen__c__data_str(base_fmt)}}, {_SLIT("="), 0, { .d_c = 0 }}}))); } string funcprefix = _SLIT(""); - multi_return_string_bool mr_37770 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); - string func = mr_37770.arg0; - bool caller_should_free = mr_37770.arg1; + multi_return_string_bool mr_36191 = v__gen__c__struct_auto_str_func(sym, field.typ, field_styp_fn_name, field.name, sym_has_str_method, str_method_expects_ptr); + string func = mr_36191.arg0; + bool caller_should_free = mr_36191.arg1; if (Array_v__ast__Type_contains(_const_v__ast__cptr_types, field.typ)) { func = str_intp(2, _MOV((StrIntpData[]){{_SLIT("(voidptr) it."), /*115 &string*/0xfe10, {.d_s = field.name}}, {_SLIT0, 0, { .d_c = 0 }}})); caller_should_free = false; - } else if (v__ast__Type_is_ptr(field.typ)) { + } else if (v__ast__Type_is_ptr(ftyp_noshared)) { funcprefix = /*f*/string__plus(funcprefix, str_intp(2, _MOV((StrIntpData[]){{_SLIT("isnil(it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); funcprefix = /*f*/string__plus(funcprefix, _SLIT(" ? _SLIT(\"nil\") : ")); if (!(sym->kind == v__ast__Kind__struct_ || sym->kind == v__ast__Kind__alias) && !v__ast__Type_is_int_valptr(field.typ) && !v__ast__Type_is_float_valptr(field.typ)) { @@ -67356,51 +65226,161 @@ if (v__gen__c__Gen_gen_str_for_struct_defer_0) { // Defer end } -VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr) { - multi_return_string_string mr_39681 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); - string deref = mr_39681.arg0; +VV_LOCAL_SYMBOL multi_return_string_bool v__gen__c__struct_auto_str_func(v__ast__TypeSymbol* sym, v__ast__Type _field_type, string fn_name, string field_name, bool has_custom_str, bool expects_ptr) { + v__ast__Type field_type = (v__ast__Type_has_flag(_field_type, v__ast__TypeFlag__shared_f) ? (v__ast__Type_deref(_field_type)) : (_field_type)); + string sufix = (v__ast__Type_has_flag(field_type, v__ast__TypeFlag__shared_f) ? (_SLIT("->val")) : (_SLIT(""))); + multi_return_string_string mr_38270 = v__gen__c__deref_kind(expects_ptr, v__ast__Type_is_ptr(field_type), field_type); + string deref = mr_38270.arg0; if (sym->kind == v__ast__Kind__enum_) { return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (v__gen__c__should_use_indent_func(sym->kind)) { - string obj = str_intp(2, _MOV((StrIntpData[]){{_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, 0, { .d_c = 0 }}})); + string obj = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT0, 0, { .d_c = 0 }}})); if (has_custom_str) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__array || sym->kind == v__ast__Kind__array_fixed || sym->kind == v__ast__Kind__map || sym->kind == v__ast__Kind__sum_type) { + string obj = str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT0, 0, { .d_c = 0 }}})); if (has_custom_str) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; + return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("indent_"), /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = obj}}, {_SLIT(", indent_count + 1)"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__function) { return (multi_return_string_bool){.arg0= str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("()"), 0, { .d_c = 0 }}})), .arg1=true}; + } else if (sym->kind == v__ast__Kind__chan) { + return (multi_return_string_bool){.arg0= str_intp(5, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = sufix}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; } else { - if (sym->kind == v__ast__Kind__chan) { - return (multi_return_string_bool){.arg0= str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT(")"), 0, { .d_c = 0 }}})), .arg1=true}; - } string method_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT("it."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field_name)}}, {_SLIT0, 0, { .d_c = 0 }}})); - bool caller_should_free = false; if (sym->kind == v__ast__Kind__bool) { - method_str = /*f*/string__plus(method_str, _SLIT(" ? _SLIT(\"true\") : _SLIT(\"false\")")); + return (multi_return_string_bool){.arg0= str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" ? _SLIT(\"true\") : _SLIT(\"false\")"), 0, { .d_c = 0 }}})), .arg1=false}; } else if ((v__ast__Type_is_int_valptr(field_type) || v__ast__Type_is_float_valptr(field_type)) && v__ast__Type_is_ptr(field_type) && !expects_ptr) { if (sym->kind == v__ast__Kind__f32) { return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){\n {_SLIT0, "), /*115 &string*/0xfe10, {.d_s = _const_si_g32_code}}, {_SLIT(", {.d_f32 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}\n }))"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__f64) { return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){\n {_SLIT0, "), /*115 &string*/0xfe10, {.d_s = _const_si_g64_code}}, {_SLIT(", {.d_f64 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}\n }))"), 0, { .d_c = 0 }}})), .arg1=true}; } else if (sym->kind == v__ast__Kind__u64) { - v__gen__c__StrIntpType fmt_type = v__gen__c__StrIntpType__si_u64; + StrIntpType fmt_type = StrIntpType__si_u64; return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), /*117 &u32*/0xfe06, {.d_u32 = (((u32)(fmt_type)) | 0xfe00U)}}, {_SLIT(", {.d_u64 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}}))"), 0, { .d_c = 0 }}})), .arg1=true}; } - v__gen__c__StrIntpType fmt_type = v__gen__c__StrIntpType__si_i32; + StrIntpType fmt_type = StrIntpType__si_i32; return (multi_return_string_bool){.arg0= str_intp(3, _MOV((StrIntpData[]){{_SLIT("str_intp(1, _MOV((StrIntpData[]){{_SLIT0, "), /*117 &u32*/0xfe06, {.d_u32 = (((u32)(fmt_type)) | 0xfe00U)}}, {_SLIT(", {.d_i32 = *"), /*115 &string*/0xfe10, {.d_s = method_str}}, {_SLIT(" }}}))"), 0, { .d_c = 0 }}})), .arg1=true}; } - return (multi_return_string_bool){.arg0=method_str, .arg1=caller_should_free}; + return (multi_return_string_bool){.arg0=method_str, .arg1=false}; } return (multi_return_string_bool){0}; } +VV_LOCAL_SYMBOL string v__gen__c__data_str(StrIntpType x) { + string _t2 = (string){.str=(byteptr)"", .is_lit=1}; + switch (x) { + case StrIntpType__si_no_str: + { + _t2 = _SLIT("no_str"); + break; + } + case StrIntpType__si_c: + { + _t2 = _SLIT("d_c"); + break; + } + case StrIntpType__si_u8: + { + _t2 = _SLIT("d_u8"); + break; + } + case StrIntpType__si_i8: + { + _t2 = _SLIT("d_i8"); + break; + } + case StrIntpType__si_u16: + { + _t2 = _SLIT("d_u16"); + break; + } + case StrIntpType__si_i16: + { + _t2 = _SLIT("d_i16"); + break; + } + case StrIntpType__si_u32: + { + _t2 = _SLIT("d_u32"); + break; + } + case StrIntpType__si_i32: + { + _t2 = _SLIT("d_i32"); + break; + } + case StrIntpType__si_u64: + { + _t2 = _SLIT("d_u64"); + break; + } + case StrIntpType__si_i64: + { + _t2 = _SLIT("d_i64"); + break; + } + case StrIntpType__si_f32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_f64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_g32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_g64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_e32: + { + _t2 = _SLIT("d_f32"); + break; + } + case StrIntpType__si_e64: + { + _t2 = _SLIT("d_f64"); + break; + } + case StrIntpType__si_s: + { + _t2 = _SLIT("d_s"); + break; + } + case StrIntpType__si_p: + { + _t2 = _SLIT("d_p"); + break; + } + case StrIntpType__si_vp: + { + _t2 = _SLIT("d_vp"); + break; + } + } + string _t1 = _t2; + return _t1; +} + +VV_LOCAL_SYMBOL bool v__gen__c__should_use_indent_func(v__ast__Kind kind) { + bool _t1 = (kind == v__ast__Kind__struct_ || kind == v__ast__Kind__alias || kind == v__ast__Kind__array || kind == v__ast__Kind__array_fixed || kind == v__ast__Kind__map || kind == v__ast__Kind__sum_type || kind == v__ast__Kind__interface_); + return _t1; +} + VV_LOCAL_SYMBOL Map_string_bool v__gen__c__string_array_to_map(Array_string a) { - Map_string_bool res = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_bool res = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t1 = 0; _t1 < a.len; ++_t1) { string x = ((string*)a.data)[_t1]; map_set(&res, &(string[]){x}, &(bool[]) { true }); @@ -68537,7 +66517,7 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { for (int ityp = 0; ityp < g->table->type_symbols.len; ++ityp) { v__ast__TypeSymbol* sym = ((v__ast__TypeSymbol**)g->table->type_symbols.data)[ityp]; if (sym->kind == v__ast__Kind__sum_type) { - v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType sum_info = /* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; if (sum_info.is_generic) { continue; } @@ -68586,10 +66566,10 @@ void v__gen__c__Gen_write_typeof_functions(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("}")); } else if (sym->kind == v__ast__Kind__interface_) { - if ((sym->info)._typ != 475 /* v.ast.Interface */) { + if ((sym->info)._typ != 477 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((sym->info)._v__ast__Interface,(sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -68957,7 +66937,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_chan_push_optional_fns(v__gen__c__Gen* VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type typ, bool is_prefix_struct) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); string styp = sym->cname; - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { string sgtyps = _SLIT("_T"); for (int _t1 = 0; _t1 < (*sym->info._v__ast__Struct).generic_types.len; ++_t1) { @@ -68968,7 +66948,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { if ((*sym->info._v__ast__Interface).is_generic) { string sgtyps = _SLIT("_T"); for (int _t2 = 0; _t2 < (*sym->info._v__ast__Interface).generic_types.len; ++_t2) { @@ -68979,7 +66959,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty styp = /*f*/string__plus(styp, sgtyps); } } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { string sgtyps = _SLIT("_T"); for (int _t3 = 0; _t3 < (*sym->info._v__ast__SumType).generic_types.len; ++_t3) { @@ -68997,7 +66977,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_cc_type(v__gen__c__Gen* g, v__ast__Type ty if (is_prefix_struct && sym->language == v__ast__Language__c) { styp = string_substr(styp, 3, (styp).len); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (!info.is_typedef) { styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct "), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT0, 0, { .d_c = 0 }}})); } @@ -69026,20 +67006,20 @@ void v__gen__c__Gen_write_typedef_types(v__gen__c__Gen* g) { } if (sym->kind == (v__ast__Kind__array)) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (elem_sym->kind != v__ast__Kind__placeholder && !v__ast__Type_has_flag(info.elem_type, v__ast__TypeFlag__generic)) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef array "), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } else if (sym->kind == (v__ast__Kind__array_fixed)) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, info.elem_type); if (v__ast__TypeSymbol_is_builtin(elem_sym)) { string styp = sym->cname; string len = string_after(styp, _SLIT("_")); string fixed = v__gen__c__Gen_typ(g, info.elem_type); - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed = strings__Builder_cut_to(&g->out, pos); @@ -69101,7 +67081,7 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast bool is_c_parent = parent->name.len > 2 && string_at(parent->name, 0) == 'C' && string_at(parent->name, 1) == '.'; bool is_typedef = false; bool is_fixed_array_of_non_builtin = false; - if ((parent->info)._typ == 457 /* v.ast.Struct */) { + if ((parent->info)._typ == 459 /* v.ast.Struct */) { is_typedef = (*parent->info._v__ast__Struct).is_typedef; } string parent_styp = parent->cname; @@ -69112,10 +67092,10 @@ void v__gen__c__Gen_write_alias_typesymbol_declaration(v__gen__c__Gen* g, v__ast parent_styp = string_substr(parent->cname, 3, (parent->cname).len); } } else { - if ((sym.info)._typ == 472 /* v.ast.Alias */) { + if ((sym.info)._typ == 474 /* v.ast.Alias */) { parent_styp = v__gen__c__Gen_typ(g, (*sym.info._v__ast__Alias).parent_type); v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym.info._v__ast__Alias).parent_type); - if ((parent_sym->info)._typ == 480 /* v.ast.ArrayFixed */) { + if ((parent_sym->info)._typ == 482 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*parent_sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym)) { is_fixed_array_of_non_builtin = true; @@ -69139,10 +67119,10 @@ void v__gen__c__Gen_write_interface_typedef(v__gen__c__Gen* g, v__ast__TypeSymbo } void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - if ((sym.info)._typ != 475 /* v.ast.Interface */) { + if ((sym.info)._typ != 477 /* v.ast.Interface */) { return; } - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((sym.info)._v__ast__Interface,(sym.info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (info.is_generic) { return; } @@ -69171,7 +67151,7 @@ void v__gen__c__Gen_write_interface_typesymbol_declaration(v__gen__c__Gen* g, v_ } void v__gen__c__Gen_write_fn_typesymbol_declaration(v__gen__c__Gen* g, v__ast__TypeSymbol sym) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym.info)._v__ast__FnType,(sym.info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; v__ast__Fn func = info.func; bool is_fn_sig = (func.name).len == 0; bool not_anon = !info.is_anon; @@ -69308,7 +67288,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts(v__gen__c__Gen* g, Array_v__ast__Stmt } VV_LOCAL_SYMBOL bool v__gen__c__is_noreturn_callexpr(v__ast__Expr expr) { - if ((expr)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 295 /* v.ast.CallExpr */) { bool _t1 = (*expr._v__ast__CallExpr).is_noreturn; return _t1; } @@ -69327,8 +67307,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ if (g->inside_if_optional || g->inside_match_optional) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); g->skip_stmt_pos = true; - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { - if ((*stmt._v__ast__ExprStmt).typ == _const_v__ast__error_type_idx || ((*stmt._v__ast__ExprStmt).expr)._typ == 319 /* v.ast.None */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { + if ((*stmt._v__ast__ExprStmt).typ == _const_v__ast__error_type_idx || ((*stmt._v__ast__ExprStmt).expr)._typ == 321 /* v.ast.None */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_var}}, {_SLIT(".state = 2;"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = tmp_var}}, {_SLIT(".err = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*stmt._v__ast__ExprStmt).expr); @@ -69353,7 +67333,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); g->skip_stmt_pos = true; bool is_noreturn = false; - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { is_noreturn = v__gen__c__is_noreturn_callexpr((*stmt._v__ast__ExprStmt).expr); } if (!is_noreturn) { @@ -69366,7 +67346,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ } } else { v__gen__c__Gen_stmt(g, stmt); - if ((g->inside_if_optional || g->inside_match_optional) && (stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((g->inside_if_optional || g->inside_match_optional) && (stmt)._typ == 349 /* v.ast.ExprStmt */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } @@ -69385,10 +67365,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmts_with_tmp_var(v__gen__c__Gen* g, Array_ if ((stmt)._typ != 220 /* v.ast.FnDecl */ && g->inside_ternary == 0) { v__token__Pos stmt_pos = (*(stmt.pos)); if (stmt_pos.pos == 0) { - if ((stmt)._typ == 357 /* v.ast.Module */) { + if ((stmt)._typ == 359 /* v.ast.Module */) { return; } - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { stmt_pos = v__ast__Expr_pos((*stmt._v__ast__ExprStmt).expr); } if (stmt_pos.pos == 0) { @@ -69413,21 +67393,21 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { if (!g->skip_stmt_pos) { v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); } - if (node._typ == 345 /* v.ast.EmptyStmt */) { + if (node._typ == 347 /* v.ast.EmptyStmt */) { } - else if (node._typ == 337 /* v.ast.AsmStmt */) { + else if (node._typ == 339 /* v.ast.AsmStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AsmStmt).pos); v__gen__c__Gen_gen_asm_stmt(g, (*node._v__ast__AsmStmt)); } - else if (node._typ == 338 /* v.ast.AssertStmt */) { + else if (node._typ == 340 /* v.ast.AssertStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssertStmt).pos); v__gen__c__Gen_gen_assert_stmt(g, (*node._v__ast__AssertStmt)); } - else if (node._typ == 339 /* v.ast.AssignStmt */) { + else if (node._typ == 341 /* v.ast.AssignStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__AssignStmt).pos); v__gen__c__Gen_gen_assign_stmt(g, (*node._v__ast__AssignStmt)); } - else if (node._typ == 340 /* v.ast.Block */) { + else if (node._typ == 342 /* v.ast.Block */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__Block).pos); if ((*node._v__ast__Block).is_unsafe) { v__gen__c__Gen_writeln(g, _SLIT("{ // Unsafe block")); @@ -69437,7 +67417,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_stmts(g, (*node._v__ast__Block).stmts); v__gen__c__Gen_writeln(g, _SLIT("}")); } - else if (node._typ == 341 /* v.ast.BranchStmt */) { + else if (node._typ == 343 /* v.ast.BranchStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__BranchStmt).pos); if (((*node._v__ast__BranchStmt).label).len != 0) { v__ast__Stmt** _t2 = (v__ast__Stmt**)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->labeled_loops), &(string[]){(*node._v__ast__BranchStmt).label})); @@ -69456,17 +67436,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } v__ast__Stmt* x = *(v__ast__Stmt**)_t1.data; - if (x->_typ == 348 /* v.ast.ForCStmt */) { + if (x->_typ == 350 /* v.ast.ForCStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForCStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (x->_typ == 349 /* v.ast.ForInStmt */) { + else if (x->_typ == 351 /* v.ast.ForInStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForInStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (x->_typ == 350 /* v.ast.ForStmt */) { + else if (x->_typ == 352 /* v.ast.ForStmt */) { if (v__ast__Scope_contains((*x->_v__ast__ForStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } @@ -69482,17 +67462,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } else { v__ast__Stmt* inner_loop = g->inner_loop; - if (inner_loop->_typ == 348 /* v.ast.ForCStmt */) { + if (inner_loop->_typ == 350 /* v.ast.ForCStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForCStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (inner_loop->_typ == 349 /* v.ast.ForInStmt */) { + else if (inner_loop->_typ == 351 /* v.ast.ForInStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForInStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } } - else if (inner_loop->_typ == 350 /* v.ast.ForStmt */) { + else if (inner_loop->_typ == 352 /* v.ast.ForStmt */) { if (v__ast__Scope_contains((*inner_loop->_v__ast__ForStmt).scope, g->cur_lock.pos.pos)) { v__gen__c__Gen_unlock_locks(g); } @@ -69508,40 +67488,40 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.token.Kind*/0xfe10, {.d_s = v__token__Kind_str((*node._v__ast__BranchStmt).kind)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 343 /* v.ast.ConstDecl */) { + else if (node._typ == 345 /* v.ast.ConstDecl */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__ConstDecl).pos); v__gen__c__Gen_const_decl(g, (*node._v__ast__ConstDecl)); } - else if (node._typ == 342 /* v.ast.ComptimeFor */) { + else if (node._typ == 344 /* v.ast.ComptimeFor */) { v__gen__c__Gen_comptime_for(g, (*node._v__ast__ComptimeFor)); } - else if (node._typ == 344 /* v.ast.DeferStmt */) { + else if (node._typ == 346 /* v.ast.DeferStmt */) { v__ast__DeferStmt defer_stmt = (*node._v__ast__DeferStmt); defer_stmt.ifdef = g->defer_ifdef; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_defer_flag_var(g, (voidptr)&/*qq*/defer_stmt)}}, {_SLIT(" = true;"), 0, { .d_c = 0 }}}))); array_push((array*)&g->defer_stmts, _MOV((v__ast__DeferStmt[]){ defer_stmt })); } - else if (node._typ == 346 /* v.ast.EnumDecl */) { + else if (node._typ == 348 /* v.ast.EnumDecl */) { v__gen__c__Gen_enum_decl(g, (*node._v__ast__EnumDecl)); } - else if (node._typ == 347 /* v.ast.ExprStmt */) { + else if (node._typ == 349 /* v.ast.ExprStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__ExprStmt).pos); bool old_is_void_expr_stmt = g->is_void_expr_stmt; g->is_void_expr_stmt = !(*node._v__ast__ExprStmt).is_expr; - if (!v__ast__Type_alias_eq((*node._v__ast__ExprStmt).typ, _const_v__ast__void_type) && g->expected_cast_type != 0 && ((*node._v__ast__ExprStmt).expr)._typ != 317 /* v.ast.MatchExpr */) { + if (!v__ast__Type_alias_eq((*node._v__ast__ExprStmt).typ, _const_v__ast__void_type) && g->expected_cast_type != 0 && ((*node._v__ast__ExprStmt).expr)._typ != 319 /* v.ast.MatchExpr */) { v__gen__c__Gen_expr_with_cast(g, (*node._v__ast__ExprStmt).expr, (*node._v__ast__ExprStmt).typ, g->expected_cast_type); } else { v__gen__c__Gen_expr(g, (*node._v__ast__ExprStmt).expr); } g->is_void_expr_stmt = old_is_void_expr_stmt; - if (g->inside_ternary == 0 && !g->inside_if_optional && !g->inside_match_optional && !(*node._v__ast__ExprStmt).is_expr && ((*node._v__ast__ExprStmt).expr)._typ != 308 /* v.ast.IfExpr */) { + if (g->inside_ternary == 0 && !g->inside_if_optional && !g->inside_match_optional && !(*node._v__ast__ExprStmt).is_expr && ((*node._v__ast__ExprStmt).expr)._typ != 310 /* v.ast.IfExpr */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } else if (node._typ == 220 /* v.ast.FnDecl */) { v__gen__c__Gen_fn_decl(g, (*node._v__ast__FnDecl)); } - else if (node._typ == 348 /* v.ast.ForCStmt */) { + else if (node._typ == 350 /* v.ast.ForCStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForCStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -69555,7 +67535,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForCStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 349 /* v.ast.ForInStmt */) { + else if (node._typ == 351 /* v.ast.ForInStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForInStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -69569,7 +67549,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForInStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 350 /* v.ast.ForStmt */) { + else if (node._typ == 352 /* v.ast.ForStmt */) { int prev_branch_parent_pos = g->branch_parent_pos; g->branch_parent_pos = (*node._v__ast__ForStmt).pos.pos; v__ast__Stmt* save_inner_loop = g->inner_loop; @@ -69583,17 +67563,17 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { map_delete(&g->labeled_loops, &(string[]){(*node._v__ast__ForStmt).label}); g->inner_loop = save_inner_loop; } - else if (node._typ == 351 /* v.ast.GlobalDecl */) { + else if (node._typ == 353 /* v.ast.GlobalDecl */) { v__gen__c__Gen_global_decl(g, (*node._v__ast__GlobalDecl)); } - else if (node._typ == 352 /* v.ast.GotoLabel */) { + else if (node._typ == 354 /* v.ast.GotoLabel */) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*node._v__ast__GotoLabel).name)}}, {_SLIT(": {}"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 353 /* v.ast.GotoStmt */) { + else if (node._typ == 355 /* v.ast.GotoStmt */) { v__gen__c__Gen_write_v_source_line_info(g, (*node._v__ast__GotoStmt).pos); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("goto "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name((*node._v__ast__GotoStmt).name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 354 /* v.ast.HashStmt */) { + else if (node._typ == 356 /* v.ast.HashStmt */) { int line_nr = (*node._v__ast__HashStmt).pos.line_nr + 1; string ct_condition = _SLIT(""); if ((*node._v__ast__HashStmt).ct_conds.len > 0) { @@ -69661,11 +67641,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } } - else if (node._typ == 355 /* v.ast.Import */) { + else if (node._typ == 357 /* v.ast.Import */) { } - else if (node._typ == 356 /* v.ast.InterfaceDecl */) { + else if (node._typ == 358 /* v.ast.InterfaceDecl */) { v__ast__TypeSymbol* ts = v__ast__Table_sym(g->table, (*node._v__ast__InterfaceDecl).typ); - if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ).is_generic) { + if (!(/* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ).is_generic) { for (int _t4 = 0; _t4 < (*node._v__ast__InterfaceDecl).methods.len; ++_t4) { v__ast__FnDecl method = ((v__ast__FnDecl*)(*node._v__ast__InterfaceDecl).methods.data)[_t4]; if (v__ast__Type_has_flag(method.return_type, v__ast__TypeFlag__optional)) { @@ -69677,19 +67657,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { } } } - else if (node._typ == 357 /* v.ast.Module */) { + else if (node._typ == 359 /* v.ast.Module */) { g->is_builtin_mod = v__util__module_is_builtin((*node._v__ast__Module).name); g->cur_mod = (*node._v__ast__Module); } - else if (node._typ == 318 /* v.ast.NodeError */) { + else if (node._typ == 320 /* v.ast.NodeError */) { } - else if (node._typ == 358 /* v.ast.Return */) { + else if (node._typ == 360 /* v.ast.Return */) { v__gen__c__Gen_return_stmt(g, (*node._v__ast__Return)); } - else if (node._typ == 359 /* v.ast.SqlStmt */) { + else if (node._typ == 361 /* v.ast.SqlStmt */) { v__gen__c__Gen_sql_stmt(g, (*node._v__ast__SqlStmt)); } - else if (node._typ == 360 /* v.ast.StructDecl */) { + else if (node._typ == 362 /* v.ast.StructDecl */) { string name = ((*node._v__ast__StructDecl).language == v__ast__Language__c ? (v__util__no_dots((*node._v__ast__StructDecl).name)) : (string__eq((*node._v__ast__StructDecl).name, _SLIT("array")) || string__eq((*node._v__ast__StructDecl).name, _SLIT("string"))) ? ((*node._v__ast__StructDecl).name) : (v__gen__c__c_name((*node._v__ast__StructDecl).name))); if ((*node._v__ast__StructDecl).language == v__ast__Language__c) { return; @@ -69700,7 +67680,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_stmt(v__gen__c__Gen* g, v__ast__Stmt node) { strings__Builder_writeln(&g->typedefs, str_intp(3, _MOV((StrIntpData[]){{_SLIT("typedef struct "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 284 /* v.ast.TypeDecl */) { + else if (node._typ == 286 /* v.ast.TypeDecl */) { if (!g->pref->skip_unused) { v__gen__c__Gen_writeln(g, _SLIT("// TypeDecl")); } @@ -69783,8 +67763,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_sumtype_casting_fn(v__gen__c__Gen* g, strings__Builder_writeln(&sb, str_intp(5, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = embed_name}}, {_SLIT("_ptr = memdup("), /*115 &string*/0xfe10, {.d_s = accessor}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = embed_cname}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } strings__Builder_write_string(&sb, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = exp_cname}}, {_SLIT("){ ._"), /*115 &string*/0xfe10, {.d_s = got_cname}}, {_SLIT(" = ptr, ._typ = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_type_sidx(g, got)}}, {_SLIT0, 0, { .d_c = 0 }}}))); - for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ).fields.len; ++_t3) { - v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ).fields.data)[_t3]; + for (int _t3 = 0; _t3 < (/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).fields.len; ++_t3) { + v__ast__StructField field = ((v__ast__StructField*)(/* as */ *(v__ast__SumType*)__as_cast((exp_sym->info)._v__ast__SumType,(exp_sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).fields.data)[_t3]; string ptr = _SLIT("ptr"); string type_cname = got_cname; _option_multi_return_v__ast__StructField_Array_v__ast__Type _t4 = v__ast__Table_find_field_from_embeds(g->table, got_sym, field.name); @@ -69819,7 +67799,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_cfn_for_casting_expr(v__gen__c__Gen* g, } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fname}}, {_SLIT("("), 0, { .d_c = 0 }}}))); if (!got_is_ptr) { - if (!v__ast__Expr_is_lvalue(expr) || ((expr)._typ == 307 /* v.ast.Ident */ && v__ast__ScopeObject_is_simple_define_const((/* as */ *(v__ast__Ident*)__as_cast((expr)._v__ast__Ident,(expr)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).obj))) { + if (!v__ast__Expr_is_lvalue(expr) || ((expr)._typ == 309 /* v.ast.Ident */ && v__ast__ScopeObject_is_simple_define_const((/* as */ *(v__ast__Ident*)__as_cast((expr)._v__ast__Ident,(expr)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).obj))) { string promotion_macro_name = (string_contains(fname, _SLIT("_to_sumtype_")) ? (_SLIT("ADDR")) : (_SLIT("HEAP"))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = promotion_macro_name}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = got_styp}}, {_SLIT(", ("), 0, { .d_c = 0 }}}))); rparen_n += 2; @@ -69847,8 +67827,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_expr(g, expr); return; } - if ((exp_sym->info)._typ == 475 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { - if ((expr)._typ == 332 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { + if ((exp_sym->info)._typ == 477 /* v.ast.Interface */ && v__ast__Type_idx(got_type) != v__ast__Type_idx(expected_type) && !v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional)) { + if ((expr)._typ == 334 /* v.ast.StructInit */ && !v__ast__Type_is_ptr(got_type)) { g->inside_cast_in_heap++; string got_styp = v__gen__c__Gen_cc_type(g, v__ast__Type_ref(got_type), true); string exp_styp = exp_sym->cname; @@ -69888,7 +67868,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex if (v__ast__Table_sumtype_has_variant(g->table, expected_deref_type, got_deref_type, false)) { bool is_already_sum_type = false; v__ast__Scope* scope = v__ast__Scope_innermost(g->file->scope, v__ast__Expr_pos(expr).pos); - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { _option_v__ast__Var_ptr _t1; if (_t1 = v__ast__Scope_find_var(scope, (*expr._v__ast__Ident).name), _t1.state == 0) { v__ast__Var* v = *(v__ast__Var**)_t1.data; @@ -69896,7 +67876,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex is_already_sum_type = true; } } - } else if ((expr)._typ == 327 /* v.ast.SelectorExpr */) { + } else if ((expr)._typ == 329 /* v.ast.SelectorExpr */) { _option_v__ast__ScopeStructField _t2; if (_t2 = v__ast__Scope_find_struct_field(scope, v__ast__Expr_str((*expr._v__ast__SelectorExpr).expr), (*expr._v__ast__SelectorExpr).expr_type, (*expr._v__ast__SelectorExpr).field_name), _t2.state == 0) { is_already_sum_type = true; @@ -69906,7 +67886,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex g->prevent_sum_type_unwrapping_once = true; v__gen__c__Gen_expr(g, expr); } else { - if ((unwrapped_got_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((unwrapped_got_sym->info)._typ == 472 /* v.ast.Aggregate */) { unwrapped_got_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*unwrapped_got_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); unwrapped_got_sym = v__ast__Table_sym(g->table, unwrapped_got_type); } @@ -69944,7 +67924,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_write(g, _SLIT("->val")); return; } - if (got_is_ptr && !expected_is_ptr && neither_void && exp_sym->kind != v__ast__Kind__placeholder && (expr)._typ != 311 /* v.ast.InfixExpr */) { + if (got_is_ptr && !expected_is_ptr && neither_void && exp_sym->kind != v__ast__Kind__placeholder && (expr)._typ != 313 /* v.ast.InfixExpr */) { v__ast__Type got_deref_type = v__ast__Type_deref(got_type); v__ast__TypeSymbol* deref_sym = v__ast__Table_sym(g->table, got_deref_type); bool deref_will_match = (v__ast__Type_alias_eq(expected_type, got_type) || v__ast__Type_alias_eq(expected_type, got_deref_type) || v__ast__Type_alias_eq(expected_type, deref_sym->parent_idx)); @@ -69953,11 +67933,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr_with_cast(v__gen__c__Gen* g, v__ast__Ex v__gen__c__Gen_write(g, _SLIT("*")); } } - if (v__ast__Type_has_flag(expected_type, v__ast__TypeFlag__optional) && (expr)._typ == 319 /* v.ast.None */) { - v__gen__c__Gen_gen_optional_error(g, expected_type, expr); - return; - } - if ((expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((expr)._typ == 314 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(expected_type, _const_v__ast__u64_type) || v__ast__Type_alias_eq(expected_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(expected_type, _const_v__ast__u16_type)) && string_at((*expr._v__ast__IntegerLiteral).val, 0) != '-') { v__gen__c__Gen_expr(g, expr); v__gen__c__Gen_write(g, _SLIT("U")); @@ -70041,7 +68017,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmS } for (int i = 0; i < _v_template.args.len; ++i) { v__ast__AsmArg arg = ((v__ast__AsmArg*)_v_template.args.data)[i]; - if (stmt.arch == v__pref__Arch__amd64 && (string__eq(_v_template.name, _SLIT("call")) || string_at(_v_template.name, 0) == 'j') && (arg)._typ == 362 /* v.ast.AsmRegister */) { + if (stmt.arch == v__pref__Arch__amd64 && (string__eq(_v_template.name, _SLIT("call")) || string_at(_v_template.name, 0) == 'j') && (arg)._typ == 364 /* v.ast.AsmRegister */) { v__gen__c__Gen_write(g, _SLIT("*")); } v__gen__c__Gen_asm_arg(g, arg, stmt); @@ -70093,7 +68069,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_asm_stmt(v__gen__c__Gen* g, v__ast__AsmS } VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg arg, v__ast__AsmStmt stmt) { - if (arg._typ == 438 /* v.ast.AsmAlias */) { + if (arg._typ == 440 /* v.ast.AsmAlias */) { string name = (*arg._v__ast__AsmAlias).name; bool _t1 = (Array_string_contains(stmt.local_labels, name) || Array_string_contains(stmt.global_labels, name) || Array_string_contains(g->file->global_labels, name) || stmt.is_basic); Array_string _t3 = {0}; @@ -70128,29 +68104,29 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%["), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("]"), 0, { .d_c = 0 }}}))); } } - else if (arg._typ == 296 /* v.ast.CharLiteral */) { + else if (arg._typ == 298 /* v.ast.CharLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("'"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__CharLiteral).val}}, {_SLIT("'"), 0, { .d_c = 0 }}}))); } - else if (arg._typ == 312 /* v.ast.IntegerLiteral */) { + else if (arg._typ == 314 /* v.ast.IntegerLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__IntegerLiteral).val}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 305 /* v.ast.FloatLiteral */) { + else if (arg._typ == 307 /* v.ast.FloatLiteral */) { if (g->pref->nofloat) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*100 &int*/0xfe07, {.d_i32 = string_int((*arg._v__ast__FloatLiteral).val)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__FloatLiteral).val}}, {_SLIT0, 0, { .d_c = 0 }}}))); } } - else if (arg._typ == 291 /* v.ast.BoolLiteral */) { + else if (arg._typ == 293 /* v.ast.BoolLiteral */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("$"), /*115 &string*/0xfe10, {.d_s = bool_str((*arg._v__ast__BoolLiteral).val)}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 362 /* v.ast.AsmRegister */) { + else if (arg._typ == 364 /* v.ast.AsmRegister */) { if (!stmt.is_basic) { v__gen__c__Gen_write(g, _SLIT("%")); } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__AsmRegister).name}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (arg._typ == 437 /* v.ast.AsmAddressing */) { + else if (arg._typ == 439 /* v.ast.AsmAddressing */) { if (((*arg._v__ast__AsmAddressing).segment).len != 0) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("%%"), /*115 &string*/0xfe10, {.d_s = (*arg._v__ast__AsmAddressing).segment}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -70181,10 +68157,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar } case v__ast__AddressingMode__index_times_scale_plus_displacement: { - if ((displacement)._typ == 439 /* v.ast.AsmDisp */) { + if ((displacement)._typ == 441 /* v.ast.AsmDisp */) { v__gen__c__Gen_asm_arg(g, displacement, stmt); v__gen__c__Gen_write(g, _SLIT("(, ")); - } else if ((displacement)._typ == 362 /* v.ast.AsmRegister */) { + } else if ((displacement)._typ == 364 /* v.ast.AsmRegister */) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_asm_arg(g, displacement, stmt); v__gen__c__Gen_write(g, _SLIT(",")); @@ -70233,7 +68209,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_asm_arg(v__gen__c__Gen* g, v__ast__AsmArg ar } ; } - else if (arg._typ == 439 /* v.ast.AsmDisp */) { + else if (arg._typ == 441 /* v.ast.AsmDisp */) { v__gen__c__Gen_write(g, (*arg._v__ast__AsmDisp).val); } else if (arg._typ == 20 /* string */) { @@ -70303,7 +68279,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_ternary_name(v__gen__c__Gen* g, string } VV_LOCAL_SYMBOL bool v__gen__c__Gen_gen_clone_assignment(v__gen__c__Gen* g, v__ast__Expr val, v__ast__Type typ, bool add_eq) { - if ((val)._typ != 307 /* v.ast.Ident */ && (val)._typ != 327 /* v.ast.SelectorExpr */) { + if ((val)._typ != 309 /* v.ast.Ident */ && (val)._typ != 329 /* v.ast.SelectorExpr */) { bool _t1 = false; return _t1; } @@ -70322,7 +68298,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_gen_clone_assignment(v__gen__c__Gen* g, v__a if (v__ast__Type_share(typ) == v__ast__ShareType__shared_t) { v__gen__c__Gen_write(g, _SLIT("->val")); } - v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((right_sym->info)._v__ast__Array,(right_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type; int array_depth = v__gen__c__Gen_get_array_depth(g, elem_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = array_depth}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); if (v__ast__Type_share(typ) == v__ast__ShareType__shared_t) { @@ -70372,7 +68348,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_scope_vars2(v__gen__c__Gen* g, v__a } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject obj = (*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { ; if (string__eq((*obj._v__ast__Var).name, g->returned_var_name)) { ; @@ -70428,7 +68404,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_variable(v__gen__c__Gen* g, v__ast_ return; } if (sym->kind == v__ast__Kind__string) { - if (v.expr._typ == 331 /* v.ast.StringLiteral */) { + if (v.expr._typ == 333 /* v.ast.StringLiteral */) { ; } @@ -70596,36 +68572,36 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) g->discard_or_result = false; } v__ast__Expr node = node_; - if (node._typ == 300 /* v.ast.ComptimeType */) { + if (node._typ == 302 /* v.ast.ComptimeType */) { v__gen__c__Gen_error(g, _SLIT("g.expr(): Unhandled ComptimeType"), (*node._v__ast__ComptimeType).pos); VUNREACHABLE(); } - else if (node._typ == 303 /* v.ast.EmptyExpr */) { + else if (node._typ == 305 /* v.ast.EmptyExpr */) { v__gen__c__Gen_error(g, _SLIT("g.expr(): unhandled EmptyExpr"), ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,})); VUNREACHABLE(); } - else if (node._typ == 285 /* v.ast.AnonFn */) { + else if (node._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn(g, (voidptr)&/*qq*/(*node._v__ast__AnonFn)); } - else if (node._typ == 286 /* v.ast.ArrayDecompose */) { + else if (node._typ == 288 /* v.ast.ArrayDecompose */) { v__gen__c__Gen_expr(g, (*node._v__ast__ArrayDecompose).expr); } - else if (node._typ == 287 /* v.ast.ArrayInit */) { + else if (node._typ == 289 /* v.ast.ArrayInit */) { v__gen__c__Gen_array_init(g, (*node._v__ast__ArrayInit), _SLIT("")); } - else if (node._typ == 288 /* v.ast.AsCast */) { + else if (node._typ == 290 /* v.ast.AsCast */) { v__gen__c__Gen_as_cast(g, (*node._v__ast__AsCast)); } - else if (node._typ == 289 /* v.ast.Assoc */) { + else if (node._typ == 291 /* v.ast.Assoc */) { v__gen__c__Gen_assoc(g, (*node._v__ast__Assoc)); } - else if (node._typ == 290 /* v.ast.AtExpr */) { + else if (node._typ == 292 /* v.ast.AtExpr */) { v__gen__c__Gen_comptime_at(g, (*node._v__ast__AtExpr)); } - else if (node._typ == 291 /* v.ast.BoolLiteral */) { + else if (node._typ == 293 /* v.ast.BoolLiteral */) { v__gen__c__Gen_write(g, bool_str((*node._v__ast__BoolLiteral).val)); } - else if (node._typ == 293 /* v.ast.CallExpr */) { + else if (node._typ == 295 /* v.ast.CallExpr */) { v__ast__Type ret_type = ((*node._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent ? ((*node._v__ast__CallExpr).return_type) : (v__ast__Type_clear_flag((*node._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional))); string shared_styp = _SLIT(""); if (g->is_shared && !v__ast__Type_has_flag(ret_type, v__ast__TypeFlag__shared_f)) { @@ -70653,10 +68629,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 294 /* v.ast.CastExpr */) { + else if (node._typ == 296 /* v.ast.CastExpr */) { v__gen__c__Gen_cast_expr(g, (*node._v__ast__CastExpr)); } - else if (node._typ == 295 /* v.ast.ChanInit */) { + else if (node._typ == 297 /* v.ast.ChanInit */) { string elem_typ_str = v__gen__c__Gen_typ(g, (*node._v__ast__ChanInit).elem_type); string noscan = v__gen__c__Gen_check_noscan(g, (*node._v__ast__ChanInit).elem_type); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__new_channel_st"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -70669,52 +68645,52 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, elem_typ_str); v__gen__c__Gen_write(g, _SLIT("))")); } - else if (node._typ == 296 /* v.ast.CharLiteral */) { + else if (node._typ == 298 /* v.ast.CharLiteral */) { v__gen__c__Gen_char_literal(g, (*node._v__ast__CharLiteral)); } - else if (node._typ == 297 /* v.ast.Comment */) { + else if (node._typ == 299 /* v.ast.Comment */) { } - else if (node._typ == 298 /* v.ast.ComptimeCall */) { + else if (node._typ == 300 /* v.ast.ComptimeCall */) { v__gen__c__Gen_comptime_call(g, (voidptr)&/*qq*/(*node._v__ast__ComptimeCall)); } - else if (node._typ == 299 /* v.ast.ComptimeSelector */) { + else if (node._typ == 301 /* v.ast.ComptimeSelector */) { v__gen__c__Gen_comptime_selector(g, (*node._v__ast__ComptimeSelector)); } - else if (node._typ == 301 /* v.ast.ConcatExpr */) { + else if (node._typ == 303 /* v.ast.ConcatExpr */) { v__gen__c__Gen_concat_expr(g, (*node._v__ast__ConcatExpr)); } - else if (node._typ == 292 /* v.ast.CTempVar */) { + else if (node._typ == 294 /* v.ast.CTempVar */) { v__gen__c__Gen_write(g, (*node._v__ast__CTempVar).name); } - else if (node._typ == 302 /* v.ast.DumpExpr */) { + else if (node._typ == 304 /* v.ast.DumpExpr */) { v__gen__c__Gen_dump_expr(g, (*node._v__ast__DumpExpr)); } - else if (node._typ == 304 /* v.ast.EnumVal */) { + else if (node._typ == 306 /* v.ast.EnumVal */) { v__gen__c__Gen_enum_val(g, (*node._v__ast__EnumVal)); } - else if (node._typ == 305 /* v.ast.FloatLiteral */) { + else if (node._typ == 307 /* v.ast.FloatLiteral */) { if (g->pref->nofloat) { v__gen__c__Gen_write(g, int_str(string_int((*node._v__ast__FloatLiteral).val))); } else { v__gen__c__Gen_write(g, (*node._v__ast__FloatLiteral).val); } } - else if (node._typ == 306 /* v.ast.GoExpr */) { + else if (node._typ == 308 /* v.ast.GoExpr */) { v__gen__c__Gen_go_expr(g, (*node._v__ast__GoExpr)); } - else if (node._typ == 307 /* v.ast.Ident */) { + else if (node._typ == 309 /* v.ast.Ident */) { v__gen__c__Gen_ident(g, (*node._v__ast__Ident)); } - else if (node._typ == 308 /* v.ast.IfExpr */) { + else if (node._typ == 310 /* v.ast.IfExpr */) { v__gen__c__Gen_if_expr(g, (*node._v__ast__IfExpr)); } - else if (node._typ == 309 /* v.ast.IfGuardExpr */) { + else if (node._typ == 311 /* v.ast.IfGuardExpr */) { v__gen__c__Gen_write(g, _SLIT("/* guard */")); } - else if (node._typ == 310 /* v.ast.IndexExpr */) { + else if (node._typ == 312 /* v.ast.IndexExpr */) { v__gen__c__Gen_index_expr(g, (*node._v__ast__IndexExpr)); } - else if (node._typ == 311 /* v.ast.InfixExpr */) { + else if (node._typ == 313 /* v.ast.InfixExpr */) { if ((*node._v__ast__InfixExpr).op == v__token__Kind__left_shift || (*node._v__ast__InfixExpr).op == v__token__Kind__plus_assign || (*node._v__ast__InfixExpr).op == v__token__Kind__minus_assign) { g->inside_map_infix = true; v__gen__c__Gen_infix_expr(g, (*node._v__ast__InfixExpr)); @@ -70723,7 +68699,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_infix_expr(g, (*node._v__ast__InfixExpr)); } } - else if (node._typ == 312 /* v.ast.IntegerLiteral */) { + else if (node._typ == 314 /* v.ast.IntegerLiteral */) { if (string_starts_with((*node._v__ast__IntegerLiteral).val, _SLIT("0o"))) { v__gen__c__Gen_write(g, _SLIT("0")); v__gen__c__Gen_write(g, string_substr((*node._v__ast__IntegerLiteral).val, 2, ((*node._v__ast__IntegerLiteral).val).len)); @@ -70734,7 +68710,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, (*node._v__ast__IntegerLiteral).val); } } - else if (node._typ == 313 /* v.ast.IsRefType */) { + else if (node._typ == 315 /* v.ast.IsRefType */) { v__ast__Type typ = (v__ast__Type_alias_eq((*node._v__ast__IsRefType).typ, g->field_data_type) ? (g->comptime_for_field_value.typ) : ((*node._v__ast__IsRefType).typ)); v__ast__Type node_typ = v__gen__c__Gen_unwrap_generic(g, typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node_typ); @@ -70745,7 +68721,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) bool is_ref_type = v__gen__c__Gen_contains_ptr(g, node_typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/*IsRefType*/ "), /*115 &bool*/0xfe10, {.d_s = is_ref_type ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - else if (node._typ == 314 /* v.ast.Likely */) { + else if (node._typ == 316 /* v.ast.Likely */) { if ((*node._v__ast__Likely).is_likely) { v__gen__c__Gen_write(g, _SLIT("_likely_")); } else { @@ -70755,32 +68731,32 @@ 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__Likely).expr); v__gen__c__Gen_write(g, _SLIT(")")); } - else if (node._typ == 315 /* v.ast.LockExpr */) { + else if (node._typ == 317 /* v.ast.LockExpr */) { v__gen__c__Gen_lock_expr(g, (*node._v__ast__LockExpr)); } - else if (node._typ == 316 /* v.ast.MapInit */) { + else if (node._typ == 318 /* v.ast.MapInit */) { v__gen__c__Gen_map_init(g, (*node._v__ast__MapInit)); } - else if (node._typ == 317 /* v.ast.MatchExpr */) { + else if (node._typ == 319 /* v.ast.MatchExpr */) { v__gen__c__Gen_match_expr(g, (*node._v__ast__MatchExpr)); } - else if (node._typ == 318 /* v.ast.NodeError */) { + else if (node._typ == 320 /* v.ast.NodeError */) { } - else if (node._typ == 319 /* v.ast.None */) { + else if (node._typ == 321 /* v.ast.None */) { v__gen__c__Gen_write(g, _SLIT("_const_none__")); } - else if (node._typ == 320 /* v.ast.OffsetOf */) { + else if (node._typ == 322 /* v.ast.OffsetOf */) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__OffsetOf).struct_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("/*OffsetOf*/ (u32)(__offsetof("), /*115 &string*/0xfe10, {.d_s = v__util__no_dots(styp)}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__OffsetOf).field}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 321 /* v.ast.OrExpr */) { + else if (node._typ == 323 /* v.ast.OrExpr */) { } - else if (node._typ == 322 /* v.ast.ParExpr */) { + else if (node._typ == 324 /* v.ast.ParExpr */) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_expr(g, (*node._v__ast__ParExpr).expr); v__gen__c__Gen_write(g, _SLIT(")")); } - else if (node._typ == 323 /* v.ast.PostfixExpr */) { + else if (node._typ == 325 /* v.ast.PostfixExpr */) { if (((*node._v__ast__PostfixExpr).auto_locked).len != 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_lock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx);"), 0, { .d_c = 0 }}}))); } @@ -70799,7 +68775,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sync__RwMutex_unlock(&"), /*115 &string*/0xfe10, {.d_s = (*node._v__ast__PostfixExpr).auto_locked}}, {_SLIT("->mtx)"), 0, { .d_c = 0 }}}))); } } - else if (node._typ == 324 /* v.ast.PrefixExpr */) { + else if (node._typ == 326 /* v.ast.PrefixExpr */) { bool gen_or = (*node._v__ast__PrefixExpr).op == v__token__Kind__arrow && ((*node._v__ast__PrefixExpr).or_block.kind != v__ast__OrKind__absent || (*node._v__ast__PrefixExpr).is_option); if ((*node._v__ast__PrefixExpr).op == v__token__Kind__amp) { g->is_amp = true; @@ -70807,7 +68783,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) if ((*node._v__ast__PrefixExpr).op == v__token__Kind__arrow) { string styp = v__gen__c__Gen_typ(g, (*node._v__ast__PrefixExpr).right_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, (*node._v__ast__PrefixExpr).right_type); - v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 481) /*expected idx: 481, name: v.ast.Chan */ ; + v__ast__Chan right_inf = /* as */ *(v__ast__Chan*)__as_cast((right_sym->info)._v__ast__Chan,(right_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ; v__ast__Type elem_type = right_inf.elem_type; bool is_gen_or_and_assign_rhs = gen_or && !g->discard_or_result; string _t1; /* if prepend */ @@ -70846,27 +68822,27 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) } g->is_amp = false; } - else if (node._typ == 325 /* v.ast.RangeExpr */) { + else if (node._typ == 327 /* v.ast.RangeExpr */) { } - else if (node._typ == 326 /* v.ast.SelectExpr */) { + else if (node._typ == 328 /* v.ast.SelectExpr */) { v__gen__c__Gen_select_expr(g, (*node._v__ast__SelectExpr)); } - else if (node._typ == 327 /* v.ast.SelectorExpr */) { + else if (node._typ == 329 /* v.ast.SelectorExpr */) { v__gen__c__Gen_selector_expr(g, (*node._v__ast__SelectorExpr)); } - else if (node._typ == 328 /* v.ast.SizeOf */) { + else if (node._typ == 330 /* v.ast.SizeOf */) { v__gen__c__Gen_size_of(g, (*node._v__ast__SizeOf)); } - else if (node._typ == 329 /* v.ast.SqlExpr */) { + else if (node._typ == 331 /* v.ast.SqlExpr */) { v__gen__c__Gen_sql_select_expr(g, (*node._v__ast__SqlExpr)); } - else if (node._typ == 331 /* v.ast.StringLiteral */) { + else if (node._typ == 333 /* v.ast.StringLiteral */) { v__gen__c__Gen_string_literal(g, (*node._v__ast__StringLiteral)); } - else if (node._typ == 330 /* v.ast.StringInterLiteral */) { + else if (node._typ == 332 /* v.ast.StringInterLiteral */) { v__gen__c__Gen_string_inter_literal(g, (*node._v__ast__StringInterLiteral)); } - else if (node._typ == 332 /* v.ast.StructInit */) { + else if (node._typ == 334 /* v.ast.StructInit */) { if ((*node._v__ast__StructInit).unresolved) { v__gen__c__Gen_expr(g, v__ast__resolve_init((*node._v__ast__StructInit), v__gen__c__Gen_unwrap_generic(g, (*node._v__ast__StructInit).typ), g->table)); } else { @@ -70875,16 +68851,16 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_expr(v__gen__c__Gen* g, v__ast__Expr node_) g->inside_struct_init = false; } } - else if (node._typ == 333 /* v.ast.TypeNode */) { + else if (node._typ == 335 /* v.ast.TypeNode */) { v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*node._v__ast__TypeNode).typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); string sidx = v__gen__c__Gen_type_sidx(g, typ); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = sidx}}, {_SLIT(" /* "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" */"), 0, { .d_c = 0 }}}))); } - else if (node._typ == 334 /* v.ast.TypeOf */) { + else if (node._typ == 336 /* v.ast.TypeOf */) { v__gen__c__Gen_typeof_expr(g, (*node._v__ast__TypeOf)); } - else if (node._typ == 335 /* v.ast.UnsafeExpr */) { + else if (node._typ == 337 /* v.ast.UnsafeExpr */) { v__gen__c__Gen_expr(g, (*node._v__ast__UnsafeExpr).expr); } ; @@ -70919,9 +68895,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_type_name(v__gen__c__Gen* g, v__ast__Type ra string s = _SLIT(""); if (sym->kind == v__ast__Kind__function) { if (v__ast__Type_is_ptr(typ)) { - s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ )); + s = string__plus(_SLIT("&"), v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ )); } else { - s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ); + s = v__gen__c__Gen_fn_decl_str(g, /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ); } } else { s = v__ast__Table_type_to_str(g->table, v__gen__c__Gen_unwrap_generic(g, typ)); @@ -70937,11 +68913,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_typeof_expr(v__gen__c__Gen* g, v__ast__TypeO v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")._typ ))")); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed fixed_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; string typ_name = v__ast__Table_get_type_name(g->table, fixed_info.elem_type); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("_SLIT(\"["), /*100 &int*/0xfe07, {.d_i32 = fixed_info.size}}, {_SLIT("]"), /*115 &string*/0xfe10, {.d_s = v__util__strip_main_name(typ_name)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((sym->info)._v__ast__FnType,(sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_SLIT(\""), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_fn_decl_str(g, info)}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); } else if (v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__TypeSymbol* varg_elem_type_sym = v__ast__Table_sym(g->table, v__ast__Table_value_type(g->table, typ)); @@ -70969,10 +68945,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel else if (node.gkind_field == (v__ast__GenericKindField__unknown)) { if (string__eq(node.field_name, _SLIT("name"))) { v__ast__Type name_type = node.name_type; - if ((node.expr)._typ == 334 /* v.ast.TypeOf */) { - if (((*node.expr._v__ast__TypeOf).expr)._typ == 299 /* v.ast.ComptimeSelector */) { - if (((*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 307 /* v.ast.Ident */) { + if ((node.expr)._typ == 336 /* v.ast.TypeOf */) { + if (((*node.expr._v__ast__TypeOf).expr)._typ == 301 /* v.ast.ComptimeSelector */) { + if (((*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 309 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*(*node.expr._v__ast__TypeOf).expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t2 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t1 = {0}; @@ -71006,7 +68982,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_checker_bug(g, _SLIT("unexpected SelectorExpr.expr_type = 0"), node.pos); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - bool is_optional = (node.expr)._typ == 307 /* v.ast.Ident */ && v__ast__Type_has_flag(node.expr_type, v__ast__TypeFlag__optional); + bool is_optional = (node.expr)._typ == 309 /* v.ast.Ident */ && v__ast__Type_has_flag(node.expr_type, v__ast__TypeFlag__optional); if (is_optional) { string opt_base_typ = v__gen__c__Gen_base_type(g, node.expr_type); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("(*("), /*115 &string*/0xfe10, {.d_s = opt_base_typ}}, {_SLIT("*)"), 0, { .d_c = 0 }}}))); @@ -71019,7 +68995,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel v__gen__c__Gen_error(g, _SLIT("field_name should be `len`"), node.pos); VUNREACHABLE(); } - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); return; } else if (sym->kind == v__ast__Kind__chan && (string__eq(node.field_name, _SLIT("len")) || string__eq(node.field_name, _SLIT("closed")))) { @@ -71055,7 +69031,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel string dot = (v__ast__Type_is_ptr(field.typ) ? (_SLIT("->")) : (_SLIT("."))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")"), /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT0, 0, { .d_c = 0 }}}))); } - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { v__ast__TypeSymbol* agg_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); sum_type_deref_field = /*f*/string__plus(sum_type_deref_field, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_"), /*115 &string*/0xfe10, {.d_s = agg_sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -71068,7 +69044,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel } else if (_t4 = v__ast__Table_find_method(g->table, sym, node.field_name), _t4.state == 0) { v__ast__Fn m = *(v__ast__Fn*)_t4.data; bool has_embeds = false; - if ((sym->info)._typ == 457 /* v.ast.Struct */ || (sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 472 /* v.ast.Aggregate */) { if (node.from_embed_types.len > 0) { has_embeds = true; } @@ -71139,7 +69115,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_selector_expr(v__gen__c__Gen* g, v__ast__Sel if (is_optional) { v__gen__c__Gen_write(g, _SLIT(".data)")); } - if ((sym->info)._typ == 457 /* v.ast.Struct */ || (sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */ || (sym->info)._typ == 472 /* v.ast.Aggregate */) { for (int i = 0; i < node.from_embed_types.len; ++i) { v__ast__Type embed = ((v__ast__Type*)node.from_embed_types.data)[i]; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); @@ -71204,7 +69180,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_enum_decl(v__gen__c__Gen* g, v__ast__EnumDec } VV_LOCAL_SYMBOL void v__gen__c__Gen_enum_expr(v__gen__c__Gen* g, v__ast__Expr node) { - if (node._typ == 304 /* v.ast.EnumVal */) { + if (node._typ == 306 /* v.ast.EnumVal */) { v__gen__c__Gen_write(g, (*node._v__ast__EnumVal).val); } @@ -71329,11 +69305,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_108466 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); - string hash_fn = mr_108466.arg0; - string key_eq_fn = mr_108466.arg1; - string clone_fn = mr_108466.arg2; - string free_fn = mr_108466.arg3; + multi_return_string_string_string_string mr_108350 = v__gen__c__Gen_map_fn_ptrs(g, *key_sym); + string hash_fn = mr_108350.arg0; + string key_eq_fn = mr_108350.arg1; + string clone_fn = mr_108350.arg2; + string free_fn = mr_108350.arg3; int size = node.vals.len; string shared_styp = _SLIT(""); string styp = _SLIT(""); @@ -71363,22 +69339,26 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit } if (size > 0) { if (value_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write(g, str_intp(10, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof(voidptr), _MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(8, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof(voidptr),"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_write(g, str_intp(11, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("), _MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(9, _MOV((StrIntpData[]){{_SLIT("new_map_init"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(", "), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT(", sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("),"), 0, { .d_c = 0 }}}))); } + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV(("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); for (int _t1 = 0; _t1 < node.keys.len; ++_t1) { v__ast__Expr expr = ((v__ast__Expr*)node.keys.data)[_t1]; + v__gen__c__Gen_write(g, _SLIT("\t\t\t")); v__gen__c__Gen_expr(g, expr); - v__gen__c__Gen_write(g, _SLIT(", ")); + v__gen__c__Gen_writeln(g, _SLIT(", ")); } + v__gen__c__Gen_writeln(g, _SLIT("\t\t}),")); if (value_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}), _MOV((voidptr["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV((voidptr["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); } else { - v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("}), _MOV(("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t\t_MOV(("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("["), /*100 &int*/0xfe07, {.d_i32 = size}}, {_SLIT("]){"), 0, { .d_c = 0 }}}))); } for (int i = 0; i < node.vals.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.vals.data)[i]; + v__gen__c__Gen_write(g, _SLIT("\t\t\t")); if (v__ast__Expr_is_auto_deref_var(expr)) { v__gen__c__Gen_write(g, _SLIT("*")); } @@ -71387,12 +69367,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_map_init(v__gen__c__Gen* g, v__ast__MapInit } else { v__gen__c__Gen_expr(g, expr); } - v__gen__c__Gen_write(g, _SLIT(", ")); + v__gen__c__Gen_writeln(g, _SLIT(", ")); } - v__gen__c__Gen_write(g, _SLIT("}))")); + v__gen__c__Gen_writeln(g, _SLIT("\t\t})")); + v__gen__c__Gen_writeln(g, _SLIT("\t)")); } else { v__gen__c__Gen_write(g, str_intp(8, _MOV((StrIntpData[]){{_SLIT("new_map"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("(sizeof("), /*115 &string*/0xfe10, {.d_s = key_typ_str}}, {_SLIT("), sizeof("), /*115 &string*/0xfe10, {.d_s = value_typ_str}}, {_SLIT("), "), /*115 &string*/0xfe10, {.d_s = hash_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = key_eq_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = clone_fn}}, {_SLIT(", "), /*115 &string*/0xfe10, {.d_s = free_fn}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } + v__gen__c__Gen_writeln(g, _SLIT("")); if (g->is_shared) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}, sizeof("), /*115 &string*/0xfe10, {.d_s = shared_styp}}, {_SLIT("))"), 0, { .d_c = 0 }}}))); } else if (is_amp) { @@ -71428,12 +69410,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_select_expr(v__gen__c__Gen* g, v__ast__Selec } else if (branch.is_timeout) { has_timeout = true; exception_branch = j; - timeout_expr = (/* as */ *(v__ast__ExprStmt*)__as_cast((branch.stmt)._v__ast__ExprStmt,(branch.stmt)._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ).expr; + timeout_expr = (/* as */ *(v__ast__ExprStmt*)__as_cast((branch.stmt)._v__ast__ExprStmt,(branch.stmt)._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ).expr; } else { - if (branch.stmt._typ == 347 /* v.ast.ExprStmt */) { - v__ast__InfixExpr expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*branch.stmt._v__ast__ExprStmt).expr)._v__ast__InfixExpr,((*branch.stmt._v__ast__ExprStmt).expr)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ; + if (branch.stmt._typ == 349 /* v.ast.ExprStmt */) { + v__ast__InfixExpr expr = /* as */ *(v__ast__InfixExpr*)__as_cast(((*branch.stmt._v__ast__ExprStmt).expr)._v__ast__InfixExpr,((*branch.stmt._v__ast__ExprStmt).expr)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ; array_push((array*)&channels, _MOV((v__ast__Expr[]){ expr.left })); - if ((expr.right)._typ == 307 /* v.ast.Ident */ || (expr.right)._typ == 310 /* v.ast.IndexExpr */ || (expr.right)._typ == 327 /* v.ast.SelectorExpr */ || (expr.right)._typ == 332 /* v.ast.StructInit */) { + if ((expr.right)._typ == 309 /* v.ast.Ident */ || (expr.right)._typ == 312 /* v.ast.IndexExpr */ || (expr.right)._typ == 329 /* v.ast.SelectorExpr */ || (expr.right)._typ == 334 /* v.ast.StructInit */) { array_push((array*)&objs, _MOV((v__ast__Expr[]){ expr.right })); array_push((array*)&tmp_objs, _MOV((string[]){ string_clone(_SLIT("")) })); array_push((array*)&elem_types, _MOV((string[]){ string_clone(_SLIT("")) })); @@ -71446,8 +69428,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_select_expr(v__gen__c__Gen* g, v__ast__Selec } array_push((array*)&is_push, _MOV((bool[]){ true })); } - else if (branch.stmt._typ == 339 /* v.ast.AssignStmt */) { - v__ast__PrefixExpr rec_expr = /* as */ *(v__ast__PrefixExpr*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._v__ast__PrefixExpr,((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._typ, 324) /*expected idx: 324, name: v.ast.PrefixExpr */ ; + else if (branch.stmt._typ == 341 /* v.ast.AssignStmt */) { + v__ast__PrefixExpr rec_expr = /* as */ *(v__ast__PrefixExpr*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._v__ast__PrefixExpr,((*(v__ast__Expr*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right, 0)))._typ, 326) /*expected idx: 326, name: v.ast.PrefixExpr */ ; array_push((array*)&channels, _MOV((v__ast__Expr[]){ rec_expr.right })); array_push((array*)&is_push, _MOV((bool[]){ false })); if ((*branch.stmt._v__ast__AssignStmt).op == v__token__Kind__decl_assign || !v__ast__Type_alias_eq((*(v__ast__Type*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).right_types, 0)), (*(v__ast__Type*)/*ee elem_sym */array_get((*branch.stmt._v__ast__AssignStmt).left_types, 0)))) { @@ -71572,7 +69554,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } v__ast__IdentInfo node_info = node.info; bool is_auto_heap = false; - if ((node_info)._typ == 417 /* v.ast.IdentVar */) { + if ((node_info)._typ == 419 /* v.ast.IdentVar */) { if ((*node_info._v__ast__IdentVar).is_optional && !(g->is_assign_lhs && g->right_is_opt)) { v__gen__c__Gen_write(g, _SLIT("/*opt*/")); string styp = v__gen__c__Gen_base_type(g, (*node_info._v__ast__IdentVar).typ); @@ -71584,7 +69566,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) return; } v__ast__ScopeObject v = node.obj; - if ((v)._typ == 365 /* v.ast.Var */) { + if ((v)._typ == 367 /* v.ast.Var */) { is_auto_heap = (*v._v__ast__Var).is_auto_heap && (!g->is_assign_lhs || g->assign_op != v__token__Kind__decl_assign); if (is_auto_heap) { v__gen__c__Gen_write(g, _SLIT("(*(")); @@ -71609,7 +69591,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) } } string dot = (is_ptr || is_auto_heap ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -71627,7 +69609,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_ident(v__gen__c__Gen* g, v__ast__Ident node) v__gen__c__Gen_write(g, string__plus(_const_v__gen__c__closure_ctx, _SLIT("->"))); } } - } else if ((node_info)._typ == 416 /* v.ast.IdentFn */) { + } else if ((node_info)._typ == 418 /* v.ast.IdentFn */) { if (g->pref->translated || g->file->is_translated) { _option_v__ast__Fn _t2; if (_t2 = v__ast__Table_find_fn(g->table, node.name), _t2.state == 0) { @@ -71668,13 +69650,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.typ); if (sym->kind == v__ast__Kind__sum_type || sym->kind == v__ast__Kind__interface_) { v__gen__c__Gen_expr_with_cast(g, node.expr, node.expr_type, node.typ); - } else if (sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(node.typ) && !(/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).is_typedef) { + } else if (sym->kind == v__ast__Kind__struct_ && !v__ast__Type_is_ptr(node.typ) && !(/* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).is_typedef) { string styp = v__gen__c__Gen_typ(g, node.typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("*(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" *)(&"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT("))")); } else if (sym->kind == v__ast__Kind__alias && v__ast__Table_final_sym(g->table, node.typ)->kind == v__ast__Kind__array_fixed) { - if ((node.expr)._typ == 287 /* v.ast.ArrayInit */ && g->assign_op != v__token__Kind__decl_assign) { + if ((node.expr)._typ == 289 /* v.ast.ArrayInit */ && g->assign_op != v__token__Kind__decl_assign) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*node.expr._v__ast__ArrayInit).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } v__gen__c__Gen_expr(g, node.expr); @@ -71688,10 +69670,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp if ((g->pref->translated || g->file->is_translated) && sym->kind == v__ast__Kind__function) { } string cast_label = _SLIT(""); - if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { + if (sym->kind != v__ast__Kind__alias || !(v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type, node.expr_type) || v__ast__Type_alias_eq((/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type, _const_v__ast__string_type))) { cast_label = str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(")"), 0, { .d_c = 0 }}})); } - if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 319 /* v.ast.None */) { + if (v__ast__Type_has_flag(node.typ, v__ast__TypeFlag__optional) && (node.expr)._typ == 321 /* v.ast.None */) { v__gen__c__Gen_gen_optional_error(g, node.typ, node.expr); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = cast_label}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -71702,7 +69684,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_cast_expr(v__gen__c__Gen* g, v__ast__CastExp } } v__gen__c__Gen_expr(g, node.expr); - if ((node.expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((node.expr)._typ == 314 /* v.ast.IntegerLiteral */) { if (v__ast__Type_alias_eq(node.typ, _const_v__ast__u64_type) || v__ast__Type_alias_eq(node.typ, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.typ, _const_v__ast__u16_type)) { if (!string_starts_with((*node.expr._v__ast__IntegerLiteral).val, _SLIT("-"))) { v__gen__c__Gen_write(g, _SLIT("U")); @@ -71741,7 +69723,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_concat_expr(v__gen__c__Gen* g, v__ast__Conca // Attr: [inline] inline VV_LOCAL_SYMBOL bool v__gen__c__Gen_expr_is_multi_return_call(v__gen__c__Gen* g, v__ast__Expr expr) { - if ((expr)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 295 /* v.ast.CallExpr */) { bool _t1 = v__ast__Table_sym(g->table, (*expr._v__ast__CallExpr).return_type)->kind == v__ast__Kind__multi_return; return _t1; } @@ -71769,7 +69751,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; g->inside_return = true; v__gen__c__Gen_return_stmt_defer_0 = true; if (node.exprs.len > 0) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 298 /* v.ast.ComptimeCall */) { + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 300 /* v.ast.ComptimeCall */) { v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0))); v__gen__c__Gen_writeln(g, _SLIT(";")); // Defer begin @@ -71808,7 +69790,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; string ret_typ = v__gen__c__Gen_typ(g, v__gen__c__Gen_unwrap_generic(g, g->fn_decl->return_type)); bool use_tmp_var = g->defer_stmts.len > 0 || g->defer_profile_code.len > 0 || g->cur_lock.lockeds.len > 0; if (fn_return_is_optional) { - bool optional_none = ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 319 /* v.ast.None */; + bool optional_none = ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 321 /* v.ast.None */; string ftyp = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0))); bool is_regular_option = string__eq(ftyp, _SLIT("_option")); if (optional_none || is_regular_option || (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)) == _const_v__ast__error_type_idx) { @@ -71883,7 +69865,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; } } if (fn_return_is_multi && node.exprs.len > 0 && !v__gen__c__Gen_expr_is_multi_return_call(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))) { - if (node.exprs.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 308 /* v.ast.IfExpr */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 317 /* v.ast.MatchExpr */)) { + if (node.exprs.len == 1 && (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 310 /* v.ast.IfExpr */ || ((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 319 /* v.ast.MatchExpr */)) { 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 = tmpvar}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0))); v__gen__c__Gen_writeln(g, _SLIT(";")); @@ -71897,7 +69879,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, g->fn_decl->return_type); - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((typ_sym->info)._v__ast__MultiReturn,(typ_sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; string styp = _SLIT(""); if (fn_return_is_optional || fn_return_is_result) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -71917,7 +69899,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; for (int i = 0; i < node.exprs.len; ++i) { v__ast__Expr expr = ((v__ast__Expr*)node.exprs.data)[i]; if (v__gen__c__Gen_expr_is_multi_return_call(g, expr)) { - v__ast__CallExpr c = /* as */ *(v__ast__CallExpr*)__as_cast((expr)._v__ast__CallExpr,(expr)._typ, 293) /*expected idx: 293, name: v.ast.CallExpr */ ; + v__ast__CallExpr c = /* as */ *(v__ast__CallExpr*)__as_cast((expr)._v__ast__CallExpr,(expr)._typ, 295) /*expected idx: 295, name: v.ast.CallExpr */ ; v__ast__TypeSymbol* expr_sym = v__ast__Table_sym(g->table, c.return_type); string tmp = v__gen__c__Gen_new_tmp_var(g); if (!v__ast__Type_has_flag(c.return_type, v__ast__TypeFlag__optional)) { @@ -71985,7 +69967,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__ast__TypeSymbol* return_sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0))); v__ast__Expr expr0 = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)); bool _t1 = 0; - if (expr0._typ == 293 /* v.ast.CallExpr */) { + if (expr0._typ == 295 /* v.ast.CallExpr */) { _t1 = v__ast__Type_has_flag((*expr0._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional) && (*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent; } @@ -71998,7 +69980,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("opt_ok2(&("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]) { "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(g->fn_decl->return_type) && v__ast__Type_is_ptr((*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)))) { - if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 307 /* v.ast.Ident */ && !g->is_amp)) { + if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 309 /* v.ast.Ident */ && !g->is_amp)) { v__gen__c__Gen_write(g, _SLIT("*")); } } @@ -72021,7 +70003,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; return; } bool _t2 = 0; - if (expr0._typ == 293 /* v.ast.CallExpr */) { + if (expr0._typ == 295 /* v.ast.CallExpr */) { _t2 = v__ast__Type_has_flag((*expr0._v__ast__CallExpr).return_type, v__ast__TypeFlag__result) && (*expr0._v__ast__CallExpr).or_block.kind == v__ast__OrKind__absent; } @@ -72034,7 +70016,7 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = ret_typ}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmpvar}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__result_name}}, {_SLIT("_ok(&("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("[]) { "), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(g->fn_decl->return_type) && v__ast__Type_is_ptr((*(v__ast__Type*)/*ee elem_sym */array_get(node.types, 0)))) { - if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 307 /* v.ast.Ident */ && !g->is_amp)) { + if (!(((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ == 309 /* v.ast.Ident */ && !g->is_amp)) { v__gen__c__Gen_write(g, _SLIT("*")); } } @@ -72058,13 +70040,13 @@ bool v__gen__c__Gen_return_stmt_defer_0 = false; } if (g->is_autofree) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)); - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { g->returned_var_name = (*expr._v__ast__Ident).name; } } use_tmp_var = use_tmp_var || !g->is_builtin_mod; if (use_tmp_var) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ != 307 /* v.ast.Ident */ || use_tmp_var) { + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(node.exprs, 0)))._typ != 309 /* v.ast.Ident */ || use_tmp_var) { 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 = tmpvar}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); } else { use_tmp_var = false; @@ -72129,7 +70111,7 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; string name = v__gen__c__c_name(field.name); string const_name = (Array_v__ast__Attr_contains(node.attrs, _SLIT("export")) && !g->is_builtin_mod ? ((*(v__ast__Attr*)/*ee elem_sym */array_get(node.attrs, 0)).arg) : (string__plus(_SLIT("_const_"), name))); v__ast__Expr field_expr = field.expr; - if (field.expr._typ == 287 /* v.ast.ArrayInit */) { + if (field.expr._typ == 289 /* v.ast.ArrayInit */) { if ((*field.expr._v__ast__ArrayInit).is_fixed) { string styp = v__gen__c__Gen_typ(g, (*field.expr._v__ast__ArrayInit).typ); if (g->pref->build_mode != v__pref__BuildMode__build_module) { @@ -72142,14 +70124,14 @@ bool v__gen__c__Gen_const_decl_defer_0 = false; v__gen__c__Gen_const_decl_init_later(g, field.mod, name, field.expr, field.typ, false); } } - else if (field.expr._typ == 331 /* v.ast.StringLiteral */) { + else if (field.expr._typ == 333 /* v.ast.StringLiteral */) { strings__Builder_writeln(&g->definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT("; // a string literal, inited later"), 0, { .d_c = 0 }}}))); if (g->pref->build_mode != v__pref__BuildMode__build_module) { string val = v__gen__c__Gen_expr_string(g, field.expr); strings__Builder_writeln(&g->stringliterals, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = const_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } - else if (field.expr._typ == 293 /* v.ast.CallExpr */) { + else if (field.expr._typ == 295 /* v.ast.CallExpr */) { if (v__ast__Type_has_flag((*field.expr._v__ast__CallExpr).return_type, v__ast__TypeFlag__optional)) { g->inside_const_optional = true; bool unwrap_option = (*field.expr._v__ast__CallExpr).or_block.kind != v__ast__OrKind__absent; @@ -72253,7 +70235,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_const_decl_precomputed(v__gen__c__Gen* g, st strings__Builder_writeln(&(*(strings__Builder*)map_get(ADDR(map, g->cleanups), &(string[]){mod}, &(strings__Builder[]){ __new_array(0, 0, sizeof(u8)) })), str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring_free(&"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } - else if (ct_value._typ == 303 /* v.ast.EmptyExpr */) { + else if (ct_value._typ == 305 /* v.ast.EmptyExpr */) { bool _t4 = false; return _t4; } @@ -72340,7 +70322,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_global_decl(v__gen__c__Gen* g, v__ast__Globa } string styp = v__gen__c__Gen_typ(g, field.typ); v__ast__Expr anon_fn_expr = field.expr; - if (field.has_expr && (anon_fn_expr)._typ == 285 /* v.ast.AnonFn */) { + if (field.has_expr && (anon_fn_expr)._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn)); string fn_type_name = v__gen__c__Gen_get_anon_fn_type_name(g, (voidptr)&/*qq*/(*anon_fn_expr._v__ast__AnonFn), field.name); strings__Builder_writeln(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = fn_type_name}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__ast__Table_sym(g->table, field.typ)->name}}, {_SLIT("; // global2"), 0, { .d_c = 0 }}}))); @@ -72377,13 +70359,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_assoc(v__gen__c__Gen* g, v__ast__Assoc node) } string styp = v__gen__c__Gen_typ(g, node.typ); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); - Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int i = 0; i < node.fields.len; ++i) { string field = ((string*)node.fields.data)[i]; map_set(&inited_fields, &(string[]){field}, &(int[]) { i }); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.typ); - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; string field_name = v__gen__c__c_name(field.name); @@ -72424,7 +70407,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_checker_bug(v__gen__c__Gen* g, string s, v__ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_init_function(v__gen__c__Gen* g) { bool v__gen__c__Gen_write_init_function_defer_0 = false; - if (g->pref->no_builtin) { + if (g->pref->no_builtin || (g->pref->translated && g->pref->is_o)) { return; } v__util__timing_start(_SLIT("Gen.write_init_function")); @@ -72562,7 +70545,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->typedefs, _SLIT("typedef struct none none;")); } string name = sym->cname; - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).is_generic) { continue; } @@ -72593,9 +70576,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_148548 = v__gen__c__Gen_optional_type_name(g, field.typ); - string styp = mr_148548.arg0; - string base = mr_148548.arg1; + multi_return_string_string mr_148577 = v__gen__c__Gen_optional_type_name(g, field.typ); + string styp = mr_148577.arg0; + string base = mr_148577.arg1; sync__RwMutex_lock(&g->done_optionals->mtx); /*lock*/ { if (!Array_string_contains(g->done_optionals->val, base)) { @@ -72618,7 +70601,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ size_suffix = _SLIT(" : 1"); } else { v__ast__TypeSymbol* field_sym = v__ast__Table_sym(g->table, field.typ); - if ((field_sym->info)._typ == 486 /* v.ast.Enum */) { + if ((field_sym->info)._typ == 488 /* 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; @@ -72641,9 +70624,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("}"), /*115 &string*/0xfe10, {.d_s = ti_attrs}}, {_SLIT(";\n"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(&g->type_definitions, post_pragma); } - else if (sym->info._typ == 472 /* v.ast.Alias */) { + else if (sym->info._typ == 474 /* v.ast.Alias */) { } - else if (sym->info._typ == 482 /* v.ast.Thread */) { + else if (sym->info._typ == 484 /* v.ast.Thread */) { if (g->pref->os == v__pref__OS__windows) { if (string__eq(name, _SLIT("__v_thread"))) { strings__Builder_writeln(&g->type_definitions, str_intp(2, _MOV((StrIntpData[]){{_SLIT("typedef HANDLE "), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -72659,7 +70642,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ } } } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { if ((*sym->info._v__ast__SumType).is_generic) { continue; } @@ -72689,7 +70672,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ strings__Builder_writeln(&g->type_definitions, _SLIT("};")); strings__Builder_writeln(&g->type_definitions, _SLIT("")); } - else if (sym->info._typ == 480 /* v.ast.ArrayFixed */) { + else if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type); if (!v__ast__TypeSymbol_is_builtin(elem_sym) && !v__ast__Type_has_flag((*sym->info._v__ast__ArrayFixed).elem_type, v__ast__TypeFlag__generic)) { string styp = sym->cname; @@ -72701,7 +70684,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_write_types(v__gen__c__Gen* g, Array_v__ast_ if (string_starts_with(fixed_elem_name, _SLIT("C__"))) { fixed_elem_name = string_substr(fixed_elem_name, 3, (fixed_elem_name).len); } - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { int pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); fixed_elem_name = strings__Builder_cut_to(&g->out, pos); @@ -72737,13 +70720,13 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } Array_string field_deps = __new_array_with_default(0, 0, sizeof(string), 0); - if (sym->info._typ == 480 /* v.ast.ArrayFixed */) { + if (sym->info._typ == 482 /* v.ast.ArrayFixed */) { string dep = v__ast__Table_sym(g->table, (*sym->info._v__ast__ArrayFixed).elem_type)->name; if (Array_string_contains(type_names, dep)) { array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); } } - else if (sym->info._typ == 457 /* v.ast.Struct */) { + else if (sym->info._typ == 459 /* v.ast.Struct */) { for (int _t5 = 0; _t5 < (*sym->info._v__ast__Struct).embeds.len; ++_t5) { v__ast__Type embed = ((v__ast__Type*)(*sym->info._v__ast__Struct).embeds.data)[_t5]; string dep = v__ast__Table_sym(g->table, embed)->name; @@ -72763,7 +70746,7 @@ bool v__gen__c__Gen_sort_structs_defer_0 = false; continue; } array_push((array*)&field_deps, _MOV((string[]){ string_clone(dep) })); - if ((fsym->info)._typ == 472 /* v.ast.Alias */) { + if ((fsym->info)._typ == 474 /* v.ast.Alias */) { string xdep = v__ast__Table_sym(g->table, (*fsym->info._v__ast__Alias).parent_type)->name; if (!Array_string_contains(type_names, xdep) || Array_string_contains(field_deps, xdep)) { continue; @@ -72860,12 +70843,12 @@ bool v__gen__c__Gen_or_block_defer_0 = false; g->inside_or_block = true; v__gen__c__Gen_or_block_defer_0 = true; Array_v__ast__Stmt stmts = or_block.stmts; - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 347 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 349 /* v.ast.ExprStmt */ && !v__ast__Type_alias_eq((/* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(stmts)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ).typ, _const_v__ast__void_type)) { g->indent++; for (int i = 0; i < stmts.len; ++i) { v__ast__Stmt stmt = ((v__ast__Stmt*)stmts.data)[i]; if (i == stmts.len - 1) { - v__ast__ExprStmt expr_stmt = /* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ; + v__ast__ExprStmt expr_stmt = /* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ; v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("*("), /*115 &string*/0xfe10, {.d_s = mr_styp}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".data = "), 0, { .d_c = 0 }}}))); bool old_inside_opt_data = g->inside_opt_data; @@ -72881,47 +70864,20 @@ bool v__gen__c__Gen_or_block_defer_0 = false; g->indent--; } else { v__gen__c__Gen_stmts(g, stmts); - if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 347 /* v.ast.ExprStmt */) { + if (stmts.len > 0 && ((*(v__ast__Stmt*)array_last(stmts)))._typ == 349 /* v.ast.ExprStmt */) { v__gen__c__Gen_writeln(g, _SLIT(";")); } } g->or_expr_return_type = _const_v__ast__void_type; - } else if (or_block.kind == v__ast__OrKind__propagate_option) { + } else if (or_block.kind == v__ast__OrKind__propagate_result || (or_block.kind == v__ast__OrKind__propagate_option && v__ast__Type_has_flag(return_type, v__ast__TypeFlag__result))) { 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_158331 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_158331.arg0; - string pafile = mr_158331.arg1; - string pamod = mr_158331.arg2; - string pafn = mr_158331.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 }}}))); - } - } else if (!isnil(g->fn_decl) && g->fn_decl->is_test) { - v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(g, or_block, cvar_name); - } else { - v__gen__c__Gen_write_defer_stmts(g); - if (v__ast__Type_alias_eq(g->fn_decl->return_type, _const_v__ast__void_type)) { - v__gen__c__Gen_writeln(g, _SLIT("\treturn;")); - } else { - string styp = v__gen__c__Gen_typ(g, g->fn_decl->return_type); - string err_obj = v__gen__c__Gen_new_tmp_var(g); - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tmemcpy(&"), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(", &"), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(", sizeof(Option));"), 0, { .d_c = 0 }}}))); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); - } - } - } else if (or_block.kind == v__ast__OrKind__propagate_result) { - 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_159598 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_159598.arg0; - string pafile = mr_159598.arg1; - string pamod = mr_159598.arg2; - string pafn = mr_159598.arg3; + multi_return_int_string_string_string mr_158435 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_158435.arg0; + string pafile = mr_158435.arg1; + string pamod = mr_158435.arg2; + string pafn = mr_158435.arg3; 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 }}}))); @@ -72940,6 +70896,33 @@ bool v__gen__c__Gen_or_block_defer_0 = false; v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } } + } else if (or_block.kind == v__ast__OrKind__propagate_option) { + if (string__eq(g->file->mod.name, _SLIT("main")) && (isnil(g->fn_decl) || g->fn_decl->is_main)) { + string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); + if (g->pref->is_debug) { + multi_return_int_string_string_string mr_159705 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_159705.arg0; + string pafile = mr_159705.arg1; + string pamod = mr_159705.arg2; + string pafn = mr_159705.arg3; + 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 }}}))); + } + } else if (!isnil(g->fn_decl) && g->fn_decl->is_test) { + v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(g, or_block, cvar_name); + } else { + v__gen__c__Gen_write_defer_stmts(g); + if (v__ast__Type_alias_eq(g->fn_decl->return_type, _const_v__ast__void_type)) { + v__gen__c__Gen_writeln(g, _SLIT("\treturn;")); + } else { + string styp = v__gen__c__Gen_typ(g, g->fn_decl->return_type); + string err_obj = v__gen__c__Gen_new_tmp_var(g); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tmemcpy(&"), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(", &"), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(", sizeof(_option));"), 0, { .d_c = 0 }}}))); + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\treturn "), /*115 &string*/0xfe10, {.d_s = err_obj}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + } + } } v__gen__c__Gen_writeln(g, _SLIT("}")); v__gen__c__Gen_set_current_pos_as_last_stmt_pos(g); @@ -72994,7 +70977,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } case v__ast__Kind__alias: { - string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type); + string _t6 = v__gen__c__Gen_type_default(g, (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type); return _t6; break; } @@ -73031,11 +71014,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_162208 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); - string hash_fn = mr_162208.arg0; - string key_eq_fn = mr_162208.arg1; - string clone_fn = mr_162208.arg2; - string free_fn = mr_162208.arg3; + multi_return_string_string_string_string mr_162313 = v__gen__c__Gen_map_fn_ptrs(g, *key_typ); + string hash_fn = mr_162313.arg0; + string key_eq_fn = mr_162313.arg1; + string clone_fn = mr_162313.arg2; + string free_fn = mr_162313.arg3; 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(""))); @@ -73062,7 +71045,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty { bool has_none_zero = false; string init_str = _SLIT("{"); - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; bool typ_is_shared_f = v__ast__Type_has_flag(typ, v__ast__TypeFlag__shared_f); if (sym->language == v__ast__Language__v && !typ_is_shared_f) { for (int _t12 = 0; _t12 < info.fields.len; ++_t12) { @@ -73081,7 +71064,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_type_default(v__gen__c__Gen* g, v__ast__Ty } else { string zero_str = v__gen__c__Gen_type_default(g, field.typ); if (string__eq(zero_str, _SLIT("{0}"))) { - if ((field_sym->info)._typ == 457 /* v.ast.Struct */ && field_sym->language == v__ast__Language__v) { + if ((field_sym->info)._typ == 459 /* v.ast.Struct */ && field_sym->language == v__ast__Language__v) { if ((*field_sym->info._v__ast__Struct).fields.len == 0 && (*field_sym->info._v__ast__Struct).embeds.len == 0) { zero_str = _SLIT("{EMPTY_STRUCT_INITIALIZATION}"); } @@ -73201,6 +71184,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_size_of(v__gen__c__Gen* g, v__ast__SizeOf no v__gen__c__Gen_error(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("unknown type `"), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), node.pos); VUNREACHABLE(); } + if ((node.expr)._typ == 333 /* v.ast.StringLiteral */) { + if ((*node.expr._v__ast__StringLiteral).language == v__ast__Language__c) { + v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof(\""), /*115 &string*/0xfe10, {.d_s = (*node.expr._v__ast__StringLiteral).val}}, {_SLIT("\")"), 0, { .d_c = 0 }}}))); + return; + } + } string styp = v__gen__c__Gen_typ(g, node_typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sizeof("), /*115 &string*/0xfe10, {.d_s = v__util__no_dots(styp)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); } @@ -73220,7 +71209,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no string styp = v__gen__c__Gen_typ(g, unwrapped_node_typ); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, unwrapped_node_typ); v__ast__TypeSymbol* expr_type_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.expr_type)); - if ((expr_type_sym->info)._typ == 476 /* v.ast.SumType */) { + if ((expr_type_sym->info)._typ == 478 /* v.ast.SumType */) { string dot = (v__ast__Type_is_ptr(node.expr_type) ? (_SLIT("->")) : (_SLIT("."))); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("/* as */ *("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)__as_cast("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_write(g, _SLIT("(")); @@ -73250,7 +71239,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_as_cast(v__gen__c__Gen* g, v__ast__AsCast no } v__gen__c__Gen_expr(g, node.expr); v__gen__c__Gen_write(g, _SLIT(")")); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((expr_type_sym->info)._v__ast__Interface,(expr_type_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (!_IN_MAP(ADDR(int, node.typ), ADDR(map, info.conversions))) { Array_v__ast__Type left_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){expr_type_sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); Array_v__ast__Type right_variants = (*(Array_v__ast__Type*)map_get(ADDR(map, g->table->iface_types), &(string[]){sym->name}, &(Array_v__ast__Type[]){ __new_array(0, 0, sizeof(v__ast__Type)) })); @@ -73321,10 +71310,10 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (isym->kind != v__ast__Kind__interface_) { continue; } - if ((isym->info)._typ != 475 /* v.ast.Interface */) { + if ((isym->info)._typ != 477 /* v.ast.Interface */) { continue; } - v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface inter_info = /* as */ *(v__ast__Interface*)__as_cast((isym->info)._v__ast__Interface,(isym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; if (inter_info.is_generic) { continue; } @@ -73332,7 +71321,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { string methods_struct_name = str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct _"), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("_interface_methods"), 0, { .d_c = 0 }}})); strings__Builder methods_struct_def = strings__new_builder(100); strings__Builder_writeln(&methods_struct_def, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = methods_struct_name}}, {_SLIT(" {"), 0, { .d_c = 0 }}}))); - Map_string_int methodidx = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int methodidx = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int k = 0; k < inter_info.methods.len; ++k) { v__ast__Fn method = ((v__ast__Fn*)inter_info.methods.data)[k]; map_set(&methodidx, &(string[]){method.name}, &(int[]) { k }); @@ -73359,7 +71349,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { strings__Builder cast_functions = strings__new_builder(100); strings__Builder methods_wrapper = strings__new_builder(100); strings__Builder_writeln(&methods_wrapper, str_intp(2, _MOV((StrIntpData[]){{_SLIT("// Methods wrapper for interface \""), /*115 &string*/0xfe10, {.d_s = interface_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); - Map_string_int already_generated_mwrappers = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int already_generated_mwrappers = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int iinidx_minimum_base = 1000; int current_iinidx = iinidx_minimum_base; for (int _t2 = 0; _t2 < inter_info.types.len; ++_t2) { @@ -73453,7 +71444,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { array_push((array*)&_t10, &ti); } Array_string method_names =_t10; - if (st_sym->info._typ == 457 /* v.ast.Struct */) { + if (st_sym->info._typ == 459 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Struct).parent_type); for (int _t12 = 0; _t12 < parent_sym->methods.len; ++_t12) { @@ -73470,7 +71461,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 475 /* v.ast.Interface */) { + else if (st_sym->info._typ == 477 /* v.ast.Interface */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Interface).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__Interface).parent_type); for (int _t15 = 0; _t15 < parent_sym->methods.len; ++_t15) { @@ -73487,7 +71478,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { } } } - else if (st_sym->info._typ == 476 /* v.ast.SumType */) { + else if (st_sym->info._typ == 478 /* v.ast.SumType */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__SumType).parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*st_sym->info._v__ast__SumType).parent_type); for (int _t18 = 0; _t18 < parent_sym->methods.len; ++_t18) { @@ -73530,13 +71521,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { string name = method.name; if (v__ast__Type_has_flag(inter_info.parent_type, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, inter_info.parent_type); - if (parent_sym->info._typ == 457 /* v.ast.Struct */) { + if (parent_sym->info._typ == 459 /* v.ast.Struct */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Struct).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 475 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__Interface).concrete_types, method.name, false); } - else if (parent_sym->info._typ == 476 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { name = v__gen__c__Gen_generic_fn_name(g, (*parent_sym->info._v__ast__SumType).concrete_types, method.name, false); } @@ -73547,7 +71538,7 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { if (!_IN_MAP(ADDR(string, method.name), ADDR(map, methodidx))) { continue; } - if ((st_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((st_sym->info)._typ == 459 /* v.ast.Struct */) { if (v__ast__Type_has_flag((*st_sym->info._v__ast__Struct).parent_type, v__ast__TypeFlag__generic)) { name = v__gen__c__Gen_generic_fn_name(g, (*st_sym->info._v__ast__Struct).concrete_types, method.name, false); } @@ -73561,8 +71552,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { int params_start_pos = g->out.len; Array_v__ast__Param params = array_clone_to_depth(&method.params, 0); array_set(¶ms, 0, &(v__ast__Param[]) { ((v__ast__Param){(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).name,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).pos,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).type_pos,.typ = v__ast__Type_set_nr_muls(st, 1),(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_mut,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_auto_rec,(*(v__ast__Param*)/*ee elem_sym */array_get(params, 0)).is_hidden,}) }); - multi_return_Array_string_Array_string_Array_bool mr_176690 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); - Array_string fargs = mr_176690.arg0; + multi_return_Array_string_Array_string_Array_bool mr_176920 = v__gen__c__Gen_fn_decl_params(g, params, ((voidptr)(0)), false); + Array_string fargs = mr_176920.arg0; 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__")); @@ -73579,8 +71570,8 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_interface_table(v__gen__c__Gen* g) { *(multi_return_v__ast__Fn_Array_v__ast__Type*) _t26.data = (multi_return_v__ast__Fn_Array_v__ast__Type){.arg0=((v__ast__Fn){.params = __new_array(0, 0, sizeof(v__ast__Param)),.generic_names = __new_array(0, 0, sizeof(string)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.mod = (string){.str=(byteptr)"", .is_lit=1},.file = (string){.str=(byteptr)"", .is_lit=1},.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.return_type = 0,.receiver_type = 0,.usages = 0,.ctdefine_idx = 0,.source_fn = 0,.language = 0,.file_mode = 0,.is_variadic = 0,.is_pub = 0,.is_ctor_new = 0,.is_deprecated = 0,.is_noreturn = 0,.is_unsafe = 0,.is_placeholder = 0,.is_main = 0,.is_test = 0,.is_keep_alive = 0,.is_method = 0,.no_body = 0,.is_conditional = 0,}),.arg1=__new_array_with_default(0, 0, sizeof(v__ast__Type), 0)}; } - multi_return_v__ast__Fn_Array_v__ast__Type mr_177154 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); - Array_v__ast__Type embed_types = mr_177154.arg1; + multi_return_v__ast__Fn_Array_v__ast__Type mr_177384 = (*(multi_return_v__ast__Fn_Array_v__ast__Type*)_t26.data); + Array_v__ast__Type embed_types = mr_177384.arg1; 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 }}})); @@ -73718,7 +71709,7 @@ int v__gen__c__Gen_get_array_depth(v__gen__c__Gen* g, v__ast__Type el_typ) { v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, el_typ); v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, typ); if (sym->kind == v__ast__Kind__array) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym->info)._v__ast__Array,(sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; int _t1 = 1 + v__gen__c__Gen_get_array_depth(g, info.elem_type); return _t1; } else { @@ -73765,14 +71756,14 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__array_fixed: { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; bool _t5 = v__gen__c__Gen_contains_ptr(g, info.elem_type); return _t5; break; } case v__ast__Kind__struct_: { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; for (int _t6 = 0; _t6 < info.embeds.len; ++_t6) { v__ast__Type embed = ((v__ast__Type*)info.embeds.data)[_t6]; if (v__gen__c__Gen_contains_ptr(g, embed)) { @@ -73793,7 +71784,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__aggregate: { - v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ; + v__ast__Aggregate info = /* as */ *(v__ast__Aggregate*)__as_cast((sym->info)._v__ast__Aggregate,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ; for (int _t11 = 0; _t11 < info.types.len; ++_t11) { v__ast__Type atyp = ((v__ast__Type*)info.types.data)[_t11]; if (v__gen__c__Gen_contains_ptr(g, atyp)) { @@ -73807,7 +71798,7 @@ bool v__gen__c__Gen_contains_ptr(v__gen__c__Gen* g, v__ast__Type el_typ) { } case v__ast__Kind__multi_return: { - v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; for (int _t14 = 0; _t14 < info.types.len; ++_t14) { v__ast__Type mrtyp = ((v__ast__Type*)info.types.data)[_t14]; if (v__gen__c__Gen_contains_ptr(g, mrtyp)) { @@ -73950,23 +71941,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_c_main_header(v__gen__c__Gen* g) { v__gen__c__Gen_writeln(g, _SLIT("#endif")); } v__gen__c__Gen_writeln(g, _SLIT("\t_vinit(___argc, (voidptr)___argv);")); - if (g->pref->is_prof) { - v__gen__c__Gen_writeln(g, _SLIT("")); - v__gen__c__Gen_writeln(g, _SLIT("\tatexit(vprint_profile_stats);")); - v__gen__c__Gen_writeln(g, _SLIT("")); - } + v__gen__c__Gen_gen_c_main_profile_hook(g); if (g->pref->is_livemain) { v__gen__c__Gen_generate_hotcode_reloading_main_caller(g); } - if ((g->pref->profile_file).len != 0) { - if (Array_string_contains(g->pref->compile_defines, _SLIT("no_profile_startup"))) { - v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); - } - if (g->pref->profile_fns.len > 0) { - v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); - v__gen__c__Gen_writeln(g, _SLIT("v__profile_enabled = false;")); - } - } } void v__gen__c__Gen_gen_c_main_footer(v__gen__c__Gen* g) { @@ -73979,7 +71957,9 @@ void v__gen__c__Gen_gen_c_android_sokol_main(v__gen__c__Gen* g) { if (g->is_autofree) { v__gen__c__Gen_writeln(g, _SLIT("// Wrapping cleanup/free callbacks for sokol to include _vcleanup()\nvoid (*_vsokol_user_cleanup_ptr)(void);\nvoid (*_vsokol_user_cleanup_cb_ptr)(void *);\n\nvoid (_vsokol_cleanup_cb)(void) {\n\011if (_vsokol_user_cleanup_ptr) {\n\011\011_vsokol_user_cleanup_ptr();\n\011}\n\011_vcleanup();\n}\n\nvoid (_vsokol_cleanup_userdata_cb)(void* user_data) {\n\011if (_vsokol_user_cleanup_cb_ptr) {\n\011\011_vsokol_user_cleanup_cb_ptr(g_desc.user_data);\n\011}\n\011_vcleanup();\n}\n")); } - v__gen__c__Gen_writeln(g, _SLIT("// The sokol_main entry point on Android\nsapp_desc sokol_main(int argc, char* argv[]) {\n\011(void)argc; (void)argv;\n\n\011_vinit(argc, (voidptr)argv);\n\011main__main();\n")); + v__gen__c__Gen_writeln(g, _SLIT("// The sokol_main entry point on Android\nsapp_desc sokol_main(int argc, char* argv[]) {\n\011(void)argc; (void)argv;\n\n\011_vinit(argc, (voidptr)argv);\n\011")); + v__gen__c__Gen_gen_c_main_profile_hook(g); + v__gen__c__Gen_writeln(g, _SLIT("\tmain__main();")); if (g->is_autofree) { v__gen__c__Gen_writeln(g, _SLIT("\011// Wrap user provided cleanup/free functions for sokol to be able to call _vcleanup()\n\011if (g_desc.cleanup_cb) {\n\011\011_vsokol_user_cleanup_ptr = g_desc.cleanup_cb;\n\011\011g_desc.cleanup_cb = _vsokol_cleanup_cb;\n\011}\n\011else if (g_desc.cleanup_userdata_cb) {\n\011\011_vsokol_user_cleanup_cb_ptr = g_desc.cleanup_userdata_cb;\n\011\011g_desc.cleanup_userdata_cb = _vsokol_cleanup_userdata_cb;\n\011}\n")); } @@ -73993,27 +71973,44 @@ void v__gen__c__Gen_write_tests_definitions(v__gen__c__Gen* g) { } void v__gen__c__Gen_gen_failing_error_propagation_for_test_fn(v__gen__c__Gen* g, v__ast__OrExpr or_block, string cvar_name) { - multi_return_int_string_string_string mr_5124 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); - int paline = mr_5124.arg0; - string pafile = mr_5124.arg1; - string pamod = mr_5124.arg2; - string pafn = mr_5124.arg3; + multi_return_int_string_string_string mr_4758 = v__gen__c__Gen_panic_debug_info(g, or_block.pos); + int paline = mr_4758.arg0; + string pafile = mr_4758.arg1; + string pamod = mr_4758.arg2; + string pafn = mr_4758.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } void v__gen__c__Gen_gen_failing_return_error_for_test_fn(v__gen__c__Gen* g, v__ast__Return return_stmt, string cvar_name) { - multi_return_int_string_string_string mr_5815 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); - int paline = mr_5815.arg0; - string pafile = mr_5815.arg1; - string pamod = mr_5815.arg2; - string pafn = mr_5815.arg3; + multi_return_int_string_string_string mr_5449 = v__gen__c__Gen_panic_debug_info(g, return_stmt.pos); + int paline = mr_5449.arg0; + string pafile = mr_5449.arg1; + string pamod = mr_5449.arg2; + string pafn = mr_5449.arg3; string err_msg = str_intp(3, _MOV((StrIntpData[]){{_SLIT("IError_name_table["), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._typ]._method_msg("), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err._object)"), 0, { .d_c = 0 }}})); v__gen__c__Gen_writeln(g, str_intp(6, _MOV((StrIntpData[]){{_SLIT("\tmain__TestRunner_name_table[test_runner._typ]._method_fn_error(test_runner._object, "), /*100 &int*/0xfe07, {.d_i32 = paline}}, {_SLIT(", tos3(\""), /*115 &string*/0xfe10, {.d_s = pafile}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pamod}}, {_SLIT("\"), tos3(\""), /*115 &string*/0xfe10, {.d_s = pafn}}, {_SLIT("\"), "), /*115 &string*/0xfe10, {.d_s = err_msg}}, {_SLIT(" );"), 0, { .d_c = 0 }}}))); v__gen__c__Gen_writeln(g, _SLIT("\tlongjmp(g_jump_buffer, 1);")); } +void v__gen__c__Gen_gen_c_main_profile_hook(v__gen__c__Gen* g) { + if (g->pref->is_prof) { + v__gen__c__Gen_writeln(g, _SLIT("")); + v__gen__c__Gen_writeln(g, _SLIT("\tatexit(vprint_profile_stats);")); + v__gen__c__Gen_writeln(g, _SLIT("")); + } + if ((g->pref->profile_file).len != 0) { + if (Array_string_contains(g->pref->compile_defines, _SLIT("no_profile_startup"))) { + v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); + } + if (g->pref->profile_fns.len > 0) { + v__gen__c__Gen_writeln(g, _SLIT("vreset_profile_stats();")); + v__gen__c__Gen_writeln(g, _SLIT("v__profile_enabled = false;")); + } + } +} + void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { int main_fn_start_pos = g->out.len; v__gen__c__Gen_writeln(g, _SLIT("")); @@ -74031,6 +72028,7 @@ void v__gen__c__Gen_gen_c_main_for_tests(v__gen__c__Gen* g) { } v__gen__c__Gen_writeln(g, _SLIT("\tmain__vtest_init();")); v__gen__c__Gen_writeln(g, _SLIT("\t_vinit(___argc, (voidptr)___argv);")); + v__gen__c__Gen_gen_c_main_profile_hook(g); Array_string all_tfuncs = v__gen__c__Gen_get_all_test_function_names(g); all_tfuncs = v__gen__c__Gen_filter_only_matching_fn_names(g, all_tfuncs); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tstring v_test_file = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__ctoslit(g->pref->path)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -74123,8 +72121,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_selector(v__gen__c__Gen* g, v__ast_ } else { v__gen__c__Gen_write(g, _SLIT(".")); } - if ((node.field_expr)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 307 /* v.ast.Ident */) { + if ((node.field_expr)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*node.field_expr._v__ast__SelectorExpr).expr)._typ == 309 /* 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"))) { 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)); @@ -74175,7 +72173,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com for (int _t3 = 0; _t3 < _t2_len; ++_t3) { v__ast__Stmt it = ((v__ast__Stmt*) _t2_orig.data)[_t3]; - if ((it)._typ != 358 /* v.ast.Return */) { + if ((it)._typ != 360 /* v.ast.Return */) { array_push((array*)&_t2, &it); } } @@ -74211,7 +72209,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com if (node->args.len > 0 && m.params.len - 1 >= node->args.len) { v__ast__CallArg arg = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node->args, node->args.len - 1)); v__ast__Param param = (*(v__ast__Param*)/*ee elem_sym */array_get(m.params, node->args.len)); - _t5 = (arg.expr)._typ == 307 /* v.ast.Ident */ && string__eq(v__ast__Table_type_to_str(g->table, arg.typ), _SLIT("[]string")) && !string__eq(v__ast__Table_type_to_str(g->table, param.typ), _SLIT("[]string")); + _t5 = (arg.expr)._typ == 309 /* v.ast.Ident */ && string__eq(v__ast__Table_type_to_str(g->table, arg.typ), _SLIT("[]string")) && !string__eq(v__ast__Table_type_to_str(g->table, param.typ), _SLIT("[]string")); } else { _t5 = false; } @@ -74226,8 +72224,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com return; } v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__util__no_dots(sym->name)}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = g->comptime_for_method}}, {_SLIT("("), 0, { .d_c = 0 }}}))); - if ((node->left)._typ == 307 /* v.ast.Ident */) { - if (((*node->left._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((node->left)._typ == 309 /* v.ast.Ident */) { + if (((*node->left._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if (v__ast__Type_is_ptr((*(v__ast__Param*)/*ee elem_sym */array_get(m.params, 0)).typ) && !v__ast__Type_is_ptr((*((*node->left._v__ast__Ident).obj.typ)))) { v__gen__c__Gen_write(g, _SLIT("&")); } @@ -74238,7 +72236,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_call(v__gen__c__Gen* g, v__ast__Com v__gen__c__Gen_write(g, _SLIT(", ")); } for (int i = 1; i < m.params.len; ++i) { - if ((node->left)._typ == 307 /* v.ast.Ident */) { + if ((node->left)._typ == 309 /* v.ast.Ident */) { if (string__eq((*(v__ast__Param*)/*ee elem_sym */array_get(m.params, i)).name, (*node->left._v__ast__Ident).name)) { continue; } @@ -74322,7 +72320,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp return; } if (!g->pref->output_cross_c) { - if (((*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond)._typ == 307 /* v.ast.Ident */) { + if (((*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond)._typ == 309 /* v.ast.Ident */) { _option_v__pref__OS _t1 = v__pref__os_from_string((*(*(v__ast__IfBranch*)/*ee elem_sym */array_get(node.branches, 0)).cond._v__ast__Ident).name); if (_t1.state != 0) { /*or block*/ IError err = _t1.err; @@ -74368,7 +72366,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp if (node.is_expr) { int len = branch.stmts.len; if (len > 0) { - v__ast__ExprStmt last = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ; + v__ast__ExprStmt last = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)array_last(branch.stmts)))._v__ast__ExprStmt,((*(v__ast__Stmt*)array_last(branch.stmts)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ; if (len > 1) { string tmp = v__gen__c__Gen_new_tmp_var(g); string styp = v__gen__c__Gen_typ(g, last.typ); @@ -74404,25 +72402,25 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_if(v__gen__c__Gen* g, v__ast__IfExp } VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__Expr cond, bool pkg_exist) { - if (cond._typ == 291 /* v.ast.BoolLiteral */) { + if (cond._typ == 293 /* v.ast.BoolLiteral */) { v__gen__c__Gen_expr(g, cond); bool _t1 = true; return _t1; } - else if (cond._typ == 322 /* v.ast.ParExpr */) { + else if (cond._typ == 324 /* v.ast.ParExpr */) { v__gen__c__Gen_write(g, _SLIT("(")); bool is_cond_true = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__ParExpr).expr, pkg_exist); v__gen__c__Gen_write(g, _SLIT(")")); bool _t2 = is_cond_true; return _t2; } - else if (cond._typ == 324 /* v.ast.PrefixExpr */) { + else if (cond._typ == 326 /* v.ast.PrefixExpr */) { v__gen__c__Gen_write(g, v__token__Kind_str((*cond._v__ast__PrefixExpr).op)); bool _t3 = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__PrefixExpr).right, pkg_exist); return _t3; } - else if (cond._typ == 323 /* v.ast.PostfixExpr */) { - _option_string _t4 = v__gen__c__Gen_comptime_if_to_ifdef(g, (/* as */ *(v__ast__Ident*)__as_cast(((*cond._v__ast__PostfixExpr).expr)._v__ast__Ident,((*cond._v__ast__PostfixExpr).expr)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).name, true); + else if (cond._typ == 325 /* v.ast.PostfixExpr */) { + _option_string _t4 = v__gen__c__Gen_comptime_if_to_ifdef(g, (/* as */ *(v__ast__Ident*)__as_cast(((*cond._v__ast__PostfixExpr).expr)._v__ast__Ident,((*cond._v__ast__PostfixExpr).expr)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).name, true); if (_t4.state != 0) { /*or block*/ IError err = _t4.err; v__gen__c__verror(IError_name_table[err._typ]._method_msg(err._object)); @@ -74436,7 +72434,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ bool _t6 = true; return _t6; } - else if (cond._typ == 311 /* v.ast.InfixExpr */) { + else if (cond._typ == 313 /* v.ast.InfixExpr */) { if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__and) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__logical_or)) { bool l = v__gen__c__Gen_comptime_if_cond(g, (*cond._v__ast__InfixExpr).left, pkg_exist); @@ -74448,7 +72446,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ else if ((*cond._v__ast__InfixExpr).op == (v__token__Kind__key_is) || (*cond._v__ast__InfixExpr).op == (v__token__Kind__not_is)) { v__ast__Expr left = (*cond._v__ast__InfixExpr).left; string name = _SLIT(""); - if ((left)._typ == 333 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 300 /* v.ast.ComptimeType */) { + if ((left)._typ == 335 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 302 /* v.ast.ComptimeType */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_is_comptime_type(g->table, checked_type, (*(*cond._v__ast__InfixExpr).right._v__ast__ComptimeType)); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -74470,10 +72468,10 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ } } v__ast__Type exp_type = ((v__ast__Type)(0)); - v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 333) /*expected idx: 333, name: v.ast.TypeNode */ ).typ; - if ((left)._typ == 333 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 333 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { + v__ast__Type got_type = (/* as */ *(v__ast__TypeNode*)__as_cast(((*cond._v__ast__InfixExpr).right)._v__ast__TypeNode,((*cond._v__ast__InfixExpr).right)._typ, 335) /*expected idx: 335, name: v.ast.TypeNode */ ).typ; + if ((left)._typ == 335 /* v.ast.TypeNode */ && ((*cond._v__ast__InfixExpr).right)._typ == 335 /* v.ast.TypeNode */ && v__ast__Table_sym(g->table, got_type)->kind == v__ast__Kind__interface_) { v__ast__TypeSymbol* interface_sym = v__ast__Table_sym(g->table, got_type); - if ((interface_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((interface_sym->info)._typ == 477 /* v.ast.Interface */) { v__ast__Type checked_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); bool is_true = v__ast__Table_does_type_implement_interface(g->table, checked_type, got_type); if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -74494,14 +72492,14 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ return _t11; } } - } else if ((left)._typ == 327 /* v.ast.SelectorExpr */) { + } else if ((left)._typ == 329 /* v.ast.SelectorExpr */) { if ((*left._v__ast__SelectorExpr).gkind_field == v__ast__GenericKindField__typ) { exp_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__SelectorExpr).name_type); } else { name = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*left._v__ast__SelectorExpr).expr)}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*left._v__ast__SelectorExpr).field_name}}, {_SLIT0, 0, { .d_c = 0 }}})); exp_type = (*(v__ast__Type*)map_get(ADDR(map, g->comptime_var_type_map), &(string[]){name}, &(v__ast__Type[]){ 0 })); } - } else if ((left)._typ == 333 /* v.ast.TypeNode */) { + } else if ((left)._typ == 335 /* v.ast.TypeNode */) { exp_type = v__gen__c__Gen_unwrap_generic(g, (*left._v__ast__TypeNode).typ); } if ((*cond._v__ast__InfixExpr).op == v__token__Kind__key_is) { @@ -74524,7 +72522,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ return _t15; }; } - else if (cond._typ == 307 /* v.ast.Ident */) { + else if (cond._typ == 309 /* v.ast.Ident */) { _option_string _t16 = v__gen__c__Gen_comptime_if_to_ifdef(g, (*cond._v__ast__Ident).name, false); if (_t16.state != 0) { /*or block*/ IError err = _t16.err; @@ -74536,7 +72534,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_comptime_if_cond(v__gen__c__Gen* g, v__ast__ bool _t17 = true; return _t17; } - else if (cond._typ == 298 /* v.ast.ComptimeCall */) { + else if (cond._typ == 300 /* v.ast.ComptimeCall */) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &bool*/0xfe10, {.d_s = pkg_exist ? _SLIT("true") : _SLIT("false")}}, {_SLIT0, 0, { .d_c = 0 }}}))); bool _t18 = true; return _t18; @@ -74659,7 +72657,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_for(v__gen__c__Gen* g, v__ast__Comp } } else if (node.kind == v__ast__ComptimeForKind__fields) { if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct sym_info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (sym_info.fields.len > 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tFieldData "), /*115 &string*/0xfe10, {.d_s = node.val_var}}, {_SLIT(" = {0};"), 0, { .d_c = 0 }}}))); } @@ -74692,7 +72690,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_comptime_for(v__gen__c__Gen* g, v__ast__Comp map_delete(&g->comptime_var_type_map, &(string[]){node.val_var}); } } else if (node.kind == v__ast__ComptimeForKind__attributes) { - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).attrs.len > 0) { v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tStructAttribute "), /*115 &string*/0xfe10, {.d_s = node.val_var}}, {_SLIT(" = {0};"), 0, { .d_c = 0 }}}))); } @@ -74979,7 +72977,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr(v__gen__c__Gen* g, v__ast__DumpExp } VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { - Map_string_bool dump_typedefs = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_bool dump_typedefs = new_map(sizeof(string), sizeof(bool), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; strings__Builder dump_fns = strings__new_builder(100); strings__Builder dump_fn_defs = strings__new_builder(100); Map_int_string _t1 = g->table->dumps; @@ -75004,7 +73003,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_dump_expr_definitions(v__gen__c__Gen* g) { string ptr_asterisk = (is_ptr ? (_SLIT("*")) : (_SLIT(""))); string str_dumparg_type = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = ptr_asterisk}}, {_SLIT0, 0, { .d_c = 0 }}})); if (dump_sym->kind == v__ast__Kind__function) { - v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType fninfo = /* as */ *(v__ast__FnType*)__as_cast((dump_sym->info)._v__ast__FnType,(dump_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; str_dumparg_type = str_intp(2, _MOV((StrIntpData[]){{_SLIT("DumpFNType_"), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, 0, { .d_c = 0 }}})); int tdef_pos = g->out.len; v__gen__c__Gen_write_fn_ptr_decl(g, &fninfo, str_dumparg_type); @@ -75556,7 +73555,7 @@ int ctmp; deref = _SLIT("*"); } } - v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 365) /*expected idx: 365, name: v.ast.Var */ ; + v__ast__Var info = /* as */ *(v__ast__Var*)__as_cast((var.obj)._v__ast__Var,(var.obj)._typ, 367) /*expected idx: 367, name: v.ast.Var */ ; if (v__ast__Table_sym(g->table, info.typ)->kind != v__ast__Kind__function) { v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, info.typ)}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = deref}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(var.name)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); } @@ -75607,7 +73606,7 @@ int ctmp; } else { g->defer_stmts = __new_array_with_default(0, 0, sizeof(v__ast__DeferStmt), 0); } - if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && node->stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 358 /* v.ast.Return */ && !Array_v__ast__Attr_contains(node->attrs, _SLIT("_naked"))) { + if (!v__ast__Type_alias_eq(node->return_type, _const_v__ast__void_type) && node->stmts.len > 0 && ((*(v__ast__Stmt*)array_last(node->stmts)))._typ != 360 /* v.ast.Return */ && !Array_v__ast__Attr_contains(node->attrs, _SLIT("_naked"))) { string default_expr = v__gen__c__Gen_type_default(g, node->return_type); if (string__eq(default_expr, _SLIT("{0}"))) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\treturn ("), /*115 &string*/0xfe10, {.d_s = type_name}}, {_SLIT(")"), /*115 &string*/0xfe10, {.d_s = default_expr}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -75783,7 +73782,7 @@ VV_LOCAL_SYMBOL multi_return_Array_string_Array_string_Array_bool v__gen__c__Gen v__ast__TypeSymbol* arg_type_sym = v__ast__Table_sym(g->table, typ); string arg_type_name = v__gen__c__Gen_typ(g, typ); if (arg_type_sym->kind == v__ast__Kind__function) { - v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ; + v__ast__FnType info = /* as */ *(v__ast__FnType*)__as_cast((arg_type_sym->info)._v__ast__FnType,(arg_type_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ; v__ast__Fn func = info.func; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); strings__Builder_write_string(&g->definitions, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, func.return_type)}}, {_SLIT(" (*"), /*115 &string*/0xfe10, {.d_s = caname}}, {_SLIT(")("), 0, { .d_c = 0 }}}))); @@ -75849,13 +73848,13 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_get_anon_fn_type_name(v__gen__c__Gen* g, v VV_LOCAL_SYMBOL void v__gen__c__Gen_call_expr(v__gen__c__Gen* g, v__ast__CallExpr node) { bool v__gen__c__Gen_call_expr_defer_0 = false; - if ((node.left)._typ == 285 /* v.ast.AnonFn */) { + if ((node.left)._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_expr(g, node.left); - } else if ((node.left)._typ == 310 /* v.ast.IndexExpr */ && (node.name).len == 0) { + } else if ((node.left)._typ == 312 /* v.ast.IndexExpr */ && (node.name).len == 0) { g->is_fn_index_call = true; v__gen__c__Gen_expr(g, node.left); g->is_fn_index_call = false; - } else if ((node.left)._typ == 293 /* v.ast.CallExpr */ && (node.name).len == 0) { + } else if ((node.left)._typ == 295 /* v.ast.CallExpr */ && (node.name).len == 0) { v__gen__c__Gen_expr(g, node.left); } if (node.should_be_skipped) { @@ -75885,7 +73884,7 @@ bool v__gen__c__Gen_call_expr_defer_0 = false; v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = tmp_opt}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); } if (node.is_method && !node.is_field) { - if (string__eq(node.name, _SLIT("writeln")) && g->pref->experimental && node.args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ == 330 /* v.ast.StringInterLiteral */ && string__eq(v__ast__Table_sym(g->table, node.receiver_type)->name, _SLIT("strings.Builder"))) { + if (string__eq(node.name, _SLIT("writeln")) && g->pref->experimental && node.args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ == 332 /* v.ast.StringInterLiteral */ && string__eq(v__ast__Table_sym(g->table, node.receiver_type)->name, _SLIT("strings.Builder"))) { v__gen__c__Gen_string_inter_literal_sb_optimized(g, node); } else { v__gen__c__Gen_method_call(g, node); @@ -75953,7 +73952,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, node.receiver_type); } else { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, node.receiver_type); - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { Array_string _t1 = {0}; Array_v__ast__Type _t1_orig = (*sym->info._v__ast__Struct).generic_types; int _t1_len = _t1_orig.len; @@ -75972,7 +73971,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 475 /* v.ast.Interface */) { + else if (sym->info._typ == 477 /* v.ast.Interface */) { Array_string _t4 = {0}; Array_v__ast__Type _t4_orig = (*sym->info._v__ast__Interface).generic_types; int _t4_len = _t4_orig.len; @@ -75991,7 +73990,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE unwrapped_rec_type = utyp; } } - else if (sym->info._typ == 476 /* v.ast.SumType */) { + else if (sym->info._typ == 478 /* v.ast.SumType */) { Array_string _t7 = {0}; Array_v__ast__Type _t7_orig = (*sym->info._v__ast__SumType).generic_types; int _t7_len = _t7_orig.len; @@ -76017,12 +74016,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); if (typ_sym->kind == v__ast__Kind__alias && !string__eq(node.name, _SLIT("str")) && !v__ast__TypeSymbol_has_method(typ_sym, node.name)) { - unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + unwrapped_rec_type = (/* as */ *(v__ast__Alias*)__as_cast((typ_sym->info)._v__ast__Alias,(typ_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); } string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ )), node.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), node.name)) { bool left_is_shared = v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f); string left_cc_type = v__gen__c__Gen_cc_type(g, node.left_type, false); string left_type_name = v__util__no_dots(left_cc_type); @@ -76102,7 +74101,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE }; } if (left_sym->kind == v__ast__Kind__map && string__eq(node.name, _SLIT("delete"))) { - v__ast__Map left_info = /* as */ *(v__ast__Map*)__as_cast((left_sym->info)._v__ast__Map,(left_sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map left_info = /* as */ *(v__ast__Map*)__as_cast((left_sym->info)._v__ast__Map,(left_sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; string elem_type_str = v__gen__c__Gen_typ(g, left_info.key_type); v__gen__c__Gen_write(g, _SLIT("map_delete(")); if (v__ast__Type_is_ptr(node.left_type)) { @@ -76155,9 +74154,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (v__ast__Type_has_flag(rec_type, v__ast__TypeFlag__shared_f)) { rec_type = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(rec_type, v__ast__TypeFlag__shared_f), 0); } - if ((node.left)._typ == 299 /* v.ast.ComptimeSelector */) { - if (((*node.left._v__ast__ComptimeSelector).field_expr)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 307 /* v.ast.Ident */) { + if ((node.left)._typ == 301 /* v.ast.ComptimeSelector */) { + if (((*node.left._v__ast__ComptimeSelector).field_expr)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 309 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*node.left._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t11 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t10 = {0}; @@ -76177,7 +74176,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE return; } } - } else if ((node.left)._typ == 298 /* v.ast.ComptimeCall */) { + } else if ((node.left)._typ == 300 /* v.ast.ComptimeCall */) { if (string__eq((*node.left._v__ast__ComptimeCall).method_name, _SLIT("method"))) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*node.left._v__ast__ComptimeCall).left_type)); _option_v__ast__Fn _t12; @@ -76188,8 +74187,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE return; } } - } else if ((node.left)._typ == 307 /* v.ast.Ident */) { - if (((*node.left._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + } else if ((node.left)._typ == 309 /* v.ast.Ident */) { + if (((*node.left._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if (g->comptime_var_type_map.len > 0) { rec_type = (*(*node.left._v__ast__Ident).obj._v__ast__Var).typ; v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -76197,7 +74196,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } else if ((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { rec_type = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*node.left._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, rec_type); - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { rec_type = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } v__gen__c__Gen_gen_expr_to_string(g, node.left, rec_type); @@ -76218,7 +74217,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE receiver_type_name = _SLIT("map"); } if (final_left_sym->kind == v__ast__Kind__array && !(left_sym->kind == v__ast__Kind__alias && v__ast__TypeSymbol_has_method(left_sym, node.name)) && (string__eq(node.name, _SLIT("repeat")) || string__eq(node.name, _SLIT("sort_with_compare")) || string__eq(node.name, _SLIT("free")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("trim")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("slice")) || string__eq(node.name, _SLIT("pointers")))) { - if (!((left_sym->info)._typ == 472 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { + if (!((left_sym->info)._typ == 474 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(typ_sym, node.name))) { receiver_type_name = _SLIT("array"); } if (string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("pop"))) { @@ -76233,12 +74232,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__array) { bool needs_depth = (string__eq(node.name, _SLIT("clone")) || string__eq(node.name, _SLIT("repeat"))); if (needs_depth) { - v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ).elem_type; array_depth = v__gen__c__Gen_get_array_depth(g, elem_type); } bool maybe_noscan = needs_depth || (string__eq(node.name, _SLIT("pop")) || string__eq(node.name, _SLIT("push")) || string__eq(node.name, _SLIT("push_many")) || string__eq(node.name, _SLIT("reverse")) || string__eq(node.name, _SLIT("grow_cap")) || string__eq(node.name, _SLIT("grow_len"))); if (maybe_noscan) { - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((left_sym->info)._v__ast__Array,(left_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); } } else if (left_sym->kind == v__ast__Kind__chan) { @@ -76275,9 +74274,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE } bool is_range_slice = false; if (v__ast__Type_is_ptr(node.receiver_type) && !v__ast__Type_is_ptr(node.left_type)) { - if ((node.left)._typ == 310 /* v.ast.IndexExpr */) { + if ((node.left)._typ == 312 /* v.ast.IndexExpr */) { v__ast__Expr idx = (*node.left._v__ast__IndexExpr).index; - if ((idx)._typ == 325 /* v.ast.RangeExpr */) { + if ((idx)._typ == 327 /* v.ast.RangeExpr */) { name = v__util__no_dots( str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = receiver_type_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = node.name}}, {_SLIT("_static"), 0, { .d_c = 0 }}}))); is_range_slice = true; } @@ -76328,7 +74327,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_method_call(v__gen__c__Gen* g, v__ast__CallE if (left_sym->kind == v__ast__Kind__array && v__ast__Expr_is_auto_deref_var(node.left) && (string__eq(node.name, _SLIT("first")) || string__eq(node.name, _SLIT("last")) || string__eq(node.name, _SLIT("repeat")))) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((node.left)._typ == 316 /* v.ast.MapInit */) { + if ((node.left)._typ == 318 /* v.ast.MapInit */) { v__gen__c__Gen_write(g, _SLIT("(map[]){")); v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT("}[0]")); @@ -76397,8 +74396,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__ast__CallExpr node_ = node; for (int i = 0; i < node_.args.len; ++i) { v__ast__CallArg* call_arg = ((v__ast__CallArg*)node_.args.data) + i; - if ((call_arg->expr)._typ == 307 /* v.ast.Ident */) { - if (((*call_arg->expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((call_arg->expr)._typ == 309 /* v.ast.Ident */) { + if (((*call_arg->expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { (*(v__ast__CallArg*)/*ee elem_sym */array_get(node_.args, i)).typ = (*(*call_arg->expr._v__ast__Ident).obj._v__ast__Var).typ; } } @@ -76437,7 +74436,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("string "), /*115 &string*/0xfe10, {.d_s = tmp2}}, {_SLIT(" = json__json_print_pretty("), /*115 &string*/0xfe10, {.d_s = json_obj}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } } else { - v__ast__TypeNode ast_type = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__TypeNode,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 333) /*expected idx: 333, name: v.ast.TypeNode */ ; + v__ast__TypeNode ast_type = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._v__ast__TypeNode,((*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr)._typ, 335) /*expected idx: 335, name: v.ast.TypeNode */ ; string typ = v__gen__c__c_name(v__gen__c__Gen_typ(g, ast_type.typ)); string fn_name = string__plus(string__plus(v__gen__c__c_name(name), _SLIT("_")), typ); v__gen__c__Gen_gen_json_for_type(g, ast_type.typ); @@ -76513,7 +74512,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr if (!v__ast__Type_alias_eq(typ, _const_v__ast__string_type) || g->comptime_for_method.len > 0) { v__ast__Expr expr = (*(v__ast__CallArg*)/*ee elem_sym */array_get(node.args, 0)).expr; v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, typ); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ )), _SLIT("str"))) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), _SLIT("str"))) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -76532,9 +74531,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("; "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("); string_free(&"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(print_method)}}, {_SLIT("("), 0, { .d_c = 0 }}}))); - if ((expr)._typ == 299 /* v.ast.ComptimeSelector */) { - if (((*expr._v__ast__ComptimeSelector).field_expr)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 301 /* v.ast.ComptimeSelector */) { + if (((*expr._v__ast__ComptimeSelector).field_expr)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr)._typ == 309 /* v.ast.Ident */) { string key_str = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = (*(*(*expr._v__ast__ComptimeSelector).field_expr._v__ast__SelectorExpr).expr._v__ast__Ident).name}}, {_SLIT(".typ"), 0, { .d_c = 0 }}})); v__ast__Type* _t7 = (v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, g->comptime_var_type_map), &(string[]){key_str})); _option_v__ast__Type _t6 = {0}; @@ -76552,7 +74551,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr typ = *(v__ast__Type*)_t6.data; } } - } else if ((expr)._typ == 298 /* v.ast.ComptimeCall */) { + } else if ((expr)._typ == 300 /* v.ast.ComptimeCall */) { if (string__eq((*expr._v__ast__ComptimeCall).method_name, _SLIT("method"))) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, (*expr._v__ast__ComptimeCall).left_type)); _option_v__ast__Fn _t8; @@ -76561,13 +74560,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr typ = m.return_type; } } - } else if ((expr)._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + } else if ((expr)._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { typ = (*(*expr._v__ast__Ident).obj._v__ast__Var).typ; if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, typ); - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -76581,11 +74580,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_39765 = v__gen__c__Gen_panic_debug_info(g, node.pos); - int paline = mr_39765.arg0; - string pafile = mr_39765.arg1; - string pamod = mr_39765.arg2; - string pafn = mr_39765.arg3; + multi_return_int_string_string_string mr_39776 = v__gen__c__Gen_panic_debug_info(g, node.pos); + int paline = mr_39776.arg0; + string pafile = mr_39776.arg1; + string pamod = mr_39776.arg2; + string pafn = mr_39776.arg3; 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(")")); @@ -76594,7 +74593,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr _option_v__ast__ScopeObject _t9; if (_t9 = v__ast__Scope_find(node.scope, node.name), _t9.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t9.data; - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { if ((*obj._v__ast__Var).smartcasts.len > 0) { for (int _t10 = 0; _t10 < (*obj._v__ast__Var).smartcasts.len; ++_t10) { v__gen__c__Gen_write(g, _SLIT("(*")); @@ -76610,7 +74609,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_fn_call(v__gen__c__Gen* g, v__ast__CallExpr } } string dot = (is_ptr ? (_SLIT("->")) : (_SLIT("."))); - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx))); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else { @@ -76682,7 +74681,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a if (!arg.is_tmp_autofree) { continue; } - if ((arg.expr)._typ == 293 /* v.ast.CallExpr */) { + if ((arg.expr)._typ == 295 /* v.ast.CallExpr */) { v__gen__c__Gen_autofree_call_pregen(g, (*arg.expr._v__ast__CallExpr)); } free_tmp_arg_vars = true; @@ -76694,7 +74693,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_pregen(v__gen__c__Gen* g, v__a _option_v__ast__ScopeObject _t2; if (_t2 = v__ast__Scope_find(scope, t), _t2.state == 0) { v__ast__ScopeObject x = *(v__ast__ScopeObject*)_t2.data; - if (x._typ == 365 /* v.ast.Var */) { + if (x._typ == 367 /* v.ast.Var */) { (*x._v__ast__Var).is_used = false; } @@ -76729,7 +74728,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_autofree_call_postgen(v__gen__c__Gen* g, int } if (!DenseArray_has_index(&_t1.key_values, _t2)) {continue;} v__ast__ScopeObject* obj = &(*(v__ast__ScopeObject*)DenseArray_value(&_t1.key_values, _t2)); - if (obj->_typ == 365 /* v.ast.Var */) { + if (obj->_typ == 367 /* v.ast.Var */) { bool is_optional = v__ast__Type_has_flag((*obj->_v__ast__Var).typ, v__ast__TypeFlag__optional); if (is_optional) { continue; @@ -76846,7 +74845,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp v__ast__Type varg_type = (*(v__ast__Type*)array_last(expected_types)); int variadic_count = args.len - arg_nr; v__ast__TypeSymbol* arr_sym = v__ast__Table_sym(g->table, varg_type); - v__ast__Array arr_info = /* as */ *(v__ast__Array*)__as_cast((arr_sym->info)._v__ast__Array,(arr_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array arr_info = /* as */ *(v__ast__Array*)__as_cast((arr_sym->info)._v__ast__Array,(arr_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; if (v__ast__Type_has_flag(varg_type, v__ast__TypeFlag__generic)) { if (node.is_method) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); @@ -76884,7 +74883,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_call_args(v__gen__c__Gen* g, v__ast__CallExp string elem_type = v__gen__c__Gen_typ(g, arr_info.elem_type); if ((g->pref->translated || g->file->is_translated) && args.len == 1) { v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, 0)).expr); - } else if (args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr)._typ == 286 /* v.ast.ArrayDecompose */) { + } else if (args.len > 0 && ((*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr)._typ == 288 /* v.ast.ArrayDecompose */) { v__gen__c__Gen_expr(g, (*(v__ast__CallArg*)/*ee elem_sym */array_get(args, args.len - 1)).expr); } else { if (variadic_count > 0) { @@ -76922,7 +74921,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__TypeSymbol* receiver_sym = v__ast__Table_sym(g->table, expr.receiver_type); name = string__plus(string__plus(receiver_sym->name, _SLIT("_")), name); - } else if ((expr.left)._typ == 285 /* v.ast.AnonFn */) { + } else if ((expr.left)._typ == 287 /* v.ast.AnonFn */) { v__gen__c__Gen_gen_anon_fn_decl(g, (voidptr)&/*qq*/(*expr.left._v__ast__AnonFn)); name = (*expr.left._v__ast__AnonFn).decl.name; } else if (expr.is_fn_var) { @@ -77101,7 +75100,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_go_expr(v__gen__c__Gen* g, v__ast__GoExpr no if (expr.is_method) { v__ast__Type unwrapped_rec_type = v__gen__c__Gen_unwrap_generic(g, expr.receiver_type); v__ast__TypeSymbol* typ_sym = v__ast__Table_sym(g->table, unwrapped_rec_type); - if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ )), expr.name)) { + if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), expr.name)) { string rec_cc_type = v__gen__c__Gen_cc_type(g, unwrapped_rec_type, false); string receiver_type_name = v__util__no_dots(rec_cc_type); strings__Builder_write_string(&g->gowrappers, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(receiver_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); @@ -77217,7 +75216,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v if (arg.is_mut) { v__ast__TypeSymbol* arg_sym = v__ast__Table_sym(g->table, arg_typ); if (exp_sym->kind == v__ast__Kind__array) { - if (((arg.expr)._typ == 307 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((arg.expr)._v__ast__Ident,(arg.expr)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ).kind == v__ast__IdentKind__variable) || (arg.expr)._typ == 327 /* v.ast.SelectorExpr */) { + if (((arg.expr)._typ == 309 /* v.ast.Ident */ && (/* as */ *(v__ast__Ident*)__as_cast((arg.expr)._v__ast__Ident,(arg.expr)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ).kind == v__ast__IdentKind__variable) || (arg.expr)._typ == 329 /* v.ast.SelectorExpr */) { v__gen__c__Gen_write(g, _SLIT("&/*arr*/")); v__gen__c__Gen_expr(g, arg.expr); } else { @@ -77226,11 +75225,11 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v v__gen__c__Gen_write(g, _SLIT("}[0]")); } return; - } else if (arg_sym->kind == v__ast__Kind__sum_type && exp_sym->kind == v__ast__Kind__sum_type && ((arg.expr)._typ == 307 /* v.ast.Ident */ || (arg.expr)._typ == 327 /* v.ast.SelectorExpr */)) { + } else if (arg_sym->kind == v__ast__Kind__sum_type && exp_sym->kind == v__ast__Kind__sum_type && ((arg.expr)._typ == 309 /* v.ast.Ident */ || (arg.expr)._typ == 329 /* v.ast.SelectorExpr */)) { v__gen__c__Gen_write(g, _SLIT("&/*sum*/")); v__gen__c__Gen_expr(g, arg.expr); return; - } else if (arg_sym->kind == v__ast__Kind__interface_ && exp_sym->kind == v__ast__Kind__interface_ && ((arg.expr)._typ == 307 /* v.ast.Ident */ || (arg.expr)._typ == 327 /* v.ast.SelectorExpr */)) { + } else if (arg_sym->kind == v__ast__Kind__interface_ && exp_sym->kind == v__ast__Kind__interface_ && ((arg.expr)._typ == 309 /* v.ast.Ident */ || (arg.expr)._typ == 329 /* v.ast.SelectorExpr */)) { v__gen__c__Gen_write(g, _SLIT("&/*iface*/")); v__gen__c__Gen_expr(g, arg.expr); return; @@ -77267,7 +75266,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_ref_or_deref_arg(v__gen__c__Gen* g, v v__gen__c__Gen_expr(g, arg.expr); v__gen__c__Gen_write(g, _SLIT("->val")); return; - } else if ((arg.expr)._typ == 287 /* v.ast.ArrayInit */) { + } else if ((arg.expr)._typ == 289 /* v.ast.ArrayInit */) { if ((*arg.expr._v__ast__ArrayInit).is_fixed) { if (!(*arg.expr._v__ast__ArrayInit).has_it) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*arg.expr._v__ast__ArrayInit).typ)}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -77509,7 +75508,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn string styp = v__gen__c__Gen_typ(g, node.val_type); v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); string cond_var = _SLIT(""); - if ((node.cond)._typ == 307 /* v.ast.Ident */ || (node.cond)._typ == 327 /* v.ast.SelectorExpr */) { + if ((node.cond)._typ == 309 /* v.ast.Ident */ || (node.cond)._typ == 329 /* v.ast.SelectorExpr */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { cond_var = v__gen__c__Gen_new_tmp_var(g); @@ -77527,7 +75526,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT(" = ((voidptr*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("];"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { string right = str_intp(5, _MOV((StrIntpData[]){{_SLIT("(("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("*)"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = op_field}}, {_SLIT("data)["), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT("]"), 0, { .d_c = 0 }}})); @@ -77541,7 +75540,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } else if (node.kind == v__ast__Kind__array_fixed) { string cond_var = _SLIT(""); bool cond_type_is_ptr = v__ast__Type_is_ptr(node.cond_type); - bool cond_is_literal = (node.cond)._typ == 287 /* v.ast.ArrayInit */; + bool cond_is_literal = (node.cond)._typ == 289 /* v.ast.ArrayInit */; if (cond_is_literal) { cond_var = v__gen__c__Gen_new_tmp_var(g); v__gen__c__Gen_write(g, v__gen__c__Gen_typ(g, node.cond_type)); @@ -77563,14 +75562,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } string idx = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__ast__TypeSymbol* cond_sym = v__ast__Table_sym(g->table, node.cond_type); - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((cond_sym->info)._v__ast__ArrayFixed,(cond_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_writeln(g, str_intp(5, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(" != "), /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT("; ++"), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); bool is_fixed_array = val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut; if (val_sym->kind == v__ast__Kind__function) { v__gen__c__Gen_write(g, _SLIT("\t")); - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); } else if (is_fixed_array) { string styp = v__gen__c__Gen_typ(g, node.val_type); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\t"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(node.val_var)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -77594,7 +75593,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } } else if (node.kind == v__ast__Kind__map) { string cond_var = _SLIT(""); - if ((node.cond)._typ == 307 /* v.ast.Ident */) { + if ((node.cond)._typ == 309 /* v.ast.Ident */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { cond_var = v__gen__c__Gen_new_tmp_var(g); @@ -77632,7 +75631,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn if (!string__eq(node.val_var, _SLIT("_"))) { v__ast__TypeSymbol* val_sym = v__ast__Table_sym(g->table, node.val_type); if (val_sym->kind == v__ast__Kind__function) { - v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 484) /*expected idx: 484, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); + v__gen__c__Gen_write_fn_ptr_decl(g, ADDR(v__ast__FnType/*qq*/, /* as */ *(v__ast__FnType*)__as_cast((val_sym->info)._v__ast__FnType,(val_sym->info)._typ, 486) /*expected idx: 486, name: v.ast.FnType */ ), v__gen__c__c_name(node.val_var)); v__gen__c__Gen_write(g, _SLIT(" = (*(voidptr*)")); v__gen__c__Gen_writeln(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT("DenseArray_value(&"), /*115 &string*/0xfe10, {.d_s = cond_var}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = arw_or_pt}}, {_SLIT("key_values, "), /*115 &string*/0xfe10, {.d_s = idx}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); } else if (val_sym->kind == v__ast__Kind__array_fixed && !node.val_is_mut) { @@ -77655,7 +75654,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn } g->indent--; } else if (node.kind == v__ast__Kind__string) { - v__ast__Expr cond = ((node.cond)._typ == 331 /* v.ast.StringLiteral */ || (node.cond)._typ == 330 /* v.ast.StringInterLiteral */ ? (v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, node.cond, _const_v__ast__string_type))))) : (node.cond)); + v__ast__Expr cond = ((node.cond)._typ == 333 /* v.ast.StringLiteral */ || (node.cond)._typ == 332 /* v.ast.StringInterLiteral */ ? (v__ast__CTempVar_to_sumtype_v__ast__Expr(ADDR(v__ast__CTempVar, (v__gen__c__Gen_new_ctemp_var_then_gen(g, node.cond, _const_v__ast__string_type))))) : (node.cond)); string field_accessor = (v__ast__Type_is_ptr(node.cond_type) ? (_SLIT("->")) : (_SLIT("."))); string i = ((string__eq(node.key_var, _SLIT("")) || string__eq(node.key_var, _SLIT("_"))) ? (v__gen__c__Gen_new_tmp_var(g)) : (node.key_var)); v__gen__c__Gen_write(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("for (int "), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT(" = 0; "), /*115 &string*/0xfe10, {.d_s = i}}, {_SLIT(" < "), 0, { .d_c = 0 }}}))); @@ -77692,7 +75691,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_for_in_stmt(v__gen__c__Gen* g, v__ast__ForIn string receiver_styp = v__gen__c__Gen_typ(g, receiver_typ); string fn_name = string__plus(string_replace_each(receiver_styp, new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT("*"), _SLIT(""), _SLIT("."), _SLIT("__")}))), _SLIT("_next")); v__ast__TypeSymbol* receiver_sym = v__ast__Table_sym(g->table, receiver_typ); - if ((receiver_sym->info)._typ == 457 /* v.ast.Struct */) { + if ((receiver_sym->info)._typ == 459 /* v.ast.Struct */) { if ((*receiver_sym->info._v__ast__Struct).concrete_types.len > 0) { fn_name = v__gen__c__Gen_generic_fn_name(g, (*receiver_sym->info._v__ast__Struct).concrete_types, fn_name, false); } @@ -77736,22 +75735,22 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_if(v__gen__c__Gen* g, v__ast } for (int _t2 = 0; _t2 < node.branches.len; ++_t2) { v__ast__IfBranch branch = ((v__ast__IfBranch*)node.branches.data)[_t2]; - if ((branch.cond)._typ == 309 /* v.ast.IfGuardExpr */ || branch.stmts.len > 1) { + if ((branch.cond)._typ == 311 /* v.ast.IfGuardExpr */ || branch.stmts.len > 1) { bool _t3 = true; return _t3; } if (branch.stmts.len == 1) { - if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 347 /* v.ast.ExprStmt */) { - v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ; + if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 349 /* v.ast.ExprStmt */) { + v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ; if (v__gen__c__is_noreturn_callexpr(stmt.expr)) { bool _t4 = true; return _t4; } - if ((stmt.expr)._typ == 317 /* v.ast.MatchExpr */) { + if ((stmt.expr)._typ == 319 /* v.ast.MatchExpr */) { bool _t5 = true; return _t5; } - if ((stmt.expr)._typ == 293 /* v.ast.CallExpr */) { + if ((stmt.expr)._typ == 295 /* v.ast.CallExpr */) { if ((*stmt.expr._v__ast__CallExpr).is_method) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, (*stmt.expr._v__ast__CallExpr).receiver_type); if (left_sym->kind == v__ast__Kind__array || left_sym->kind == v__ast__Kind__array_fixed || left_sym->kind == v__ast__Kind__map) { @@ -77823,13 +75822,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no for (int i = 0; i < node.branches.len; ++i) { v__ast__IfBranch branch = ((v__ast__IfBranch*)node.branches.data)[i]; v__ast__Expr cond = branch.cond; - if ((cond)._typ == 309 /* v.ast.IfGuardExpr */) { + if ((cond)._typ == 311 /* v.ast.IfGuardExpr */) { if (!is_guard) { is_guard = true; guard_idx = i; guard_vars = __new_array_with_default(node.branches.len, 0, sizeof(string), &(string[]){_SLIT("")}); } - if (((*cond._v__ast__IfGuardExpr).expr)._typ != 310 /* v.ast.IndexExpr */ && ((*cond._v__ast__IfGuardExpr).expr)._typ != 324 /* v.ast.PrefixExpr */) { + if (((*cond._v__ast__IfGuardExpr).expr)._typ != 312 /* v.ast.IndexExpr */ && ((*cond._v__ast__IfGuardExpr).expr)._typ != 326 /* v.ast.PrefixExpr */) { string var_name = v__gen__c__Gen_new_tmp_var(g); array_set(&guard_vars, i, &(string[]) { var_name }); v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_typ(g, (*cond._v__ast__IfGuardExpr).expr_type)}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); @@ -77849,7 +75848,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string cvar_name = (*(string*)/*ee elem_sym */array_get(guard_vars, guard_idx)); v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tIError err = "), /*115 &string*/0xfe10, {.d_s = cvar_name}}, {_SLIT(".err;"), 0, { .d_c = 0 }}}))); } - } else if ((branch.cond)._typ == 309 /* v.ast.IfGuardExpr */) { + } else if ((branch.cond)._typ == 311 /* v.ast.IfGuardExpr */) { string var_name = (*(string*)/*ee elem_sym */array_get(guard_vars, i)); bool short_opt = false; if ((var_name).len == 0) { @@ -77857,11 +75856,19 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no var_name = v__gen__c__Gen_new_tmp_var(g); array_set(&guard_vars, i, &(string[]) { var_name }); g->tmp_count--; - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + } else if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if (!"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".is_error) {"), 0, { .d_c = 0 }}}))); + } } else { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("if ("), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(" = "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*branch.cond._v__ast__IfGuardExpr).expr); - v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__optional)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", "), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".state == 0) {"), 0, { .d_c = 0 }}}))); + } else if (v__ast__Type_has_flag((*branch.cond._v__ast__IfGuardExpr).expr_type, v__ast__TypeFlag__result)) { + v__gen__c__Gen_writeln(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(", !"), /*115 &string*/0xfe10, {.d_s = var_name}}, {_SLIT(".is_error) {"), 0, { .d_c = 0 }}}))); + } } if (short_opt || !string__eq((*(v__ast__IfGuardVar*)/*ee elem_sym */array_get((*branch.cond._v__ast__IfGuardExpr).vars, 0)).name, _SLIT("_"))) { string base_type = v__gen__c__Gen_base_type(g, (*branch.cond._v__ast__IfGuardExpr).expr_type); @@ -77893,7 +75900,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no string left_var_name = v__gen__c__c_name(var.name); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, (*branch.cond._v__ast__IfGuardExpr).expr_type); if (sym->kind == v__ast__Kind__multi_return) { - v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 483) /*expected idx: 483, name: v.ast.MultiReturn */ ; + v__ast__MultiReturn mr_info = /* as */ *(v__ast__MultiReturn*)__as_cast((sym->info)._v__ast__MultiReturn,(sym->info)._typ, 485) /*expected idx: 485, name: v.ast.MultiReturn */ ; if (mr_info.types.len == (*branch.cond._v__ast__IfGuardExpr).vars.len) { string var_typ = v__gen__c__Gen_typ(g, (*(v__ast__Type*)/*ee elem_sym */array_get(mr_info.types, vi))); if (is_auto_heap) { @@ -77909,8 +75916,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no } } else { bool no_needs_par = false; - if ((branch.cond)._typ == 311 /* v.ast.InfixExpr */) { - if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_in && ((*branch.cond._v__ast__InfixExpr).left)._typ != 311 /* v.ast.InfixExpr */ && ((*branch.cond._v__ast__InfixExpr).right)._typ == 287 /* v.ast.ArrayInit */) { + if ((branch.cond)._typ == 313 /* v.ast.InfixExpr */) { + if ((*branch.cond._v__ast__InfixExpr).op == v__token__Kind__key_in && ((*branch.cond._v__ast__InfixExpr).left)._typ != 313 /* v.ast.InfixExpr */ && ((*branch.cond._v__ast__InfixExpr).right)._typ == 289 /* v.ast.ArrayInit */) { no_needs_par = true; } } @@ -77957,7 +75964,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_if_expr(v__gen__c__Gen* g, v__ast__IfExpr no } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_expr(v__gen__c__Gen* g, v__ast__IndexExpr node) { - if ((node.index)._typ == 325 /* v.ast.RangeExpr */) { + if ((node.index)._typ == 327 /* v.ast.RangeExpr */) { v__gen__c__Gen_range_expr(g, node, (*node.index._v__ast__RangeExpr)); } else { v__ast__TypeSymbol* sym = v__ast__Table_final_sym(g->table, v__gen__c__Gen_unwrap_generic(g, node.left_type)); @@ -78054,7 +76061,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE v__gen__c__Gen_write(g, tmp_left); } } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; string noscan = v__gen__c__Gen_check_noscan(g, info.elem_type); if (node.is_gated) { v__gen__c__Gen_write(g, _SLIT("array_slice_ni(")); @@ -78082,7 +76089,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE if (range.has_high) { v__gen__c__Gen_expr(g, range.high); } else if (sym->kind == v__ast__Kind__array_fixed) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym->info)._v__ast__ArrayFixed,(sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*100 &int*/0xfe07, {.d_i32 = info.size}}, {_SLIT0, 0, { .d_c = 0 }}}))); } else if (sym->kind == v__ast__Kind__array) { if (v__ast__Type_is_ptr(node.left_type)) { @@ -78108,7 +76115,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_range_expr(v__gen__c__Gen* g, v__ast__IndexE VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); - v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array info = /* as */ *(v__ast__Array*)__as_cast((sym.info)._v__ast__Array,(sym.info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); string elem_type_str = (elem_sym->kind == v__ast__Kind__function ? (_SLIT("voidptr")) : (v__gen__c__Gen_typ(g, info.elem_type))); @@ -78182,7 +76189,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In v__gen__c__Gen_write(g, _SLIT("/*2*/string_clone(")); } if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(")(*("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_sym */array_get("), 0, { .d_c = 0 }}}))); @@ -78246,10 +76253,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_array(v__gen__c__Gen* g, v__ast__In } VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { - v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + v__ast__ArrayFixed info = /* as */ *(v__ast__ArrayFixed*)__as_cast((sym.info)._v__ast__ArrayFixed,(sym.info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__ast__Type elem_type = info.elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); - bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 484 /* v.ast.FnType */; + bool is_fn_index_call = g->is_fn_index_call && (elem_sym->info)._typ == 486 /* v.ast.FnType */; if (is_fn_index_call) { v__gen__c__Gen_write(g, _SLIT("(*")); } @@ -78262,7 +76269,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__a } v__gen__c__Gen_write(g, _SLIT("[")); bool direct = g->fn_decl != 0 && g->fn_decl->is_direct_arr; - if ((direct || (node.index)._typ == 312 /* v.ast.IntegerLiteral */) || g->pref->translated) { + if ((direct || (node.index)._typ == 314 /* v.ast.IntegerLiteral */) || g->pref->translated) { v__gen__c__Gen_expr(g, node.index); } else { v__gen__c__Gen_write(g, _SLIT("v_fixed_index(")); @@ -78278,7 +76285,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_fixed_array(v__gen__c__Gen* g, v__a VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__IndexExpr node, v__ast__TypeSymbol sym) { bool gen_or = node.or_expr.kind != v__ast__OrKind__absent || node.is_option; bool left_is_ptr = v__ast__Type_is_ptr(node.left_type); - v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map info = /* as */ *(v__ast__Map*)__as_cast((sym.info)._v__ast__Map,(sym.info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; string key_type_str = v__gen__c__Gen_typ(g, info.key_type); v__ast__Type elem_type = info.value_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); @@ -78298,7 +76305,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde if (!left_is_ptr || v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f)) { v__gen__c__Gen_write(g, _SLIT("&")); } - if ((node.left)._typ == 310 /* v.ast.IndexExpr */) { + if ((node.left)._typ == 312 /* v.ast.IndexExpr */) { g->inside_map_index = true; v__gen__c__Gen_expr(g, node.left); g->inside_map_index = false; @@ -78358,7 +76365,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_index_of_map(v__gen__c__Gen* g, v__ast__Inde v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("* "), /*115 &string*/0xfe10, {.d_s = tmp_opt_ptr}}, {_SLIT(" = ("), /*115 &string*/0xfe10, {.d_s = elem_type_str}}, {_SLIT("*)/*ee elem_ptr_typ */(map_get_check("), 0, { .d_c = 0 }}}))); } else { if (g->is_fn_index_call) { - if ((elem_sym->info)._typ == 484 /* v.ast.FnType */) { + if ((elem_sym->info)._typ == 486 /* v.ast.FnType */) { v__gen__c__Gen_write(g, _SLIT("((")); v__gen__c__Gen_write_fn_ptr_decl(g, &(*elem_sym->info._v__ast__FnType), _SLIT("")); v__gen__c__Gen_write(g, _SLIT(")(*(voidptr*)map_get(")); @@ -78583,7 +76590,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr(v__gen__c__Gen* g, v__ast__InfixE VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arrow_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); string styp = left.sym->cname; - v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 481) /*expected idx: 481, name: v.ast.Chan */ ).elem_type; + v__ast__Type elem_type = (/* as */ *(v__ast__Chan*)__as_cast((left.sym->info)._v__ast__Chan,(left.sym->info)._typ, 483) /*expected idx: 483, name: v.ast.Chan */ ).elem_type; bool gen_or = node.or_block.kind != v__ast__OrKind__absent; string tmp_opt = (gen_or ? (v__gen__c__Gen_new_tmp_var(g)) : (_SLIT(""))); if (gen_or) { @@ -78610,10 +76617,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_defined_eq_operator = v__ast__Table_has_method(g->table, left.sym, _SLIT("==")); - bool has_alias_eq_op_overload = (left.sym->info)._typ == 472 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); + bool has_alias_eq_op_overload = (left.sym->info)._typ == 474 /* v.ast.Alias */ && v__ast__TypeSymbol_has_method(left.sym, _SLIT("==")); if ((v__ast__Type_is_ptr(left.typ) && v__ast__Type_is_int(right.typ)) || (v__ast__Type_is_ptr(right.typ) && v__ast__Type_is_int(left.typ))) { v__gen__c__Gen_gen_plain_infix_expr(g, node); - } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 331 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 331) /*expected idx: 331, name: v.ast.StringLiteral */ ).val).len == 0) { + } else if ((v__ast__Type_idx(left.typ) == _const_v__ast__string_type_idx || (!has_defined_eq_operator && v__ast__Type_idx(left.unaliased) == _const_v__ast__string_type_idx)) && (node.right)._typ == 333 /* v.ast.StringLiteral */ && ((/* as */ *(v__ast__StringLiteral*)__as_cast((node.right)._v__ast__StringLiteral,(node.right)._typ, 333) /*expected idx: 333, name: v.ast.StringLiteral */ ).val).len == 0) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT(")")); @@ -78695,7 +76702,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ if (v__ast__Type_is_ptr(left.typ)) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((node.left)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.left)._typ == 289 /* v.ast.ArrayInit */) { if (!(*node.left._v__ast__ArrayInit).has_it) { string s = v__gen__c__Gen_typ(g, left.unaliased); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -78703,7 +76710,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_eq_op(v__gen__c__Gen* g, v__ast__ } v__gen__c__Gen_expr(g, node.left); v__gen__c__Gen_write(g, _SLIT(", ")); - if ((node.right)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 289 /* v.ast.ArrayInit */) { if (!(*node.right._v__ast__ArrayInit).has_it) { string s = v__gen__c__Gen_typ(g, right.unaliased); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = s}}, {_SLIT(")"), 0, { .d_c = 0 }}}))); @@ -78847,11 +76854,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_cmp_op(v__gen__c__Gen* g, v__ast_ v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); bool has_operator_overloading = v__ast__Table_has_method(g->table, left.sym, _SLIT("<")); - if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).generic_types.len > 0) { + if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { if (node.op == v__token__Kind__le || node.op == v__token__Kind__ge) { v__gen__c__Gen_write(g, _SLIT("!")); } - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).concrete_types; + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(left.sym->cname, _SLIT("__lt")); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, method_name); @@ -78928,7 +76935,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } if (right.unaliased_sym->kind == v__ast__Kind__array) { if (left.sym->kind == v__ast__Kind__sum_type || left.sym->kind == v__ast__Kind__interface_) { - if ((node.right)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 289 /* v.ast.ArrayInit */) { if ((*node.right._v__ast__ArrayInit).exprs.len > 0 && !(v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, 0)))->kind == v__ast__Kind__sum_type || v__ast__Table_sym(g->table, (*(v__ast__Type*)/*ee elem_sym */array_get((*node.right._v__ast__ArrayInit).expr_types, 0)))->kind == v__ast__Kind__interface_)) { 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) { @@ -78941,7 +76948,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } } } - if ((node.right)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 289 /* v.ast.ArrayInit */) { v__ast__Type elem_type = (*node.right._v__ast__ArrayInit).elem_type; v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, elem_type); if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { @@ -78958,7 +76965,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 452 /* v.ast.Array */) { + if ((right.sym->info)._typ == 454 /* v.ast.Array */) { v__ast__Type elem_type = (*right.sym->info._v__ast__Array).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) { @@ -78994,7 +77001,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ v__gen__c__Gen_write(g, _SLIT(")")); } else if (right.unaliased_sym->kind == v__ast__Kind__array_fixed) { if (left.sym->kind == v__ast__Kind__sum_type || left.sym->kind == v__ast__Kind__interface_) { - if ((node.right)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 289 /* v.ast.ArrayInit */) { 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) { @@ -79007,7 +77014,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ } } } - if ((node.right)._typ == 287 /* v.ast.ArrayInit */) { + if ((node.right)._typ == 289 /* v.ast.ArrayInit */) { if ((*node.right._v__ast__ArrayInit).exprs.len > 0) { v__gen__c__Gen_write(g, _SLIT("(")); v__gen__c__Gen_infix_expr_in_optimization(g, node.left, (*node.right._v__ast__ArrayInit)); @@ -79015,7 +77022,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_in_op(v__gen__c__Gen* g, v__ast__ return; } } - if ((right.sym->info)._typ == 480 /* v.ast.ArrayFixed */) { + if ((right.sym->info)._typ == 482 /* 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) { @@ -79080,7 +77087,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); bool is_aggregate = left_sym->kind == v__ast__Kind__aggregate; if (is_aggregate) { - v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 470) /*expected idx: 470, name: v.ast.Aggregate */ ).sum_type; + v__ast__Type parent_left_type = (/* as */ *(v__ast__Aggregate*)__as_cast((left_sym->info)._v__ast__Aggregate,(left_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Aggregate */ ).sum_type; left_sym = v__ast__Table_sym(g->table, parent_left_type); } v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); @@ -79104,10 +77111,10 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ if (left_sym->kind == v__ast__Kind__interface_) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_typ "), /*115 &string*/0xfe10, {.d_s = cmp_op}}, {_SLIT(" "), 0, { .d_c = 0 }}}))); v__ast__Type _t1 = 0; - if (node.right._typ == 333 /* v.ast.TypeNode */) { + if (node.right._typ == 335 /* v.ast.TypeNode */) { _t1 = v__gen__c__Gen_unwrap_generic(g, (*node.right._v__ast__TypeNode).typ); } - else if (node.right._typ == 319 /* v.ast.None */) { + else if (node.right._typ == 321 /* v.ast.None */) { _t1 = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){_SLIT("None__")}, &(int[]){ 0 })); } @@ -79127,7 +77134,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_is_op(v__gen__c__Gen* g, v__ast__ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__ast__TypeSymbol* left_sym = v__ast__Table_sym(g->table, node.left_type); v__ast__TypeSymbol* right_sym = v__ast__Table_sym(g->table, node.right_type); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((left_sym->info)._v__ast__Interface,(left_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; Array_v__ast__Type* _t2 = (Array_v__ast__Type*)/*ee elem_ptr_typ */(map_get_check(ADDR(map, info.conversions), &(int[]){node.right_type})); _option_Array_v__ast__Type _t1 = {0}; if (_t2) { @@ -79173,8 +77180,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_interface_is_op(v__gen__c__Gen* g, v__as VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_arithmetic_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { v__gen__c__Type left = v__gen__c__Gen_unwrap(g, node.left_type); v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); - if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).generic_types.len > 0) { - Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ).concrete_types; + if (left.sym->kind == v__ast__Kind__struct_ && (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).generic_types.len > 0) { + Array_v__ast__Type concrete_types = (/* as */ *(v__ast__Struct*)__as_cast((left.sym->info)._v__ast__Struct,(left.sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ).concrete_types; string method_name = string__plus(string__plus(left.sym->cname, _SLIT("_")), v__util__replace_op(v__token__Kind_str(node.op))); method_name = v__gen__c__Gen_generic_fn_name(g, concrete_types, method_name, true); v__gen__c__Gen_write(g, method_name); @@ -79209,7 +77216,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, v__gen__c__Type right = v__gen__c__Gen_unwrap(g, node.right_type); if (left.unaliased_sym->kind == v__ast__Kind__array) { string tmp_var = v__gen__c__Gen_new_tmp_var(g); - v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left.unaliased_sym->info)._v__ast__Array,(left.unaliased_sym->info)._typ, 452) /*expected idx: 452, name: v.ast.Array */ ; + v__ast__Array array_info = /* as */ *(v__ast__Array*)__as_cast((left.unaliased_sym->info)._v__ast__Array,(left.unaliased_sym->info)._typ, 454) /*expected idx: 454, name: v.ast.Array */ ; string noscan = v__gen__c__Gen_check_noscan(g, array_info.elem_type); if (right.unaliased_sym->kind == v__ast__Kind__array && !v__ast__Type_alias_eq(array_info.elem_type, right.typ)) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("_PUSH_MANY"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("("), 0, { .d_c = 0 }}}))); @@ -79237,7 +77244,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, } else { string elem_type_str = v__gen__c__Gen_typ(g, array_info.elem_type); v__ast__TypeSymbol* elem_sym = v__ast__Table_sym(g->table, array_info.elem_type); - bool elem_is_array_var = (elem_sym->kind == v__ast__Kind__array || elem_sym->kind == v__ast__Kind__array_fixed) && (node.right)._typ == 307 /* v.ast.Ident */; + bool elem_is_array_var = (elem_sym->kind == v__ast__Kind__array || elem_sym->kind == v__ast__Kind__array_fixed) && (node.right)._typ == 309 /* v.ast.Ident */; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("array_push"), /*115 &string*/0xfe10, {.d_s = noscan}}, {_SLIT("((array*)"), 0, { .d_c = 0 }}}))); if (!v__ast__Type_is_ptr(left.typ) || (v__ast__Type_has_flag(node.left_type, v__ast__TypeFlag__shared_f) && !v__ast__Type_is_ptr(v__ast__Type_deref(node.left_type)))) { v__gen__c__Gen_write(g, _SLIT("&")); @@ -79274,37 +77281,37 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_left_shift_op(v__gen__c__Gen* g, } VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_array_call(v__gen__c__Gen* g, v__ast__Expr node) { - if (node._typ == 293 /* v.ast.CallExpr */) { + if (node._typ == 295 /* v.ast.CallExpr */) { if ((*node._v__ast__CallExpr).left_type != 0 && v__ast__Table_sym(g->table, (*node._v__ast__CallExpr).left_type)->kind == v__ast__Kind__array && (string__eq((*node._v__ast__CallExpr).name, _SLIT("all")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("any")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("filter")) || string__eq((*node._v__ast__CallExpr).name, _SLIT("map")))) { bool _t1 = true; return _t1; } } - else if (node._typ == 310 /* v.ast.IndexExpr */) { + else if (node._typ == 312 /* v.ast.IndexExpr */) { bool _t2 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__IndexExpr).left); return _t2; } - else if (node._typ == 311 /* v.ast.InfixExpr */) { + else if (node._typ == 313 /* v.ast.InfixExpr */) { bool _t3 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__InfixExpr).left) || v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__InfixExpr).right); return _t3; } - else if (node._typ == 322 /* v.ast.ParExpr */) { + else if (node._typ == 324 /* v.ast.ParExpr */) { bool _t4 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__ParExpr).expr); return _t4; } - else if (node._typ == 323 /* v.ast.PostfixExpr */) { + else if (node._typ == 325 /* v.ast.PostfixExpr */) { bool _t5 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__PostfixExpr).expr); return _t5; } - else if (node._typ == 324 /* v.ast.PrefixExpr */) { + else if (node._typ == 326 /* v.ast.PrefixExpr */) { bool _t6 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__PrefixExpr).right); return _t6; } - else if (node._typ == 325 /* v.ast.RangeExpr */) { + else if (node._typ == 327 /* v.ast.RangeExpr */) { bool _t7 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__RangeExpr).low) || v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__RangeExpr).high); return _t7; } - else if (node._typ == 327 /* v.ast.SelectorExpr */) { + else if (node._typ == 329 /* v.ast.SelectorExpr */) { bool _t8 = v__gen__c__Gen_need_tmp_var_in_array_call(g, (*node._v__ast__SelectorExpr).expr); return _t8; } @@ -79317,7 +77324,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_array_call(v__gen__c__Gen* g } VV_LOCAL_SYMBOL void v__gen__c__Gen_infix_expr_and_or_op(v__gen__c__Gen* g, v__ast__InfixExpr node) { - if ((node.right)._typ == 308 /* v.ast.IfExpr */) { + if ((node.right)._typ == 310 /* v.ast.IfExpr */) { int prev_inside_ternary = g->inside_ternary; g->inside_ternary = 0; if (v__gen__c__Gen_need_tmp_var_in_if(g, (*node.right._v__ast__IfExpr))) { @@ -79427,7 +77434,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { string init_styp = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT(" res"), 0, { .d_c = 0 }}})); if (sym->kind == v__ast__Kind__struct_) { int skips = 0; - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; for (int _t2 = 0; _t2 < info.fields.len; ++_t2) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t2]; for (int _t3 = 0; _t3 < field.attrs.len; ++_t3) { @@ -79454,13 +77461,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { strings__Builder_writeln(&dec, v__gen__c__Gen_decode_array(g, value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_array(g, value_type)); } else if (sym->kind == v__ast__Kind__map) { - v__ast__Map m = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 453) /*expected idx: 453, name: v.ast.Map */ ; + v__ast__Map m = /* as */ *(v__ast__Map*)__as_cast((sym->info)._v__ast__Map,(sym->info)._typ, 455) /*expected idx: 455, name: v.ast.Map */ ; v__gen__c__Gen_gen_json_for_type(g, m.key_type); v__gen__c__Gen_gen_json_for_type(g, m.value_type); strings__Builder_writeln(&dec, v__gen__c__Gen_decode_map(g, m.key_type, m.value_type)); strings__Builder_writeln(&enc, v__gen__c__Gen_encode_map(g, m.key_type, m.value_type)); } else if (sym->kind == v__ast__Kind__alias) { - v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias a = /* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; v__ast__Type parent_typ = a.parent_type; v__ast__TypeSymbol* psym = v__ast__Table_sym(g->table, parent_typ); if (v__gen__c__is_js_prim(v__gen__c__Gen_typ(g, parent_typ))) { @@ -79468,7 +77475,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { continue; } strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((psym->info)._typ == 457 /* v.ast.Struct */) { + if ((psym->info)._typ == 459 /* v.ast.Struct */) { v__gen__c__Gen_gen_struct_enc_dec(g, psym->info, styp, (voidptr)&/*qq*/enc, (voidptr)&/*qq*/dec); } else if (psym->kind == v__ast__Kind__sum_type) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" aliased sumtypes does not work at the moment"), 0, { .d_c = 0 }}}))); @@ -79479,14 +77486,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { } } else if (sym->kind == v__ast__Kind__sum_type) { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 476 /* v.ast.SumType */) { + if ((sym->info)._typ != 478 /* v.ast.SumType */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not a sumtype"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } v__gen__c__Gen_gen_sumtype_enc_dec(g, *sym, (voidptr)&/*qq*/enc, (voidptr)&/*qq*/dec); } else { strings__Builder_writeln(&enc, _SLIT("\to = cJSON_CreateObject();")); - if ((sym->info)._typ != 457 /* v.ast.Struct */) { + if ((sym->info)._typ != 459 /* v.ast.Struct */) { v__gen__c__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("json: "), /*115 &string*/0xfe10, {.d_s = sym->name}}, {_SLIT(" is not struct"), 0, { .d_c = 0 }}}))); VUNREACHABLE(); } @@ -79503,7 +77510,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_jsons(v__gen__c__Gen* g) { // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g, v__ast__TypeSymbol sym, strings__Builder* enc, strings__Builder* dec) { - v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ; + v__ast__SumType info = /* as */ *(v__ast__SumType*)__as_cast((sym.info)._v__ast__SumType,(sym.info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ; string type_var = v__gen__c__Gen_new_tmp_var(g); int typ = (*(int*)map_get(ADDR(map, g->table->type_idxs), &(string[]){sym.name}, &(int[]){ 0 })); #if !defined(CUSTOM_DEFINE_json_no_inline_sumtypes) @@ -79650,7 +77657,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_sumtype_enc_dec(v__gen__c__Gen* g // Attr: [inline] inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, v__ast__TypeInfo type_info, string styp, strings__Builder* enc, strings__Builder* dec) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_info)._v__ast__Struct,(type_info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_info)._v__ast__Struct,(type_info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; for (int _t1 = 0; _t1 < info.fields.len; ++_t1) { v__ast__StructField field = ((v__ast__StructField*)info.fields.data)[_t1]; string name = field.name; @@ -79692,33 +77699,81 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, if (v__gen__c__is_js_prim(field_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (field_sym->kind == v__ast__Kind__enum_) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (string__eq(field_sym->name, _SLIT("time.Time"))) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = time__unix(json__decode_u64(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT("));"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias alias = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; string parent_type = v__gen__c__Gen_typ(g, alias.parent_type); string parent_dec_name = v__gen__c__js_dec_name(parent_type); if (v__gen__c__is_js_prim(parent_type)) { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get(styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = parent_dec_name}}, {_SLIT(" (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(");"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } else { v__gen__c__Gen_gen_json_for_type(g, field.typ); string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } } else { string tmp = v__gen__c__Gen_new_tmp_var(g); v__gen__c__gen_js_get_opt(dec_name, field_type, styp, tmp, name, dec, is_required); + if (field.has_default_expr) { + strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif (jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(") {"), 0, { .d_c = 0 }}}))); + } strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = *("), /*115 &string*/0xfe10, {.d_s = field_type}}, {_SLIT("*) "), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(".data;"), 0, { .d_c = 0 }}}))); + if (field.has_default_expr) { + strings__Builder_writeln(dec, _SLIT("\t} else {")); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tres."), /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(field.name)}}, {_SLIT(" = "), /*115 &string*/0xfe10, {.d_s = v__gen__c__Gen_expr_string(g, field.default_expr)}}, {_SLIT(";"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, _SLIT("\t}")); + } } } string enc_name = v__gen__c__js_enc_name(field_type); @@ -79727,7 +77782,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } if (!v__gen__c__is_js_prim(field_type)) { if (field_sym->kind == v__ast__Kind__alias) { - v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ; + v__ast__Alias ainfo = /* as */ *(v__ast__Alias*)__as_cast((field_sym->info)._v__ast__Alias,(field_sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ; enc_name = v__gen__c__js_enc_name(v__gen__c__Gen_typ(g, ainfo.parent_type)); } } @@ -79744,7 +77799,7 @@ inline VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_struct_enc_dec(v__gen__c__Gen* g, } VV_LOCAL_SYMBOL void v__gen__c__gen_js_get(string styp, string tmp, string name, strings__Builder* dec, bool is_required) { - strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root,\""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); + strings__Builder_writeln(dec, str_intp(3, _MOV((StrIntpData[]){{_SLIT("\tcJSON *jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" = js_get(root, \""), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\");"), 0, { .d_c = 0 }}}))); if (is_required) { strings__Builder_writeln(dec, str_intp(2, _MOV((StrIntpData[]){{_SLIT("\tif(jsonroot_"), /*115 &string*/0xfe10, {.d_s = tmp}}, {_SLIT(" == 0) {"), 0, { .d_c = 0 }}}))); strings__Builder_writeln(dec, str_intp(4, _MOV((StrIntpData[]){{_SLIT("\t\treturn ("), /*115 &string*/0xfe10, {.d_s = _const_v__gen__c__option_name}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){ .state = 2, .err = _v_error(_SLIT(\"expected field \'"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("\' is missing\")), .data = {0} };"), 0, { .d_c = 0 }}}))); @@ -79803,11 +77858,11 @@ VV_LOCAL_SYMBOL string v__gen__c__Gen_decode_map(v__gen__c__Gen* g, v__ast__Type string styp = v__gen__c__Gen_typ(g, key_type); string styp_v = v__gen__c__Gen_typ(g, value_type); v__ast__TypeSymbol* key_type_symbol = v__ast__Table_sym(g->table, key_type); - multi_return_string_string_string_string mr_18986 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); - string hash_fn = mr_18986.arg0; - string key_eq_fn = mr_18986.arg1; - string clone_fn = mr_18986.arg2; - string free_fn = mr_18986.arg3; + multi_return_string_string_string_string mr_20487 = v__gen__c__Gen_map_fn_ptrs(g, *key_type_symbol); + string hash_fn = mr_20487.arg0; + string key_eq_fn = mr_20487.arg1; + string clone_fn = mr_20487.arg2; + string free_fn = mr_20487.arg3; string fn_name_v = v__gen__c__js_dec_name(styp_v); string s = _SLIT(""); if (v__gen__c__is_js_prim(styp_v)) { @@ -79941,9 +77996,9 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_need_tmp_var_in_match(v__gen__c__Gen* g, v__ return _t6; } if (branch.stmts.len == 1) { - if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 347 /* v.ast.ExprStmt */) { - v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ; - if (((stmt.expr)._typ == 293 /* v.ast.CallExpr */ || (stmt.expr)._typ == 308 /* v.ast.IfExpr */ || (stmt.expr)._typ == 317 /* v.ast.MatchExpr */) || ((stmt.expr)._typ == 310 /* v.ast.IndexExpr */ && (/* as */ *(v__ast__IndexExpr*)__as_cast((stmt.expr)._v__ast__IndexExpr,(stmt.expr)._typ, 310) /*expected idx: 310, name: v.ast.IndexExpr */ ).or_expr.kind != v__ast__OrKind__absent)) { + if (((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ == 349 /* v.ast.ExprStmt */) { + v__ast__ExprStmt stmt = /* as */ *(v__ast__ExprStmt*)__as_cast(((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._v__ast__ExprStmt,((*(v__ast__Stmt*)/*ee elem_sym */array_get(branch.stmts, 0)))._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ; + if (((stmt.expr)._typ == 295 /* v.ast.CallExpr */ || (stmt.expr)._typ == 310 /* v.ast.IfExpr */ || (stmt.expr)._typ == 319 /* v.ast.MatchExpr */) || ((stmt.expr)._typ == 312 /* v.ast.IndexExpr */ && (/* as */ *(v__ast__IndexExpr*)__as_cast((stmt.expr)._v__ast__IndexExpr,(stmt.expr)._typ, 312) /*expected idx: 312, name: v.ast.IndexExpr */ ).or_expr.kind != v__ast__OrKind__absent)) { bool _t7 = true; return _t7; } @@ -79975,7 +78030,7 @@ bool old; v__gen__c__Gen_match_expr_defer_0 = true; g->inside_match_optional = true; } - if ((node.cond)._typ == 307 /* v.ast.Ident */ || (node.cond)._typ == 327 /* v.ast.SelectorExpr */ || (node.cond)._typ == 312 /* v.ast.IntegerLiteral */ || (node.cond)._typ == 331 /* v.ast.StringLiteral */ || (node.cond)._typ == 305 /* v.ast.FloatLiteral */) { + if ((node.cond)._typ == 309 /* v.ast.Ident */ || (node.cond)._typ == 329 /* v.ast.SelectorExpr */ || (node.cond)._typ == 314 /* v.ast.IntegerLiteral */ || (node.cond)._typ == 333 /* v.ast.StringLiteral */ || (node.cond)._typ == 307 /* v.ast.FloatLiteral */) { cond_var = v__gen__c__Gen_expr_string(g, node.cond); } else { string _t1; /* if prepend */ @@ -80066,11 +78121,11 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == "), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, (*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index))); } else if (sym->kind == v__ast__Kind__interface_) { - if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 333 /* v.ast.TypeNode */) { - v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._v__ast__TypeNode,((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ, 333) /*expected idx: 333, name: v.ast.TypeNode */ ; + if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 335 /* v.ast.TypeNode */) { + v__ast__TypeNode typ = /* as */ *(v__ast__TypeNode*)__as_cast(((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._v__ast__TypeNode,((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ, 335) /*expected idx: 335, name: v.ast.TypeNode */ ; v__ast__TypeSymbol* branch_sym = v__ast__Table_sym(g->table, v__gen__c__Gen_unwrap_generic(g, typ.typ)); v__gen__c__Gen_write(g, str_intp(4, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == _"), /*115 &string*/0xfe10, {.d_s = sym->cname}}, {_SLIT("_"), /*115 &string*/0xfe10, {.d_s = branch_sym->cname}}, {_SLIT("_index"), 0, { .d_c = 0 }}}))); - } else if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 319 /* v.ast.None */ && sym->idx == _const_v__ast__error_type_idx) { + } else if (((*(v__ast__Expr*)/*ee elem_sym */array_get(branch.exprs, sumtype_index)))._typ == 321 /* v.ast.None */ && sym->idx == _const_v__ast__error_type_idx) { v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = dot_or_ptr}}, {_SLIT("_typ == _IError_None___index"), 0, { .d_c = 0 }}}))); } } @@ -80100,7 +78155,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_sumtype(v__gen__c__Gen* g, v__ast VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast__MatchExpr node, bool is_expr, string cond_var, string tmp_var, v__ast__TypeSymbol enum_typ) { string cname = str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = enum_typ.cname}}, {_SLIT("__"), 0, { .d_c = 0 }}})); - Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); + Array_string covered_enum = __new_array_with_default(0, (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.len, sizeof(string), 0); Array_v__ast__MatchBranch range_branches = __new_array_with_default(0, node.branches.len, sizeof(v__ast__MatchBranch), 0); bool default_generated = false; g->empty_line = true; @@ -80109,8 +78164,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ for (int _t1 = 0; _t1 < node.branches.len; ++_t1) { v__ast__MatchBranch branch = ((v__ast__MatchBranch*)node.branches.data)[_t1]; if (branch.is_else) { - for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ).vals.len; ++_t2) { - string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 486) /*expected idx: 486, name: v.ast.Enum */ ).vals.data)[_t2]; + for (int _t2 = 0; _t2 < (/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.len; ++_t2) { + string val = ((string*)(/* as */ *(v__ast__Enum*)__as_cast((enum_typ.info)._v__ast__Enum,(enum_typ.info)._typ, 488) /*expected idx: 488, name: v.ast.Enum */ ).vals.data)[_t2]; if (!Array_string_contains(covered_enum, val)) { v__gen__c__Gen_writeln(g, str_intp(3, _MOV((StrIntpData[]){{_SLIT("case "), /*115 &string*/0xfe10, {.d_s = cname}}, {_SLIT0, /*115 &string*/0xfe10, {.d_s = val}}, {_SLIT(":"), 0, { .d_c = 0 }}}))); } @@ -80127,9 +78182,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ if (i > 0) { v__gen__c__Gen_write(g, _SLIT(" || ")); } - if ((expr)._typ == 325 /* v.ast.RangeExpr */) { + if ((expr)._typ == 327 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 312 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 314 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -80162,7 +78217,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ int _t4_len = _t4_orig.len; for (int _t5 = 0; _t5 < _t4_len; ++_t5) { v__ast__Expr it = ((v__ast__Expr*) _t4_orig.data)[_t5]; - if ((it)._typ == 325 /* v.ast.RangeExpr */) { + if ((it)._typ == 327 /* v.ast.RangeExpr */) { _t4 = true; break; } @@ -80173,7 +78228,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ } for (int _t7 = 0; _t7 < branch.exprs.len; ++_t7) { v__ast__Expr expr = ((v__ast__Expr*)branch.exprs.data)[_t7]; - if ((expr)._typ == 304 /* v.ast.EnumVal */) { + if ((expr)._typ == 306 /* v.ast.EnumVal */) { array_push((array*)&covered_enum, _MOV((string[]){ string_clone((*expr._v__ast__EnumVal).val) })); v__gen__c__Gen_write(g, _SLIT("case ")); v__gen__c__Gen_expr(g, expr); @@ -80203,9 +78258,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_switch(v__gen__c__Gen* g, v__ast_ if (i > 0) { v__gen__c__Gen_write(g, _SLIT(" || ")); } - if ((expr)._typ == 325 /* v.ast.RangeExpr */) { + if ((expr)._typ == 327 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 312 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 314 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -80306,9 +78361,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_match_expr_classic(v__gen__c__Gen* g, v__ast v__gen__c__Gen_write(g, _SLIT(")")); } else { - if ((expr)._typ == 325 /* v.ast.RangeExpr */) { + if ((expr)._typ == 327 /* v.ast.RangeExpr */) { bool skip_low = false; - if (((*expr._v__ast__RangeExpr).low)._typ == 312 /* v.ast.IntegerLiteral */) { + if (((*expr._v__ast__RangeExpr).low)._typ == 314 /* v.ast.IntegerLiteral */) { if ((v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u16_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u32_type) || v__ast__Type_alias_eq(node.cond_type, _const_v__ast__u64_type)) && string__eq((*(*expr._v__ast__RangeExpr).low._v__ast__IntegerLiteral).val, _SLIT("0"))) { skip_low = true; } @@ -80721,23 +78776,23 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_delete(v__gen__c__Gen* g, v__ast__SqlStm } VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_expr_to_orm_primitive(v__gen__c__Gen* g, v__ast__Expr expr) { - if (expr._typ == 311 /* v.ast.InfixExpr */) { + if (expr._typ == 313 /* v.ast.InfixExpr */) { v__gen__c__Gen_sql_write_orm_primitive(g, v__ast__Table_find_type_idx(g->table, _SLIT("orm.InfixType")), expr); } - else if (expr._typ == 331 /* v.ast.StringLiteral */) { + else if (expr._typ == 333 /* v.ast.StringLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__string_type, expr); } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__int_type, expr); } - else if (expr._typ == 291 /* v.ast.BoolLiteral */) { + else if (expr._typ == 293 /* v.ast.BoolLiteral */) { v__gen__c__Gen_sql_write_orm_primitive(g, _const_v__ast__bool_type, expr); } - else if (expr._typ == 307 /* v.ast.Ident */) { - v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast(((*expr._v__ast__Ident).info)._v__ast__IdentVar,((*expr._v__ast__Ident).info)._typ, 417) /*expected idx: 417, name: v.ast.IdentVar */ ; + else if (expr._typ == 309 /* v.ast.Ident */) { + v__ast__IdentVar info = /* as */ *(v__ast__IdentVar*)__as_cast(((*expr._v__ast__Ident).info)._v__ast__IdentVar,((*expr._v__ast__Ident).info)._typ, 419) /*expected idx: 419, name: v.ast.IdentVar */ ; v__gen__c__Gen_sql_write_orm_primitive(g, info.typ, expr); } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { v__gen__c__Gen_sql_write_orm_primitive(g, (*expr._v__ast__SelectorExpr).typ, expr); } @@ -80764,7 +78819,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_write_orm_primitive(v__gen__c__Gen* g, v typ = _SLIT("infix"); } v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("orm__"), /*115 &string*/0xfe10, {.d_s = typ}}, {_SLIT("_to_primitive("), 0, { .d_c = 0 }}}))); - if ((expr)._typ == 311 /* v.ast.InfixExpr */) { + if ((expr)._typ == 313 /* v.ast.InfixExpr */) { v__gen__c__Gen_write(g, _SLIT("(orm__InfixType){")); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT(".name = _SLIT(\""), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*expr._v__ast__InfixExpr).left)}}, {_SLIT("\"),"), 0, { .d_c = 0 }}}))); string kind = (((*expr._v__ast__InfixExpr).op == (v__token__Kind__plus))? (_SLIT("orm__MathOperationKind__add")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__minus))? (_SLIT("orm__MathOperationKind__sub")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__div))? (_SLIT("orm__MathOperationKind__div")) : ((*expr._v__ast__InfixExpr).op == (v__token__Kind__mul))? (_SLIT("orm__MathOperationKind__mul")) : (_SLIT(""))); @@ -80779,7 +78834,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_write_orm_primitive(v__gen__c__Gen* g, v } VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_where_data(v__gen__c__Gen* g, v__ast__Expr expr, Array_string* fields, Array_string* kinds, Array_v__ast__Expr* data, Array_bool* is_and) { - if (expr._typ == 311 /* v.ast.InfixExpr */) { + if (expr._typ == 313 /* v.ast.InfixExpr */) { g->sql_side = v__gen__c__SqlExprSide__left; v__gen__c__Gen_sql_where_data(g, (*expr._v__ast__InfixExpr).left, fields, kinds, data, is_and); string _t1 = (string){.str=(byteptr)"", .is_lit=1}; @@ -80939,29 +78994,29 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_where_data(v__gen__c__Gen* g, v__ast__Ex kind = _SLIT("orm__OperationKind__eq"); } } - if (((*expr._v__ast__InfixExpr).left)._typ != 311 /* v.ast.InfixExpr */ && ((*expr._v__ast__InfixExpr).right)._typ != 311 /* v.ast.InfixExpr */) { + if (((*expr._v__ast__InfixExpr).left)._typ != 313 /* v.ast.InfixExpr */ && ((*expr._v__ast__InfixExpr).right)._typ != 313 /* v.ast.InfixExpr */) { array_push((array*)kinds, _MOV((string[]){ string_clone(kind) })); } g->sql_side = v__gen__c__SqlExprSide__right; v__gen__c__Gen_sql_where_data(g, (*expr._v__ast__InfixExpr).right, fields, kinds, data, is_and); } - else if (expr._typ == 307 /* v.ast.Ident */) { + else if (expr._typ == 309 /* v.ast.Ident */) { if (g->sql_side == v__gen__c__SqlExprSide__left) { array_push((array*)fields, _MOV((string[]){ string_clone(v__gen__c__Gen_get_field_name(g, v__gen__c__Gen_get_struct_field(g, (*expr._v__ast__Ident).name))) })); } else { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } } - else if (expr._typ == 331 /* v.ast.StringLiteral */) { + else if (expr._typ == 333 /* v.ast.StringLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } - else if (expr._typ == 291 /* v.ast.BoolLiteral */) { + else if (expr._typ == 293 /* v.ast.BoolLiteral */) { array_push((array*)data, _MOV((v__ast__Expr[]){ expr })); } @@ -81217,12 +79272,12 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, field.typ); if (sym->kind == v__ast__Kind__struct_ && !string__eq(sym->name, _SLIT("time.Time"))) { v__ast__SqlExpr sub = (*(v__ast__SqlExpr*)map_get(ADDR(map, node.sub_structs), &(int[]){((int)(field.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),} })); - v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ; - v__ast__Ident ident = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ; + v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ; + v__ast__Ident ident = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ; string name = sel; int s = v__ast__Table_find_type_idx(g->table, _SLIT("orm.Primitive")); if (s != 0) { - if ((ident.info)._typ == 417 /* v.ast.IdentVar */) { + if ((ident.info)._typ == 419 /* v.ast.IdentVar */) { (*ident.info._v__ast__IdentVar).typ = s; } } @@ -81245,9 +79300,9 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp v__ast__Array info = v__ast__TypeSymbol_array_info(sym); v__ast__Type arr_typ = info.elem_type; v__ast__SqlExpr sub = (*(v__ast__SqlExpr*)map_get(ADDR(map, node.sub_structs), &(int[]){((int)(arr_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),} })); - v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ; - v__ast__Ident l = /* as */ *(v__ast__Ident*)__as_cast((where_expr.left)._v__ast__Ident,(where_expr.left)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ; - v__ast__Ident r = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 307) /*expected idx: 307, name: v.ast.Ident */ ; + v__ast__InfixExpr where_expr = /* as */ *(v__ast__InfixExpr*)__as_cast((sub.where_expr)._v__ast__InfixExpr,(sub.where_expr)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ; + v__ast__Ident l = /* as */ *(v__ast__Ident*)__as_cast((where_expr.left)._v__ast__Ident,(where_expr.left)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ; + v__ast__Ident r = /* as */ *(v__ast__Ident*)__as_cast((where_expr.right)._v__ast__Ident,(where_expr.right)._typ, 309) /*expected idx: 309, name: v.ast.Ident */ ; l.name = fkey; r.name = tmp; where_expr.left = v__ast__Ident_to_sumtype_v__ast__Expr(&l); @@ -81258,7 +79313,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp .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, 417) /*expected idx: 417, name: v.ast.IdentVar */ ).typ, + .expr_type = (/* as */ *(v__ast__IdentVar*)__as_cast((r.info)._v__ast__IdentVar,(r.info)._typ, 419) /*expected idx: 419, name: v.ast.IdentVar */ ).typ, .typ = _const_v__ast__int_type, .name_type = 0, .next_token = 0, @@ -81307,13 +79362,13 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_sql_select(v__gen__c__Gen* g, v__ast__SqlExp } VV_LOCAL_SYMBOL v__gen__c__SqlType v__gen__c__Gen_parse_db_type(v__gen__c__Gen* g, v__ast__Expr expr) { - if (expr._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).info)._typ == 417 /* v.ast.IdentVar */) { + if (expr._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).info)._typ == 419 /* v.ast.IdentVar */) { v__gen__c__SqlType _t1 = v__gen__c__Gen_parse_db_from_type_string(g, v__ast__Table_get_type_name(g->table, (*(*expr._v__ast__Ident).info._v__ast__IdentVar).typ)); return _t1; } } - else if (expr._typ == 327 /* v.ast.SelectorExpr */) { + else if (expr._typ == 329 /* v.ast.SelectorExpr */) { v__gen__c__SqlType _t2 = v__gen__c__Gen_parse_db_from_type_string(g, v__ast__Table_get_type_name(g->table, (*expr._v__ast__SelectorExpr).typ)); return _t2; } @@ -81406,7 +79461,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_string_literal(v__gen__c__Gen* g, v__ast__St } VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal_sb_optimized(v__gen__c__Gen* g, v__ast__CallExpr call_expr) { - v__ast__StringInterLiteral node = /* as */ *(v__ast__StringInterLiteral*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._v__ast__StringInterLiteral,((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._typ, 330) /*expected idx: 330, name: v.ast.StringInterLiteral */ ; + v__ast__StringInterLiteral node = /* as */ *(v__ast__StringInterLiteral*)__as_cast(((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._v__ast__StringInterLiteral,((*(v__ast__CallArg*)/*ee elem_sym */array_get(call_expr.args, 0)).expr)._typ, 332) /*expected idx: 332, name: v.ast.StringInterLiteral */ ; v__gen__c__Gen_writeln(g, _SLIT("// sb inter opt")); bool is_nl = string__eq(call_expr.name, _SLIT("writeln")); for (int i = 0; i < node.vals.len; ++i) { @@ -81447,7 +79502,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast typ = v__ast__Type_set_nr_muls(v__ast__Type_clear_flag(typ, v__ast__TypeFlag__shared_f), 0); } v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); - if ((sym->info)._typ == 472 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { + if ((sym->info)._typ == 474 /* v.ast.Alias */ && !v__ast__TypeSymbol_has_method(sym, _SLIT("str"))) { v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(g->table, (*sym->info._v__ast__Alias).parent_type); if (v__ast__TypeSymbol_has_method(parent_sym, _SLIT("str"))) { typ = (*sym->info._v__ast__Alias).parent_type; @@ -81473,7 +79528,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast } else if (sym->kind == v__ast__Kind__none_) { v__gen__c__Gen_write(g, _SLIT("_SLIT(\"\")")); } else if (sym->kind == v__ast__Kind__enum_) { - if ((expr)._typ != 304 /* v.ast.EnumVal */) { + if ((expr)._typ != 306 /* v.ast.EnumVal */) { string str_fn_name = v__gen__c__Gen_get_str_fn(g, typ); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = str_fn_name}}, {_SLIT("("), 0, { .d_c = 0 }}}))); v__gen__c__Gen_enum_expr(g, expr); @@ -81496,7 +79551,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_gen_expr_to_string(v__gen__c__Gen* g, v__ast } else if ((!str_method_expects_ptr && is_ptr && !is_shared) || is_var_mut) { v__gen__c__Gen_write(g, _SLIT("*")); } - if ((expr)._typ == 287 /* v.ast.ArrayInit */) { + if ((expr)._typ == 289 /* v.ast.ArrayInit */) { if ((*expr._v__ast__ArrayInit).is_fixed) { string s = v__gen__c__Gen_typ(g, (*expr._v__ast__ArrayInit).typ); if (!(*expr._v__ast__ArrayInit).has_it) { @@ -81531,7 +79586,7 @@ VV_LOCAL_SYMBOL multi_return_u64_string v__gen__c__Gen_str_format(v__gen__c__Gen v__ast__Type typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)/*ee elem_sym */array_get(node.expr_types, i))); v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, typ); if (sym->kind == v__ast__Kind__alias) { - typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + typ = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; } bool remove_tail_zeros = false; u8 fspec = (*(u8*)/*ee elem_sym */array_get(node.fmts, i)); @@ -81652,7 +79707,7 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt } v__gen__c__Gen_expr(g, expr); } - } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ )), _SLIT("str"))) { + } else if (typ_sym->kind == v__ast__Kind__interface_ && v__ast__Interface_defines_method(ADDR(v__ast__Interface, (/* as */ *(v__ast__Interface*)__as_cast((typ_sym->info)._v__ast__Interface,(typ_sym->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ )), _SLIT("str"))) { string rec_type_name = v__util__no_dots(v__gen__c__Gen_cc_type(g, typ, false)); v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = v__gen__c__c_name(rec_type_name)}}, {_SLIT("_name_table["), 0, { .d_c = 0 }}}))); v__gen__c__Gen_expr(g, expr); @@ -81663,14 +79718,14 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_str_val(v__gen__c__Gen* g, v__ast__StringInt v__gen__c__Gen_write(g, _SLIT(")")); } else if ((*(u8*)/*ee elem_sym */array_get(node.fmts, i)) == 's' || v__ast__Type_has_flag(typ, v__ast__TypeFlag__variadic)) { v__ast__Type exp_typ = typ; - if ((expr)._typ == 307 /* v.ast.Ident */) { - if (((*expr._v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { + if (((*expr._v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { if (g->comptime_var_type_map.len > 0 || g->comptime_for_method.len > 0) { exp_typ = (*(*expr._v__ast__Ident).obj._v__ast__Var).typ; } else if ((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts.len > 0) { exp_typ = v__gen__c__Gen_unwrap_generic(g, (*(v__ast__Type*)array_last((*(*expr._v__ast__Ident).obj._v__ast__Var).smartcasts))); v__ast__TypeSymbol* cast_sym = v__ast__Table_sym(g->table, exp_typ); - if ((cast_sym->info)._typ == 470 /* v.ast.Aggregate */) { + if ((cast_sym->info)._typ == 472 /* v.ast.Aggregate */) { exp_typ = (*(v__ast__Type*)/*ee elem_sym */array_get((*cast_sym->info._v__ast__Aggregate).types, g->aggregate_type_idx)); } } @@ -81712,8 +79767,8 @@ VV_LOCAL_SYMBOL void v__gen__c__Gen_string_inter_literal(v__gen__c__Gen* g, v__a v__ast__StringInterLiteral node_ = node; for (int i = 0; i < node_.exprs.len; ++i) { v__ast__Expr* expr = ((v__ast__Expr*)node_.exprs.data) + i; - if ((expr)->_typ == 307 /* v.ast.Ident */) { - if (((*expr->_v__ast__Ident).obj)._typ == 365 /* v.ast.Var */) { + if ((expr)->_typ == 309 /* v.ast.Ident */) { + if (((*expr->_v__ast__Ident).obj)._typ == 367 /* v.ast.Var */) { array_set(&node_.expr_types, i, &(v__ast__Type[]) { (*(*expr->_v__ast__Ident).obj._v__ast__Var).typ }); } } @@ -81789,7 +79844,8 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; v__gen__c__Gen_write(g, str_intp(2, _MOV((StrIntpData[]){{_SLIT("("), /*115 &string*/0xfe10, {.d_s = styp}}, {_SLIT("){"), 0, { .d_c = 0 }}}))); } } - Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int inited_fields = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; if (is_multiline) { g->indent++; } @@ -81835,7 +79891,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; g->is_shared = old_is_shared; int nr_fields = 1; if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; nr_fields = info.fields.len; if (info.is_union && node.fields.len > 1) { v__gen__c__verror(_SLIT("union must not have more than 1 initializer")); @@ -81872,7 +79928,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; v__ast__TypeSymbol* embed_sym = v__ast__Table_sym(g->table, embed); string embed_name = v__ast__TypeSymbol_embed_name(embed_sym); if (!_IN_MAP(ADDR(string, embed_name), ADDR(map, inited_fields))) { - v__ast__Struct embed_info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct embed_info = /* as */ *(v__ast__Struct*)__as_cast((embed_sym->info)._v__ast__Struct,(embed_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; Array_string _t6 = {0}; Array_v__ast__StructField _t6_orig = embed_info.fields; int _t6_len = _t6_orig.len; @@ -81928,7 +79984,7 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; if (!v__ast__Type_has_flag(field->typ, v__ast__TypeFlag__shared_f)) { g->is_shared = false; } - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { int found_equal_fields = 0; for (int _t14 = 0; _t14 < (*sym->info._v__ast__Struct).fields.len; ++_t14) { v__ast__StructField* sifield = ((v__ast__StructField*)(*sym->info._v__ast__Struct).fields.data) + _t14; @@ -81959,8 +80015,8 @@ bool v__gen__c__Gen_struct_init_defer_0 = false; if (!cloned) { int inside_cast_in_heap = g->inside_cast_in_heap; g->inside_cast_in_heap = 0; - if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 307 /* v.ast.Ident */) { - v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 480) /*expected idx: 480, name: v.ast.ArrayFixed */ ; + if (field_type_sym->kind == v__ast__Kind__array_fixed && (sfield.expr)._typ == 309 /* v.ast.Ident */) { + v__ast__ArrayFixed fixed_array_info = /* as */ *(v__ast__ArrayFixed*)__as_cast((field_type_sym->info)._v__ast__ArrayFixed,(field_type_sym->info)._typ, 482) /*expected idx: 482, name: v.ast.ArrayFixed */ ; v__gen__c__Gen_write(g, _SLIT("{")); for (int i = 0; i < fixed_array_info.size; ++i) { v__gen__c__Gen_expr(g, sfield.expr); @@ -82070,7 +80126,7 @@ if (v__gen__c__Gen_struct_init_defer_0) { VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast__StructField field) { v__ast__TypeSymbol* sym = v__ast__Table_sym(g->table, field.typ); if (sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((sym->info)._v__ast__Struct,(sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (info.fields.len == 0) { bool _t1 = false; return _t1; @@ -82094,7 +80150,7 @@ VV_LOCAL_SYMBOL bool v__gen__c__Gen_zero_struct_field(v__gen__c__Gen* g, v__ast_ VV_LOCAL_SYMBOL bool v__gen__c__Gen_is_empty_struct(v__gen__c__Gen* g, v__gen__c__Type t) { v__ast__TypeSymbol* sym = t.unaliased_sym; - if (sym->info._typ == 457 /* v.ast.Struct */) { + if (sym->info._typ == 459 /* v.ast.Struct */) { if ((*sym->info._v__ast__Struct).fields.len > 0 || (*sym->info._v__ast__Struct).embeds.len > 0) { bool _t1 = false; return _t1; @@ -83745,10 +81801,10 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; // Defer end return _t1; } - if (val._typ == 307 /* v.ast.Ident */) { + if (val._typ == 309 /* v.ast.Ident */) { for (int _t2 = 0; _t2 < exprs.len; ++_t2) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t2]; - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { if (string__eq((*expr._v__ast__Ident).name, (*val._v__ast__Ident).name) && (*expr._v__ast__Ident).kind != v__ast__IdentKind__blank_ident) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable: `"), /*115 &string*/0xfe10, {.d_s = (*val._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*val._v__ast__Ident).pos); _option_void _t3 = (_option_void){ .state=2, .err=_v_error( str_intp(2, _MOV((StrIntpData[]){{_SLIT("undefined variable: `"), /*115 &string*/0xfe10, {.d_s = (*val._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}}))), .data={EMPTY_STRUCT_INITIALIZATION} }; @@ -83762,7 +81818,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 287 /* v.ast.ArrayInit */) { + else if (val._typ == 289 /* v.ast.ArrayInit */) { if ((*val._v__ast__ArrayInit).has_cap) { _option_void _t4 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__ArrayInit).cap_expr); if (_t4.state != 0 && _t4.err._typ != _IError_None___index) { @@ -83772,7 +81828,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t5; - memcpy(&_t5, &_t4, sizeof(Option)); + memcpy(&_t5, &_t4, sizeof(_option)); return _t5; } @@ -83787,7 +81843,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t7; - memcpy(&_t7, &_t6, sizeof(Option)); + memcpy(&_t7, &_t6, sizeof(_option)); return _t7; } @@ -83802,7 +81858,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t9; - memcpy(&_t9, &_t8, sizeof(Option)); + memcpy(&_t9, &_t8, sizeof(_option)); return _t9; } @@ -83818,14 +81874,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t12; - memcpy(&_t12, &_t11, sizeof(Option)); + memcpy(&_t12, &_t11, sizeof(_option)); return _t12; } ; } } - else if (val._typ == 293 /* v.ast.CallExpr */) { + else if (val._typ == 295 /* v.ast.CallExpr */) { _option_void _t13 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__CallExpr).left); if (_t13.state != 0 && _t13.err._typ != _IError_None___index) { // Defer begin @@ -83834,7 +81890,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t14; - memcpy(&_t14, &_t13, sizeof(Option)); + memcpy(&_t14, &_t13, sizeof(_option)); return _t14; } @@ -83849,14 +81905,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t17; - memcpy(&_t17, &_t16, sizeof(Option)); + memcpy(&_t17, &_t16, sizeof(_option)); return _t17; } ; } } - else if (val._typ == 311 /* v.ast.InfixExpr */) { + else if (val._typ == 313 /* v.ast.InfixExpr */) { _option_void _t18 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__InfixExpr).left); if (_t18.state != 0 && _t18.err._typ != _IError_None___index) { // Defer begin @@ -83865,7 +81921,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t19; - memcpy(&_t19, &_t18, sizeof(Option)); + memcpy(&_t19, &_t18, sizeof(_option)); return _t19; } @@ -83878,13 +81934,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t21; - memcpy(&_t21, &_t20, sizeof(Option)); + memcpy(&_t21, &_t20, sizeof(_option)); return _t21; } ; } - else if (val._typ == 308 /* v.ast.IfExpr */) { + else if (val._typ == 310 /* v.ast.IfExpr */) { _option_void _t22 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__IfExpr).left); if (_t22.state != 0 && _t22.err._typ != _IError_None___index) { // Defer begin @@ -83893,7 +81949,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t23; - memcpy(&_t23, &_t22, sizeof(Option)); + memcpy(&_t23, &_t22, sizeof(_option)); return _t23; } @@ -83908,14 +81964,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t26; - memcpy(&_t26, &_t25, sizeof(Option)); + memcpy(&_t26, &_t25, sizeof(_option)); return _t26; } ; for (int _t27 = 0; _t27 < branch.stmts.len; ++_t27) { v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t27]; - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { _option_void _t28 = v__parser__Parser_check_undefined_variables(p, exprs, (*stmt._v__ast__ExprStmt).expr); if (_t28.state != 0 && _t28.err._typ != _IError_None___index) { // Defer begin @@ -83924,7 +81980,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t29; - memcpy(&_t29, &_t28, sizeof(Option)); + memcpy(&_t29, &_t28, sizeof(_option)); return _t29; } @@ -83933,7 +81989,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 316 /* v.ast.MapInit */) { + else if (val._typ == 318 /* v.ast.MapInit */) { for (int _t30 = 0; _t30 < (*val._v__ast__MapInit).keys.len; ++_t30) { v__ast__Expr key = ((v__ast__Expr*)(*val._v__ast__MapInit).keys.data)[_t30]; _option_void _t31 = v__parser__Parser_check_undefined_variables(p, exprs, key); @@ -83944,7 +82000,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t32; - memcpy(&_t32, &_t31, sizeof(Option)); + memcpy(&_t32, &_t31, sizeof(_option)); return _t32; } @@ -83960,14 +82016,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t35; - memcpy(&_t35, &_t34, sizeof(Option)); + memcpy(&_t35, &_t34, sizeof(_option)); return _t35; } ; } } - else if (val._typ == 317 /* v.ast.MatchExpr */) { + else if (val._typ == 319 /* v.ast.MatchExpr */) { _option_void _t36 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__MatchExpr).cond); if (_t36.state != 0 && _t36.err._typ != _IError_None___index) { // Defer begin @@ -83976,7 +82032,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t37; - memcpy(&_t37, &_t36, sizeof(Option)); + memcpy(&_t37, &_t36, sizeof(_option)); return _t37; } @@ -83993,7 +82049,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t41; - memcpy(&_t41, &_t40, sizeof(Option)); + memcpy(&_t41, &_t40, sizeof(_option)); return _t41; } @@ -84001,7 +82057,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } for (int _t42 = 0; _t42 < branch.stmts.len; ++_t42) { v__ast__Stmt stmt = ((v__ast__Stmt*)branch.stmts.data)[_t42]; - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { _option_void _t43 = v__parser__Parser_check_undefined_variables(p, exprs, (*stmt._v__ast__ExprStmt).expr); if (_t43.state != 0 && _t43.err._typ != _IError_None___index) { // Defer begin @@ -84010,7 +82066,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t44; - memcpy(&_t44, &_t43, sizeof(Option)); + memcpy(&_t44, &_t43, sizeof(_option)); return _t44; } @@ -84019,7 +82075,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } } } - else if (val._typ == 322 /* v.ast.ParExpr */) { + else if (val._typ == 324 /* v.ast.ParExpr */) { _option_void _t45 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__ParExpr).expr); if (_t45.state != 0 && _t45.err._typ != _IError_None___index) { // Defer begin @@ -84028,13 +82084,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t46; - memcpy(&_t46, &_t45, sizeof(Option)); + memcpy(&_t46, &_t45, sizeof(_option)); return _t46; } ; } - else if (val._typ == 323 /* v.ast.PostfixExpr */) { + else if (val._typ == 325 /* v.ast.PostfixExpr */) { _option_void _t47 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); if (_t47.state != 0 && _t47.err._typ != _IError_None___index) { // Defer begin @@ -84043,13 +82099,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t48; - memcpy(&_t48, &_t47, sizeof(Option)); + memcpy(&_t48, &_t47, sizeof(_option)); return _t48; } ; } - else if (val._typ == 324 /* v.ast.PrefixExpr */) { + else if (val._typ == 326 /* v.ast.PrefixExpr */) { _option_void _t49 = v__parser__Parser_check_undefined_variables(p, exprs, (*val._v__ast__PrefixExpr).right); if (_t49.state != 0 && _t49.err._typ != _IError_None___index) { // Defer begin @@ -84058,13 +82114,13 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t50; - memcpy(&_t50, &_t49, sizeof(Option)); + memcpy(&_t50, &_t49, sizeof(_option)); return _t50; } ; } - else if (val._typ == 330 /* v.ast.StringInterLiteral */) { + else if (val._typ == 332 /* v.ast.StringInterLiteral */) { for (int _t51 = 0; _t51 < (*val._v__ast__StringInterLiteral).exprs.len; ++_t51) { v__ast__Expr expr_ = ((v__ast__Expr*)(*val._v__ast__StringInterLiteral).exprs.data)[_t51]; _option_void _t52 = v__parser__Parser_check_undefined_variables(p, exprs, expr_); @@ -84075,14 +82131,14 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t53; - memcpy(&_t53, &_t52, sizeof(Option)); + memcpy(&_t53, &_t52, sizeof(_option)); return _t53; } ; } } - else if (val._typ == 332 /* v.ast.StructInit */) { + else if (val._typ == 334 /* v.ast.StructInit */) { for (int _t54 = 0; _t54 < (*val._v__ast__StructInit).fields.len; ++_t54) { v__ast__StructInitField field = ((v__ast__StructInitField*)(*val._v__ast__StructInit).fields.data)[_t54]; _option_void _t55 = v__parser__Parser_check_undefined_variables(p, exprs, field.expr); @@ -84093,7 +82149,7 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; } // Defer end _option_void _t56; - memcpy(&_t56, &_t55, sizeof(Option)); + memcpy(&_t56, &_t55, sizeof(_option)); return _t56; } @@ -84114,10 +82170,10 @@ bool v__parser__Parser_check_undefined_variables_defer_0 = false; VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* p, Array_v__ast__Expr exprs, v__ast__Expr val) { string val_str = v__ast__Expr_str(val); - if (val._typ == 307 /* v.ast.Ident */) { + if (val._typ == 309 /* v.ast.Ident */) { for (int _t1 = 0; _t1 < exprs.len; ++_t1) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t1]; - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { if (string__eq((*expr._v__ast__Ident).name, (*val._v__ast__Ident).name)) { bool _t2 = true; return _t2; @@ -84125,7 +82181,7 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* } } } - else if (val._typ == 310 /* v.ast.IndexExpr */) { + else if (val._typ == 312 /* v.ast.IndexExpr */) { for (int _t3 = 0; _t3 < exprs.len; ++_t3) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t3]; if (string__eq(v__ast__Expr_str(expr), val_str)) { @@ -84134,19 +82190,19 @@ VV_LOCAL_SYMBOL bool v__parser__Parser_check_cross_variables(v__parser__Parser* } } } - else if (val._typ == 311 /* v.ast.InfixExpr */) { + else if (val._typ == 313 /* v.ast.InfixExpr */) { bool _t5 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).left) || v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__InfixExpr).right); return _t5; } - else if (val._typ == 324 /* v.ast.PrefixExpr */) { + else if (val._typ == 326 /* v.ast.PrefixExpr */) { bool _t6 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PrefixExpr).right); return _t6; } - else if (val._typ == 323 /* v.ast.PostfixExpr */) { + else if (val._typ == 325 /* v.ast.PostfixExpr */) { bool _t7 = v__parser__Parser_check_cross_variables(p, exprs, (*val._v__ast__PostfixExpr).expr); return _t7; } - else if (val._typ == 327 /* v.ast.SelectorExpr */) { + else if (val._typ == 329 /* v.ast.SelectorExpr */) { for (int _t8 = 0; _t8 < exprs.len; ++_t8) { v__ast__Expr expr = ((v__ast__Expr*)exprs.data)[_t8]; if (string__eq(v__ast__Expr_str(expr), val_str)) { @@ -84184,14 +82240,14 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa for (int i = 0; i < left.len; ++i) { v__ast__Expr lx_ = ((v__ast__Expr*)left.data)[i]; v__ast__Expr lx = lx_; - if (lx._typ == 307 /* v.ast.Ident */) { + if (lx._typ == 309 /* v.ast.Ident */) { if (op == v__token__Kind__decl_assign) { if (v__ast__Scope_known_var(p->scope, (*lx._v__ast__Ident).name)) { v__ast__Stmt _t4 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("redefinition of `"), /*115 &string*/0xfe10, {.d_s = (*lx._v__ast__Ident).name}}, {_SLIT("`"), 0, { .d_c = 0 }}})), (*lx._v__ast__Ident).pos)))); return _t4; } v__ast__ShareType share = ((v__ast__ShareType)(0)); - if (((*lx._v__ast__Ident).info)._typ == 417 /* v.ast.IdentVar */) { + if (((*lx._v__ast__Ident).info)._typ == 419 /* v.ast.IdentVar */) { share = (*(*lx._v__ast__Ident).info._v__ast__IdentVar).share; if ((*(*lx._v__ast__Ident).info._v__ast__IdentVar).is_static) { if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !p->inside_unsafe_fn) { @@ -84226,7 +82282,7 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa .is_stack_obj = p->inside_for, }); if (p->pref->autofree) { - if ((r0)._typ == 293 /* v.ast.CallExpr */) { + if ((r0)._typ == 295 /* v.ast.CallExpr */) { if ((*r0._v__ast__CallExpr).or_block.pos.pos > 0 && (*r0._v__ast__CallExpr).or_block.stmts.len > 0) { v.is_or = true; } @@ -84237,18 +82293,18 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_partial_assign_stmt(v__parser__Pa v__ast__Scope_register(p->scope, obj); } } - else if (lx._typ == 310 /* v.ast.IndexExpr */) { + else if (lx._typ == 312 /* v.ast.IndexExpr */) { if (op == v__token__Kind__decl_assign) { v__ast__Stmt _t6 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, str_intp(3, _MOV((StrIntpData[]){{_SLIT("non-name `"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*lx._v__ast__IndexExpr).left)}}, {_SLIT("["), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*lx._v__ast__IndexExpr).index)}}, {_SLIT("]` on left side of `:=`"), 0, { .d_c = 0 }}})), (*lx._v__ast__IndexExpr).pos)))); return _t6; } (*lx._v__ast__IndexExpr).is_setter = true; } - else if (lx._typ == 322 /* v.ast.ParExpr */) { + else if (lx._typ == 324 /* v.ast.ParExpr */) { } - else if (lx._typ == 324 /* v.ast.PrefixExpr */) { + else if (lx._typ == 326 /* v.ast.PrefixExpr */) { } - else if (lx._typ == 327 /* v.ast.SelectorExpr */) { + else if (lx._typ == 329 /* v.ast.SelectorExpr */) { if (op == v__token__Kind__decl_assign) { v__ast__Stmt _t7 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("struct fields can only be declared during the initialization"), (*lx._v__ast__SelectorExpr).pos)))); return _t7; @@ -85102,6 +83158,10 @@ bool inside_array_lit; v__token__Pos pos = v__token__Token_pos(&p->tok); bool is_known_var = v__parser__Parser_mark_var_as_used(p, p->tok.lit) || v__ast__Scope_known_const(p->table->global_scope, string__plus(string__plus(p->mod, _SLIT(".")), p->tok.lit)); bool is_type = v__parser__Parser_known_import(p, p->tok.lit) || v__token__Kind_is_start_of_type(p->tok.kind) || (p->tok.lit.len > 0 && u8_is_capital(string_at(p->tok.lit, 0))); + if ((string__eq(p->tok.lit, _SLIT("c")) || string__eq(p->tok.lit, _SLIT("r"))) && p->peek_tok.kind == v__token__Kind__string) { + is_known_var = false; + is_type = false; + } if (is_known_var || !is_type) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); if (is_reftype) { @@ -85359,7 +83419,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr node = v__ast__IndexExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IndexExpr, (v__parser__Parser_index_expr(p, node, false)))); } p->is_stmt_ident = is_stmt_ident; - if (p->tok.kind == v__token__Kind__lpar && p->tok.line_nr == p->prev_tok.line_nr && (node)._typ == 310 /* v.ast.IndexExpr */) { + if (p->tok.kind == v__token__Kind__lpar && p->tok.line_nr == p->prev_tok.line_nr && (node)._typ == 312 /* v.ast.IndexExpr */) { v__parser__Parser_next(p); v__token__Pos pos = v__token__Token_pos(&p->tok); Array_v__ast__CallArg args = v__parser__Parser_call_args(p); @@ -85383,7 +83443,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr v__parser__Parser_next(p); v__ast__Expr right = v__parser__Parser_expr(p, precedence - 1); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); - if ((node)._typ == 310 /* v.ast.IndexExpr */) { + if ((node)._typ == 312 /* 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){.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,})))); @@ -85409,7 +83469,7 @@ v__ast__Expr v__parser__Parser_expr_with_left(v__parser__Parser* p, v__ast__Expr if ((p->tok.kind == v__token__Kind__inc || p->tok.kind == v__token__Kind__dec) && p->prev_tok.line_nr != p->tok.line_nr) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &v.token.Token*/0xfe10, {.d_s = v__token__Token_str(p->tok)}}, {_SLIT(" must be on the same line as the previous token"), 0, { .d_c = 0 }}})), v__token__Token_pos(&p->tok)); } - if ((node)._typ == 310 /* v.ast.IndexExpr */) { + if ((node)._typ == 312 /* v.ast.IndexExpr */) { v__ast__IndexExpr_recursive_mapset_is_setter(&(*node._v__ast__IndexExpr), true); } node = v__ast__PostfixExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__PostfixExpr, (((v__ast__PostfixExpr){.op = p->tok.kind,.pos = v__token__Token_pos(&p->tok),.expr = node,.auto_locked = (string){.str=(byteptr)"", .is_lit=1},})))); @@ -85449,7 +83509,7 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_infix_expr(v__parser__Parser* p, p->inside_in_array = false; } p->expecting_type = prev_expecting_type; - if (p->pref->is_vet && (op == v__token__Kind__key_in || op == v__token__Kind__not_in) && (right)._typ == 287 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((right)._v__ast__ArrayInit,(right)._typ, 287) /*expected idx: 287, name: v.ast.ArrayInit */ ).exprs.len == 1) { + if (p->pref->is_vet && (op == v__token__Kind__key_in || op == v__token__Kind__not_in) && (right)._typ == 289 /* v.ast.ArrayInit */ && (/* as */ *(v__ast__ArrayInit*)__as_cast((right)._v__ast__ArrayInit,(right)._typ, 289) /*expected idx: 289, name: v.ast.ArrayInit */ ).exprs.len == 1) { v__parser__Parser_vet_error(p, _SLIT("Use `var == value` instead of `var in [value]`"), pos.line_nr, v__vet__FixKind__vfmt, v__vet__ErrorType__default); } Array_v__ast__Stmt or_stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); @@ -85512,27 +83572,27 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_prefix_expr(v__parser__Parser* p) v__ast__Expr right = v__parser__Parser_expr(p, ((int)(v__token__Precedence__prefix))); p->is_amp = false; if (op == v__token__Kind__amp) { - if ((right)._typ == 294 /* v.ast.CastExpr */) { + if ((right)._typ == 296 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*right._v__ast__CastExpr), pos); v__ast__Expr _t1 = v__ast__CastExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__CastExpr)); return _t1; } - if ((right)._typ == 327 /* v.ast.SelectorExpr */) { - if (((*right._v__ast__SelectorExpr).expr)._typ == 294 /* v.ast.CastExpr */) { + if ((right)._typ == 329 /* v.ast.SelectorExpr */) { + if (((*right._v__ast__SelectorExpr).expr)._typ == 296 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*(*right._v__ast__SelectorExpr).expr._v__ast__CastExpr), pos); v__ast__Expr _t2 = v__ast__SelectorExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__SelectorExpr)); return _t2; } } - if ((right)._typ == 310 /* v.ast.IndexExpr */) { - if (((*right._v__ast__IndexExpr).left)._typ == 294 /* v.ast.CastExpr */) { + if ((right)._typ == 312 /* v.ast.IndexExpr */) { + if (((*right._v__ast__IndexExpr).left)._typ == 296 /* v.ast.CastExpr */) { v__parser__Parser_recast_as_pointer(p, (voidptr)&/*qq*/(*(*right._v__ast__IndexExpr).left._v__ast__CastExpr), pos); v__ast__Expr _t3 = v__ast__IndexExpr_to_sumtype_v__ast__Expr(&(*right._v__ast__IndexExpr)); return _t3; } } - if ((right)._typ == 322 /* v.ast.ParExpr */) { - if (((*right._v__ast__ParExpr).expr)._typ == 332 /* v.ast.StructInit */) { + if ((right)._typ == 324 /* v.ast.ParExpr */) { + if (((*right._v__ast__ParExpr).expr)._typ == 334 /* v.ast.StructInit */) { v__parser__Parser_note_with_pos(p, str_intp(3, _MOV((StrIntpData[]){{_SLIT("unnecessary `()`, use `&"), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*right._v__ast__ParExpr).expr)}}, {_SLIT("` instead of `&("), /*115 &v.ast.Expr*/0xfe10, {.d_s = v__ast__Expr_str((*right._v__ast__ParExpr).expr)}}, {_SLIT(")`"), 0, { .d_c = 0 }}})), (*right._v__ast__ParExpr).pos); right = (*right._v__ast__ParExpr).expr; } @@ -85582,7 +83642,6 @@ string old_expr_mod; v__ast__OrKind or_kind = v__ast__OrKind__absent; if (string__eq(fn_name, _SLIT("json.decode"))) { p->expecting_type = true; - or_kind = v__ast__OrKind__block; } old_expr_mod = p->expr_mod; v__parser__Parser_call_expr_defer_0 = true; @@ -85695,7 +83754,7 @@ Array_v__ast__CallArg v__parser__Parser_call_args(v__parser__Parser* p) { if (array_decompose) { expr = v__ast__ArrayDecompose_to_sumtype_v__ast__Expr(ADDR(v__ast__ArrayDecompose, (((v__ast__ArrayDecompose){.pos = v__token__Token_pos(&p->tok),.expr = expr,.expr_type = 0,.arg_type = 0,})))); } - if ((expr)._typ == 332 /* v.ast.StructInit */) { + if ((expr)._typ == 334 /* v.ast.StructInit */) { _PUSH_MANY(&(*expr._v__ast__StructInit).pre_comments, (comments), _t2, Array_v__ast__Comment); comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); } @@ -85850,7 +83909,7 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { if (is_method) { bool is_duplicate = v__ast__TypeSymbol_has_method(type_sym, name); if (type_sym->kind == v__ast__Kind__interface_ && is_duplicate) { - if ((type_sym->info)._typ == 475 /* v.ast.Interface */) { + if ((type_sym->info)._typ == 477 /* v.ast.Interface */) { is_duplicate = !v__ast__Interface_has_method(&(*type_sym->info._v__ast__Interface), name); } } @@ -85880,11 +83939,11 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { 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); - Array_string generic_names = mr_8890.arg1; + multi_return_Array_v__ast__Type_Array_string mr_8871 = v__parser__Parser_parse_generic_types(p); + Array_string generic_names = mr_8871.arg1; if (is_method && v__ast__Type_has_flag(rec.typ, v__ast__TypeFlag__generic)) { v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, rec.typ); - if ((sym->info)._typ == 457 /* v.ast.Struct */) { + if ((sym->info)._typ == 459 /* v.ast.Struct */) { Array_string fn_generic_names = array_clone_to_depth(&generic_names, 0); Array_string _t11 = {0}; Array_v__ast__Type _t11_orig = (*sym->info._v__ast__Struct).generic_types; @@ -85905,10 +83964,10 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { } } } - multi_return_Array_v__ast__Param_bool_bool mr_9364 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_9364.arg0; - bool are_args_type_only = mr_9364.arg1; - bool is_variadic = mr_9364.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_9345 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_9345.arg0; + bool are_args_type_only = mr_9345.arg1; + bool is_variadic = mr_9345.arg2; if (is_c2v_variadic) { is_variadic = true; } @@ -85953,6 +84012,10 @@ VV_LOCAL_SYMBOL v__ast__FnDecl v__parser__Parser_fn_decl(v__parser__Parser* p) { p->inside_fn_return = false; return_type_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->prev_tok)); } + if (p->tok.kind == v__token__Kind__comma) { + v__token__Pos mr_pos = v__token__Pos_extend(return_type_pos, v__token__Token_pos(&p->peek_tok)); + v__parser__Parser_error_with_pos(p, _SLIT("multiple return types in function declaration must use parentheses, .e.g (int, string)"), mr_pos); + } int type_sym_method_idx = 0; bool no_body = p->tok.kind != v__token__Kind__lcbr; v__token__Pos end_pos = v__token__Token_pos(&p->prev_tok); @@ -86203,7 +84266,7 @@ bool v__parser__Parser_fn_receiver_defer_0 = false; v__ast__TypeSymbol* type_sym = v__ast__Table_sym(p->table, rec->typ); bool is_auto_rec = false; if (type_sym->kind == v__ast__Kind__struct_) { - v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 457) /*expected idx: 457, name: v.ast.Struct */ ; + v__ast__Struct info = /* as */ *(v__ast__Struct*)__as_cast((type_sym->info)._v__ast__Struct,(type_sym->info)._typ, 459) /*expected idx: 459, name: v.ast.Struct */ ; if (!rec->is_mut && !v__ast__Type_is_ptr(rec->typ) && info.fields.len > 8) { rec->typ = v__ast__Type_ref(rec->typ); is_auto_rec = true; @@ -86250,9 +84313,9 @@ bool v__parser__Parser_anon_fn_defer_0 = false; v__parser__Parser_anon_fn_defer_0 = true; p->scope->detached_from_parent = true; Array_v__ast__Param inherited_vars = (p->tok.kind == v__token__Kind__lsbr ? (v__parser__Parser_closure_vars(p)) : (__new_array_with_default(0, 0, sizeof(v__ast__Param), 0))); - multi_return_Array_v__ast__Param_bool_bool mr_18748 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args = mr_18748.arg0; - bool is_variadic = mr_18748.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_18932 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args = mr_18932.arg0; + bool is_variadic = mr_18932.arg2; for (int _t2 = 0; _t2 < args.len; ++_t2) { v__ast__Param arg = ((v__ast__Param*)args.data)[_t2]; if (arg.name.len == 0 && v__ast__Table_sym(p->table, arg.typ)->kind != v__ast__Kind__placeholder) { @@ -86552,7 +84615,7 @@ VV_LOCAL_SYMBOL v__ast__GoExpr v__parser__Parser_go_expr(v__parser__Parser* p) { v__token__Pos spos = v__token__Token_pos(&p->tok); v__ast__Expr expr = v__parser__Parser_expr(p, 0); v__ast__CallExpr _t1; /* if prepend */ - if ((expr)._typ == 293 /* v.ast.CallExpr */) { + if ((expr)._typ == 295 /* v.ast.CallExpr */) { _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)); @@ -86612,7 +84675,7 @@ VV_LOCAL_SYMBOL void v__parser__Parser_check_fn_mutable_arguments(v__parser__Par return; } if (sym->kind == v__ast__Kind__alias) { - v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 472) /*expected idx: 472, name: v.ast.Alias */ ).parent_type; + v__ast__Type atyp = (/* as */ *(v__ast__Alias*)__as_cast((sym->info)._v__ast__Alias,(sym->info)._typ, 474) /*expected idx: 474, name: v.ast.Alias */ ).parent_type; v__parser__Parser_check_fn_mutable_arguments(p, atyp, pos); return; } @@ -86935,7 +84998,7 @@ bool was_inside_ct_if_expr; v__parser__Parser_check(p, v__token__Kind__decl_assign); _PUSH_MANY(&comments, (v__parser__Parser_eat_comments(p, ((v__parser__EatCommentsConfig){.same_line = 0,.follow_up = 0,}))), _t9, Array_v__ast__Comment); v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if (!((expr)._typ == 293 /* v.ast.CallExpr */ || (expr)._typ == 310 /* v.ast.IndexExpr */ || (expr)._typ == 324 /* v.ast.PrefixExpr */)) { + if (!((expr)._typ == 295 /* v.ast.CallExpr */ || (expr)._typ == 312 /* v.ast.IndexExpr */ || (expr)._typ == 326 /* v.ast.PrefixExpr */)) { v__parser__Parser_error_with_pos(p, _SLIT("if guard condition expression is illegal, it should return optional"), v__ast__Expr_pos(expr)); } cond = v__ast__IfGuardExpr_to_sumtype_v__ast__Expr(ADDR(v__ast__IfGuardExpr, (((v__ast__IfGuardExpr){.vars = vars,.expr = expr,.expr_type = 0,})))); @@ -87209,14 +85272,14 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars } p->inside_match = false; p->inside_select = false; - if (stmt._typ == 347 /* v.ast.ExprStmt */) { + if (stmt._typ == 349 /* v.ast.ExprStmt */) { bool check_timeout = false; if (!(*stmt._v__ast__ExprStmt).is_expr) { v__parser__Parser_error_with_pos(p, _SLIT("select: invalid expression"), (*stmt._v__ast__ExprStmt).pos); v__ast__SelectExpr _t4 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); return _t4; } else { - if ((*stmt._v__ast__ExprStmt).expr._typ == 311 /* v.ast.InfixExpr */) { + if ((*stmt._v__ast__ExprStmt).expr._typ == 313 /* v.ast.InfixExpr */) { if ((*(*stmt._v__ast__ExprStmt).expr._v__ast__InfixExpr).op != v__token__Kind__arrow) { check_timeout = true; } else if (is_gt) { @@ -87244,9 +85307,9 @@ VV_LOCAL_SYMBOL v__ast__SelectExpr v__parser__Parser_select_expr(v__parser__Pars has_timeout = true; } } - else if (stmt._typ == 339 /* v.ast.AssignStmt */) { + else if (stmt._typ == 341 /* v.ast.AssignStmt */) { v__ast__Expr expr = (*(v__ast__Expr*)/*ee elem_sym */array_get((*stmt._v__ast__AssignStmt).right, 0)); - if (expr._typ == 324 /* v.ast.PrefixExpr */) { + if (expr._typ == 326 /* v.ast.PrefixExpr */) { if ((*expr._v__ast__PrefixExpr).op != v__token__Kind__arrow) { v__parser__Parser_error_with_pos(p, _SLIT("select key: `<-` operator expected"), (*expr._v__ast__PrefixExpr).pos); v__ast__SelectExpr _t7 = ((v__ast__SelectExpr){.branches = __new_array(0, 0, sizeof(v__ast__SelectBranch)),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.has_exception = 0,.is_expr = 0,.expected_type = 0,}); @@ -87359,7 +85422,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Expr_Array_v__ast__Comment v__parser_ Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); for (;;) { v__ast__Expr expr = v__parser__Parser_lockable(p); - if ((expr)._typ == 297 /* v.ast.Comment */) { + if ((expr)._typ == 299 /* v.ast.Comment */) { array_push((array*)&comments, _MOV((v__ast__Comment[]){ (*expr._v__ast__Comment) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); @@ -87482,21 +85545,21 @@ v__ast__Type v__parser__Parser_parse_array_type(v__parser__Parser* p, v__token__ if (p->pref->is_fmt) { fixed_size = 987654321; } else { - if (size_expr._typ == 312 /* v.ast.IntegerLiteral */) { + if (size_expr._typ == 314 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*size_expr._v__ast__IntegerLiteral).val); } - else if (size_expr._typ == 307 /* v.ast.Ident */) { + else if (size_expr._typ == 309 /* v.ast.Ident */) { bool show_non_const_error = false; _option_v__ast__ConstField_ptr _t1; if (_t1 = v__ast__Scope_find_const(p->table->global_scope, str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = p->mod}}, {_SLIT("."), /*115 &string*/0xfe10, {.d_s = (*size_expr._v__ast__Ident).name}}, {_SLIT0, 0, { .d_c = 0 }}}))), _t1.state == 0) { v__ast__ConstField* const_field = *(v__ast__ConstField**)_t1.data; - if ((const_field->expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((const_field->expr)._typ == 314 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*const_field->expr._v__ast__IntegerLiteral).val); } else { - if ((const_field->expr)._typ == 311 /* v.ast.InfixExpr */) { + if ((const_field->expr)._typ == 313 /* v.ast.InfixExpr */) { v__transformer__Transformer* t = v__transformer__new_transformer(p->pref); v__ast__Expr folded_expr = v__transformer__Transformer_infix_expr(t, (voidptr)&/*qq*/(*const_field->expr._v__ast__InfixExpr)); - if ((folded_expr)._typ == 312 /* v.ast.IntegerLiteral */) { + if ((folded_expr)._typ == 314 /* v.ast.IntegerLiteral */) { fixed_size = string_int((*folded_expr._v__ast__IntegerLiteral).val); } else { show_non_const_error = true; @@ -87938,7 +86001,7 @@ v__ast__Type v__parser__Parser_parse_type(v__parser__Parser* p) { return _t4; } v__ast__TypeSymbol* sym = v__ast__Table_sym(p->table, typ); - if (is_optional && (sym->info)._typ == 476 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 476) /*expected idx: 476, name: v.ast.SumType */ ).is_anon) { + if (is_optional && (sym->info)._typ == 478 /* v.ast.SumType */ && (/* as */ *(v__ast__SumType*)__as_cast((sym->info)._v__ast__SumType,(sym->info)._typ, 478) /*expected idx: 478, name: v.ast.SumType */ ).is_anon) { v__parser__Parser_error_with_pos(p, _SLIT("an inline sum type cannot be optional"), v__token__Pos_extend(optional_pos, v__token__Token_pos(&p->prev_tok))); } } @@ -88200,21 +86263,21 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str parent_idx = v__ast__Table_add_placeholder_type(p->table, name, v__ast__Language__v); } v__ast__TypeSymbol* parent_sym = v__ast__Table_sym(p->table, v__ast__new_type(parent_idx)); - if (parent_sym->info._typ == 457 /* v.ast.Struct */) { + if (parent_sym->info._typ == 459 /* v.ast.Struct */) { if ((*parent_sym->info._v__ast__Struct).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic struct, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Struct).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of struct `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 475 /* v.ast.Interface */) { + else if (parent_sym->info._typ == 477 /* v.ast.Interface */) { if ((*parent_sym->info._v__ast__Interface).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("interface `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic interface, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__Interface).generic_types.len != concrete_types.len) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("the number of generic types of interfce `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is inconsistent with the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } } - else if (parent_sym->info._typ == 476 /* v.ast.SumType */) { + else if (parent_sym->info._typ == 478 /* v.ast.SumType */) { if ((*parent_sym->info._v__ast__SumType).generic_types.len == 0) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("sumtype `"), /*115 &string*/0xfe10, {.d_s = parent_sym->name}}, {_SLIT("` is not a generic sumtype, cannot instantiate to the concrete types"), 0, { .d_c = 0 }}})), concrete_types_pos); } else if ((*parent_sym->info._v__ast__SumType).generic_types.len != concrete_types.len) { @@ -88235,7 +86298,7 @@ v__ast__Type v__parser__Parser_parse_generic_inst_type(v__parser__Parser* p, str v__ast__Stmt v__parser__parse_stmt(string text, v__ast__Table* table, v__ast__Scope* scope) { bool v__parser__parse_stmt_defer_0 = false; - v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.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,.script_mode = 0,}); + v__parser__Parser p = ((v__parser__Parser){.imports = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.imported_symbols = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),.tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.prev_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.peek_tok = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.script_mode_start_token = (v__token__Token){.lit = (string){.str=(byteptr)"", .is_lit=1},.line_nr = 0,.col = 0,.pos = 0,.len = 0,.tidx = 0,},.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.ast_imports = __new_array(0, 0, sizeof(v__ast__Import)),.used_imports = __new_array(0, 0, sizeof(string)),.auto_imports = __new_array(0, 0, sizeof(string)),.errors = __new_array(0, 0, sizeof(v__errors__Error)),.warnings = __new_array(0, 0, sizeof(v__errors__Warning)),.notices = __new_array(0, 0, sizeof(v__errors__Notice)),.vet_errors = __new_array(0, 0, sizeof(v__vet__Error)),.label_names = __new_array(0, 0, sizeof(string)),.global_labels = __new_array(0, 0, sizeof(string)),.defer_vars = __new_array(0, 0, sizeof(v__ast__Ident)),.struct_init_generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.if_cond_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.file_base = (string){.str=(byteptr)"", .is_lit=1},.file_name = (string){.str=(byteptr)"", .is_lit=1},.file_name_dir = (string){.str=(byteptr)"", .is_lit=1},.unique_prefix = (string){.str=(byteptr)"", .is_lit=1},.mod = (string){.str=(byteptr)"", .is_lit=1},.expr_mod = (string){.str=(byteptr)"", .is_lit=1},.cur_fn_name = (string){.str=(byteptr)"", .is_lit=1},.codegen_text = (string){.str=(byteptr)"", .is_lit=1},.pref = ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences))),.scanner = v__scanner__new_scanner(text, v__scanner__CommentsMode__skip_comments, ((v__pref__Preferences*)memdup(&(v__pref__Preferences){.cache_manager = (v__vcache__CacheManager){.basepath = (string){.str=(byteptr)"", .is_lit=1},.original_vopts = (string){.str=(byteptr)"", .is_lit=1},.vopts = (string){.str=(byteptr)"", .is_lit=1},.k2cpath = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string),},.profile_fns = __new_array(0, 0, sizeof(string)),.lookup_path = __new_array(0, 0, sizeof(string)),.run_only = __new_array(0, 0, sizeof(string)),.compile_defines = __new_array(0, 0, sizeof(string)),.compile_defines_all = __new_array(0, 0, sizeof(string)),.run_args = __new_array(0, 0, sizeof(string)),.printfn_list = __new_array(0, 0, sizeof(string)),.cleanup_files = __new_array(0, 0, sizeof(string)),.build_options = __new_array(0, 0, sizeof(string)),.test_runner = (string){.str=(byteptr)"", .is_lit=1},.profile_file = (string){.str=(byteptr)"", .is_lit=1},.dump_c_flags = (string){.str=(byteptr)"", .is_lit=1},.dump_modules = (string){.str=(byteptr)"", .is_lit=1},.dump_files = (string){.str=(byteptr)"", .is_lit=1},.cflags = (string){.str=(byteptr)"", .is_lit=1},.ccompiler = (string){.str=(byteptr)"", .is_lit=1},.third_party_option = (string){.str=(byteptr)"", .is_lit=1},.bare_builtin_dir = (string){.str=(byteptr)"", .is_lit=1},.custom_prelude = (string){.str=(byteptr)"", .is_lit=1},.vroot = (string){.str=(byteptr)"", .is_lit=1},.out_name_c = (string){.str=(byteptr)"", .is_lit=1},.out_name = (string){.str=(byteptr)"", .is_lit=1},.path = (string){.str=(byteptr)"", .is_lit=1},.message_limit = 100,.checker_match_exhaustive_cutoff_limit = 12,.thread_stack_size = 8388608,.os = 0,.arch = 0,.backend = 0,.ccompiler_type = 0,.gc_mode = v__pref__GarbageCollectionMode__no_gc,.use_color = 0,.assert_failure_mode = 0,.build_mode = 0,.output_mode = v__pref__OutputMode__stdout,.is_verbose = 0,.is_glibc = 0,.is_musl = 0,.is_test = 0,.is_script = 0,.is_vsh = 0,.is_livemain = 0,.is_liveshared = 0,.is_shared = 0,.is_o = 0,.is_prof = 0,.is_prod = 0,.is_repl = 0,.is_run = 0,.is_debug = 0,.is_vlines = 0,.is_stats = 0,.is_fmt = 0,.is_vet = 0,.is_vweb = 0,.is_ios_simulator = 0,.is_apk = 0,.is_help = 0,.is_cstrict = 0,.profile_no_inline = 0,.translated = 0,.obfuscate = 0,.sanitize = 0,.sourcemap = 0,.sourcemap_inline = true,.sourcemap_src_included = 0,.show_cc = 0,.show_c_output = 0,.show_callgraph = 0,.show_depgraph = 0,.use_cache = 0,.retry_compilation = true,.m64 = 0,.building_v = 0,.autofree = 0,.compress = 0,.no_builtin = 0,.enable_globals = 0,.is_bare = 0,.no_preludes = 0,.output_cross_c = 0,.output_es5 = 0,.prealloc = 0,.print_v_files = 0,.skip_running = 0,.skip_warnings = 0,.warn_impure_v = 0,.warns_are_errors = 0,.fatal_errors = 0,.reuse_tmpc = 0,.no_rsp = 0,.no_std = 0,.no_parallel = 0,.only_check_syntax = 0,.check_only = 0,.experimental = 0,.skip_unused = 0,.show_timings = 0,.nofloat = 0,}, sizeof(v__pref__Preferences)))),.table = table,.scope = scope,.expr_level = 0,.n_asm = 0,.file_backend_mode = 0,.language = 0,.fn_language = 0,.comments_mode = v__scanner__CommentsMode__skip_comments,.inside_vlib_file = 0,.inside_test_file = true,.inside_if = 0,.inside_if_expr = 0,.inside_if_cond = 0,.inside_ct_if_expr = 0,.inside_or_expr = 0,.inside_for = 0,.inside_fn = 0,.inside_fn_return = 0,.inside_unsafe_fn = 0,.inside_str_interp = 0,.inside_array_lit = 0,.inside_in_array = 0,.inside_match = 0,.inside_select = 0,.inside_match_case = 0,.inside_match_body = 0,.inside_unsafe = 0,.inside_sum_type = 0,.inside_asm_template = 0,.inside_asm = 0,.inside_defer = 0,.inside_generic_params = 0,.inside_receiver_param = 0,.inside_struct_field_decl = 0,.or_is_handled = 0,.builtin_mod = 0,.is_manualfree = 0,.has_globals = 0,.is_generated = 0,.is_translated = 0,.is_amp = 0,.returns = 0,.is_stmt_ident = 0,.expecting_type = 0,.name_error = 0,.comptime_if_cond = 0,.should_abort = 0,.script_mode = 0,}); v__parser__Parser_init_parse_fns(&p); v__util__timing_start(_SLIT("PARSE stmt")); v__parser__parse_stmt_defer_0 = true; @@ -88718,7 +86781,7 @@ bool v__parser__Parser_parse_defer_0 = false; break; } v__ast__Stmt stmt = v__parser__Parser_top_stmt(p); - if (!((stmt)._typ == 347 /* v.ast.ExprStmt */ && ((/* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 347) /*expected idx: 347, name: v.ast.ExprStmt */ ).expr)._typ == 297 /* v.ast.Comment */)) { + if (!((stmt)._typ == 349 /* v.ast.ExprStmt */ && ((/* as */ *(v__ast__ExprStmt*)__as_cast((stmt)._v__ast__ExprStmt,(stmt)._typ, 349) /*expected idx: 349, name: v.ast.ExprStmt */ ).expr)._typ == 299 /* v.ast.Comment */)) { p->attrs = __new_array_with_default(0, 0, sizeof(v__ast__Attr), 0); } array_push((array*)&stmts, _MOV((v__ast__Stmt[]){ stmt })); @@ -89041,6 +87104,9 @@ v__ast__Stmt v__parser__Parser_top_stmt(v__parser__Parser* p) { if (p->pref->is_script && !p->pref->is_test) { p->script_mode = true; p->script_mode_start_token = p->tok; + if (v__ast__Table_known_fn(p->table, _SLIT("main.main"))) { + v__parser__Parser_error(p, _SLIT("function `main` is already defined, put your script statements inside it")); + } v__parser__Parser_open_scope(p); Array_v__ast__Stmt stmts = __new_array_with_default(0, 0, sizeof(v__ast__Stmt), 0); for (;;) { @@ -89222,17 +87288,17 @@ v__ast__Stmt v__parser__Parser_stmt(v__parser__Parser* p, bool is_top_level) { if (p->tok.kind == v__token__Kind__key_for) { v__token__Pos for_pos = v__token__Token_pos(&p->tok); v__ast__Stmt stmt = v__parser__Parser_stmt(p, is_top_level); - if (stmt._typ == 350 /* v.ast.ForStmt */) { + if (stmt._typ == 352 /* v.ast.ForStmt */) { (*stmt._v__ast__ForStmt).label = name; v__ast__Stmt _t7 = v__ast__ForStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForStmt)); return _t7; } - else if (stmt._typ == 349 /* v.ast.ForInStmt */) { + else if (stmt._typ == 351 /* v.ast.ForInStmt */) { (*stmt._v__ast__ForInStmt).label = name; v__ast__Stmt _t8 = v__ast__ForInStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForInStmt)); return _t8; } - else if (stmt._typ == 348 /* v.ast.ForCStmt */) { + else if (stmt._typ == 350 /* v.ast.ForCStmt */) { (*stmt._v__ast__ForCStmt).label = name; v__ast__Stmt _t9 = v__ast__ForCStmt_to_sumtype_v__ast__Stmt(&(*stmt._v__ast__ForCStmt)); return _t9; @@ -89598,10 +87664,10 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; } else if (p->tok.kind == (v__token__Kind__number)) { v__ast__Expr number_lit = v__parser__Parser_parse_number_literal(p); - if (number_lit._typ == 305 /* v.ast.FloatLiteral */) { + if (number_lit._typ == 307 /* v.ast.FloatLiteral */) { array_push((array*)&args, _MOV((v__ast__AsmArg[]){ v__ast__FloatLiteral_to_sumtype_v__ast__AsmArg(ADDR(v__ast__FloatLiteral, (((v__ast__FloatLiteral){(*number_lit._v__ast__FloatLiteral).val,(*number_lit._v__ast__FloatLiteral).pos,})))) })); } - else if (number_lit._typ == 312 /* v.ast.IntegerLiteral */) { + else if (number_lit._typ == 314 /* v.ast.IntegerLiteral */) { if (is_directive) { array_push((array*)&args, _MOV((v__ast__AsmArg[]){ v__ast__AsmDisp_to_sumtype_v__ast__AsmArg(ADDR(v__ast__AsmDisp, (((v__ast__AsmDisp){.val = (*number_lit._v__ast__IntegerLiteral).val,.pos = (*number_lit._v__ast__IntegerLiteral).pos,})))) })); } else { @@ -89656,7 +87722,7 @@ bool v__parser__Parser_asm_stmt_defer_0 = false; if (is_directive && (string__eq(name, _SLIT("globl")) || string__eq(name, _SLIT("global")))) { for (int _t12 = 0; _t12 < args.len; ++_t12) { v__ast__AsmArg arg = ((v__ast__AsmArg*)args.data)[_t12]; - array_push((array*)&p->global_labels, _MOV((string[]){ string_clone((/* as */ *(v__ast__AsmAlias*)__as_cast((arg)._v__ast__AsmAlias,(arg)._typ, 438) /*expected idx: 438, name: v.ast.AsmAlias */ ).name) })); + array_push((array*)&p->global_labels, _MOV((string[]){ string_clone((/* as */ *(v__ast__AsmAlias*)__as_cast((arg)._v__ast__AsmAlias,(arg)._typ, 440) /*expected idx: 440, name: v.ast.AsmAlias */ ).name) })); } } array_push((array*)&templates, _MOV((v__ast__AsmTemplate[]){ ((v__ast__AsmTemplate){ @@ -89758,7 +87824,7 @@ VV_LOCAL_SYMBOL v__ast__AsmArg v__parser__Parser_reg_or_alias(v__parser__Parser* } if (_IN_MAP(ADDR(string, p->prev_tok.lit), ADDR(map, p->scope->objects))) { v__ast__ScopeObject x = (*(v__ast__ScopeObject*)map_get(ADDR(map, p->scope->objects), &(string[]){p->prev_tok.lit}, &(v__ast__ScopeObject[]){ {0} })); - if ((x)._typ == 362 /* v.ast.AsmRegister */) { + if ((x)._typ == 364 /* v.ast.AsmRegister */) { v__ast__AsmArg _t1 = v__ast__AsmRegister_to_sumtype_v__ast__AsmArg(ADDR(v__ast__AsmRegister, ((*x._v__ast__AsmRegister)))); return _t1; } else { @@ -89932,7 +87998,7 @@ VV_LOCAL_SYMBOL Array_v__ast__AsmIO v__parser__Parser_asm_ios(v__parser__Parser* } } v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 322 /* v.ast.ParExpr */) { + if ((expr)._typ == 324 /* v.ast.ParExpr */) { expr = (*expr._v__ast__ParExpr).expr; } else { v__parser__Parser_error(p, _SLIT("asm in/output must be enclosed in brackets")); @@ -89942,7 +88008,7 @@ VV_LOCAL_SYMBOL Array_v__ast__AsmIO v__parser__Parser_asm_ios(v__parser__Parser* v__parser__Parser_next(p); alias = p->tok.lit; v__parser__Parser_check(p, v__token__Kind__name); - } else if ((expr)._typ == 307 /* v.ast.Ident */) { + } else if ((expr)._typ == 309 /* v.ast.Ident */) { alias = (*expr._v__ast__Ident).name; } Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); @@ -89965,7 +88031,7 @@ VV_LOCAL_SYMBOL multi_return_Array_v__ast__Expr_Array_v__ast__Comment v__parser_ Array_v__ast__Comment comments = __new_array_with_default(0, 0, sizeof(v__ast__Comment), 0); for (;;) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 297 /* v.ast.Comment */) { + if ((expr)._typ == 299 /* v.ast.Comment */) { array_push((array*)&comments, _MOV((v__ast__Comment[]){ (*expr._v__ast__Comment) })); } else { array_push((array*)&exprs, _MOV((v__ast__Expr[]){ expr })); @@ -90063,7 +88129,7 @@ VV_LOCAL_SYMBOL v__ast__Attr v__parser__Parser_parse_attr(v__parser__Parser* p) p->comptime_if_cond = false; p->inside_if_expr = false; p->inside_ct_if_expr = false; - if ((comptime_cond)._typ == 323 /* v.ast.PostfixExpr */) { + if ((comptime_cond)._typ == 325 /* v.ast.PostfixExpr */) { comptime_cond_opt = true; } name = v__ast__Expr_str(comptime_cond); @@ -90277,9 +88343,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_48309 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr left = mr_48309.arg0; - Array_v__ast__Comment left_comments = mr_48309.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_48447 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr left = mr_48447.arg0; + Array_v__ast__Comment left_comments = mr_48447.arg1; if (!(p->inside_defer && p->tok.kind == v__token__Kind__decl_assign)) { _PUSH_MANY(&defer_vars, (p->defer_vars), _t1, Array_v__ast__Ident); } @@ -90295,8 +88361,8 @@ VV_LOCAL_SYMBOL v__ast__Stmt v__parser__Parser_parse_multi_expr(v__parser__Parse } else if (!p->pref->translated && !p->is_translated && !p->pref->is_fmt && !(tok.kind == v__token__Kind__key_if || tok.kind == v__token__Kind__key_match || tok.kind == v__token__Kind__key_lock || tok.kind == v__token__Kind__key_rlock || tok.kind == v__token__Kind__key_select)) { for (int _t4 = 0; _t4 < left.len; ++_t4) { v__ast__Expr node = ((v__ast__Expr*)left.data)[_t4]; - if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 293 /* v.ast.CallExpr */ && (node)._typ != 323 /* v.ast.PostfixExpr */ && (node)._typ != 298 /* v.ast.ComptimeCall */ && (node)._typ != 327 /* v.ast.SelectorExpr */ && (node)._typ != 302 /* v.ast.DumpExpr */) { - bool is_complex_infix_expr = (node)._typ == 311 /* v.ast.InfixExpr */ && ((/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ).op == v__token__Kind__left_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ).op == v__token__Kind__right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ).op == v__token__Kind__unsigned_right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 311) /*expected idx: 311, name: v.ast.InfixExpr */ ).op == v__token__Kind__arrow); + if ((is_top_level || p->tok.kind != v__token__Kind__rcbr) && (node)._typ != 295 /* v.ast.CallExpr */ && (node)._typ != 325 /* v.ast.PostfixExpr */ && (node)._typ != 300 /* v.ast.ComptimeCall */ && (node)._typ != 329 /* v.ast.SelectorExpr */ && (node)._typ != 304 /* v.ast.DumpExpr */) { + bool is_complex_infix_expr = (node)._typ == 313 /* v.ast.InfixExpr */ && ((/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ).op == v__token__Kind__left_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ).op == v__token__Kind__right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ).op == v__token__Kind__unsigned_right_shift || (/* as */ *(v__ast__InfixExpr*)__as_cast((node)._v__ast__InfixExpr,(node)._typ, 313) /*expected idx: 313, name: v.ast.InfixExpr */ ).op == v__token__Kind__arrow); if (!is_complex_infix_expr) { v__ast__Stmt _t5 = v__ast__NodeError_to_sumtype_v__ast__Stmt(ADDR(v__ast__NodeError, (v__parser__Parser_error_with_pos(p, _SLIT("expression evaluated but not used"), v__ast__Expr_pos(node))))); return _t5; @@ -90997,11 +89063,11 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_dot_expr(v__parser__Parser* p, v_ bool is_mut = false; v__token__Pos mut_pos = ((v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,}); if (p->inside_match || p->inside_if_expr || p->inside_for) { - if (left._typ == 307 /* v.ast.Ident */) { + if (left._typ == 309 /* v.ast.Ident */) { is_mut = (*left._v__ast__Ident).is_mut; mut_pos = (*left._v__ast__Ident).mut_pos; } - else if (left._typ == 327 /* v.ast.SelectorExpr */) { + else if (left._typ == 329 /* v.ast.SelectorExpr */) { is_mut = (*left._v__ast__SelectorExpr).is_mut; mut_pos = (*left._v__ast__SelectorExpr).mut_pos; } @@ -91562,9 +89628,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_85049 = v__parser__Parser_expr_list(p); - Array_v__ast__Expr exprs = mr_85049.arg0; - Array_v__ast__Comment comments2 = mr_85049.arg1; + multi_return_Array_v__ast__Expr_Array_v__ast__Comment mr_85187 = v__parser__Parser_expr_list(p); + Array_v__ast__Expr exprs = mr_85187.arg0; + Array_v__ast__Comment comments2 = mr_85187.arg1; _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)),}); @@ -91627,40 +89693,40 @@ VV_LOCAL_SYMBOL v__ast__GlobalDecl v__parser__Parser_global_decl(v__parser__Pars if (has_expr) { v__parser__Parser_next(p); expr = v__parser__Parser_expr(p, 0); - if (expr._typ == 294 /* v.ast.CastExpr */) { + if (expr._typ == 296 /* v.ast.CastExpr */) { typ = (*expr._v__ast__CastExpr).typ; } - else if (expr._typ == 332 /* v.ast.StructInit */) { + else if (expr._typ == 334 /* v.ast.StructInit */) { typ = (*expr._v__ast__StructInit).typ; } - else if (expr._typ == 287 /* v.ast.ArrayInit */) { + else if (expr._typ == 289 /* v.ast.ArrayInit */) { typ = (*expr._v__ast__ArrayInit).typ; } - else if (expr._typ == 295 /* v.ast.ChanInit */) { + else if (expr._typ == 297 /* v.ast.ChanInit */) { typ = (*expr._v__ast__ChanInit).typ; } - else if (expr._typ == 291 /* v.ast.BoolLiteral */) { + else if (expr._typ == 293 /* v.ast.BoolLiteral */) { typ = _const_v__ast__bool_type; } - else if (expr._typ == 313 /* v.ast.IsRefType */) { + else if (expr._typ == 315 /* v.ast.IsRefType */) { typ = _const_v__ast__bool_type; } - else if (expr._typ == 296 /* v.ast.CharLiteral */) { + else if (expr._typ == 298 /* v.ast.CharLiteral */) { typ = _const_v__ast__char_type; } - else if (expr._typ == 305 /* v.ast.FloatLiteral */) { + else if (expr._typ == 307 /* v.ast.FloatLiteral */) { typ = _const_v__ast__f64_type; } - else if (expr._typ == 312 /* v.ast.IntegerLiteral */) { + else if (expr._typ == 314 /* v.ast.IntegerLiteral */) { typ = _const_v__ast__int_type; } - else if (expr._typ == 328 /* v.ast.SizeOf */) { + else if (expr._typ == 330 /* v.ast.SizeOf */) { typ = _const_v__ast__int_type; } - else if (expr._typ == 331 /* v.ast.StringLiteral */) { + else if (expr._typ == 333 /* v.ast.StringLiteral */) { typ = _const_v__ast__string_type; } - else if (expr._typ == 330 /* v.ast.StringInterLiteral */) { + else if (expr._typ == 332 /* v.ast.StringInterLiteral */) { typ = _const_v__ast__string_type; } @@ -91834,8 +89900,8 @@ VV_LOCAL_SYMBOL v__ast__TypeDecl v__parser__Parser_type_decl(v__parser__Parser* return _t3; } Array_v__ast__TypeNode sum_variants = __new_array_with_default(0, 0, sizeof(v__ast__TypeNode), 0); - multi_return_Array_v__ast__Type_Array_string mr_91545 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_91545.arg0; + multi_return_Array_v__ast__Type_Array_string mr_91683 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_91683.arg0; 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); @@ -92042,12 +90108,12 @@ bool v__parser__Parser_mark_var_as_used(v__parser__Parser* p, string varname) { _option_v__ast__ScopeObject _t1; if (_t1 = v__ast__Scope_find(p->scope, varname), _t1.state == 0) { v__ast__ScopeObject obj = *(v__ast__ScopeObject*)_t1.data; - if (obj._typ == 365 /* v.ast.Var */) { + if (obj._typ == 367 /* v.ast.Var */) { (*obj._v__ast__Var).is_used = true; bool _t2 = true; return _t2; } - else if (obj._typ == 364 /* v.ast.GlobalField */) { + else if (obj._typ == 366 /* v.ast.GlobalField */) { bool _t3 = true; return _t3; } @@ -92084,7 +90150,7 @@ bool v__parser__Parser_unsafe_stmt_defer_0 = false; v__parser__Parser_unsafe_stmt_defer_0 = true; v__ast__Stmt stmt = v__parser__Parser_stmt(p, false); if (p->tok.kind == v__token__Kind__rcbr) { - if ((stmt)._typ == 347 /* v.ast.ExprStmt */) { + if ((stmt)._typ == 349 /* v.ast.ExprStmt */) { if (v__ast__Expr_is_expr((*stmt._v__ast__ExprStmt).expr)) { v__parser__Parser_next(p); v__token__Pos_update_last_line(&pos, p->prev_tok.line_nr); @@ -92162,13 +90228,13 @@ VV_LOCAL_SYMBOL v__ast__Expr v__parser__Parser_sql_expr(v__parser__Parser* p) { if (has_where) { v__parser__Parser_next(p); where_expr = v__parser__Parser_expr(p, 0); - if (!is_count && (where_expr)._typ == 311 /* v.ast.InfixExpr */) { - if ((*where_expr._v__ast__InfixExpr).op == v__token__Kind__eq && ((*where_expr._v__ast__InfixExpr).left)._typ == 307 /* v.ast.Ident */) { + if (!is_count && (where_expr)._typ == 313 /* v.ast.InfixExpr */) { + if ((*where_expr._v__ast__InfixExpr).op == v__token__Kind__eq && ((*where_expr._v__ast__InfixExpr).left)._typ == 309 /* v.ast.Ident */) { if (string__eq((*(*where_expr._v__ast__InfixExpr).left._v__ast__Ident).name, _SLIT("id"))) { query_one = true; } } - if (((*where_expr._v__ast__InfixExpr).right)._typ == 307 /* v.ast.Ident */) { + if (((*where_expr._v__ast__InfixExpr).right)._typ == 309 /* v.ast.Ident */) { if (!v__ast__Scope_known_var(p->scope, (*(*where_expr._v__ast__InfixExpr).right._v__ast__Ident).name)) { _option_void _t2 = v__parser__Parser_check_undefined_variables(p, new_array_from_c_array(1, 1, sizeof(v__ast__Expr), _MOV((v__ast__Expr[1]){(*where_expr._v__ast__InfixExpr).left})), (*where_expr._v__ast__InfixExpr).right); if (_t2.state != 0 && _t2.err._typ != _IError_None___index) { @@ -92316,7 +90382,7 @@ VV_LOCAL_SYMBOL v__ast__SqlStmtLine v__parser__Parser_parse_sql_stmt_line(v__par table_type = v__parser__Parser_parse_type(p); } else if (kind == v__ast__SqlStmtKind__insert) { v__ast__Expr expr = v__parser__Parser_expr(p, 0); - if ((expr)._typ == 307 /* v.ast.Ident */) { + if ((expr)._typ == 309 /* v.ast.Ident */) { inserted_var_name = (*expr._v__ast__Ident).name; } else { v__parser__Parser_error(p, _SLIT("can only insert variables")); @@ -92444,8 +90510,8 @@ bool v__parser__Parser_struct_decl_defer_0 = false; } v__ast__Table_start_parsing_type(p->table, v__parser__Parser_prepend_mod(p, name)); v__parser__Parser_struct_decl_defer_0 = true; - multi_return_Array_v__ast__Type_Array_string mr_1623 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_1623.arg0; + multi_return_Array_v__ast__Type_Array_string mr_1529 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_1529.arg0; 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 }}}))); @@ -92709,7 +90775,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; if (p->tok.kind == v__token__Kind__assign) { v__parser__Parser_next(p); default_expr = v__parser__Parser_expr(p, 0); - if (default_expr._typ == 304 /* v.ast.EnumVal */) { + if (default_expr._typ == 306 /* v.ast.EnumVal */) { (*default_expr._v__ast__EnumVal).typ = typ; } @@ -92798,8 +90864,7 @@ bool v__parser__Parser_struct_decl_defer_0 = false; // Defer end return _t27; } - int ret = 0; - ret = v__ast__Table_register_sym(p->table, t); + int ret = v__ast__Table_register_sym(p->table, t); if (ret == -1 && language != v__ast__Language__c) { v__parser__Parser_error_with_pos(p, str_intp(2, _MOV((StrIntpData[]){{_SLIT("cannot register struct `"), /*115 &string*/0xfe10, {.d_s = name}}, {_SLIT("`, another type with this name exists"), 0, { .d_c = 0 }}})), name_pos); v__ast__StructDecl _t28 = ((v__ast__StructDecl){.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.end_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.embeds = __new_array(0, 0, sizeof(v__ast__Embed)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.name = (string){.str=(byteptr)"", .is_lit=1},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.mut_pos = 0,.pub_pos = 0,.pub_mut_pos = 0,.global_pos = 0,.module_pos = 0,.language = 0,.is_pub = 0,.is_union = 0,}); @@ -92957,8 +91022,8 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } else { interface_name = v__parser__Parser_prepend_mod(p, modless_name); } - multi_return_Array_v__ast__Type_Array_string mr_13271 = v__parser__Parser_parse_generic_types(p); - Array_v__ast__Type generic_types = mr_13271.arg0; + multi_return_Array_v__ast__Type_Array_string mr_13120 = v__parser__Parser_parse_generic_types(p); + Array_v__ast__Type generic_types = mr_13120.arg0; 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))) { @@ -92987,7 +91052,7 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser } v__ast__Type typ = v__ast__new_type(reg_idx); v__ast__TypeSymbol* ts = v__ast__Table_sym(p->table, typ); - v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 475) /*expected idx: 475, name: v.ast.Interface */ ; + v__ast__Interface info = /* as */ *(v__ast__Interface*)__as_cast((ts->info)._v__ast__Interface,(ts->info)._typ, 477) /*expected idx: 477, name: v.ast.Interface */ ; 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); @@ -93053,9 +91118,9 @@ VV_LOCAL_SYMBOL v__ast__InterfaceDecl v__parser__Parser_interface_decl(v__parser v__ast__InterfaceDecl _t8 = ((v__ast__InterfaceDecl){.field_names = __new_array(0, 0, sizeof(string)),.pre_comments = __new_array(0, 0, sizeof(v__ast__Comment)),.generic_types = __new_array(0, 0, sizeof(v__ast__Type)),.attrs = __new_array(0, 0, sizeof(v__ast__Attr)),.methods = __new_array(0, 0, sizeof(v__ast__FnDecl)),.fields = __new_array(0, 0, sizeof(v__ast__StructField)),.embeds = __new_array(0, 0, sizeof(v__ast__InterfaceEmbedding)),.name = (string){.str=(byteptr)"", .is_lit=1},.name_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = 0,.mut_pos = 0,.language = 0,.is_pub = 0,.are_embeds_expanded = 0,}); return _t8; } - multi_return_Array_v__ast__Param_bool_bool mr_16407 = v__parser__Parser_fn_args(p); - Array_v__ast__Param args2 = mr_16407.arg0; - bool is_variadic = mr_16407.arg2; + multi_return_Array_v__ast__Param_bool_bool mr_16256 = v__parser__Parser_fn_args(p); + Array_v__ast__Param args2 = mr_16256.arg0; + bool is_variadic = mr_16256.arg2; Array_v__ast__Param args = new_array_from_c_array(1, 1, sizeof(v__ast__Param), _MOV((v__ast__Param[1]){((v__ast__Param){.name = _SLIT("x"),.pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.type_pos = (v__token__Pos){.len = 0,.line_nr = 0,.pos = 0,.col = 0,.last_line = 0,},.typ = typ,.is_mut = is_mut,.is_auto_rec = 0,.is_hidden = true,})})); _PUSH_MANY(&args, (args2), _t9, Array_v__ast__Param); v__ast__FnDecl method = ((v__ast__FnDecl){ @@ -93553,7 +91618,7 @@ VV_LOCAL_SYMBOL _option_void v__callgraph__Mapper_visit(v__callgraph__Mapper* m, if (node->_typ == 211 /* v.ast.File */) { m->file = &(*node->_v__ast__File); } - else if (node->_typ == 361 /* v.ast.Stmt */) { + else if (node->_typ == 363 /* v.ast.Stmt */) { if ((*node->_v__ast__Stmt)._typ == 220 /* v.ast.FnDecl */) { m->is_caller_used = true; if (m->pref->skip_unused) { @@ -93571,8 +91636,8 @@ VV_LOCAL_SYMBOL _option_void v__callgraph__Mapper_visit(v__callgraph__Mapper* m, } ; } - else if (node->_typ == 336 /* v.ast.Expr */) { - if ((*node->_v__ast__Expr)._typ == 293 /* v.ast.CallExpr */) { + else if (node->_typ == 338 /* v.ast.Expr */) { + if ((*node->_v__ast__Expr)._typ == 295 /* v.ast.CallExpr */) { if (m->is_caller_used) { string dot_called_name = v__callgraph__Mapper_dot_fn_name(m, (*(*node->_v__ast__Expr)._v__ast__CallExpr).name, (*(*node->_v__ast__Expr)._v__ast__CallExpr).receiver_type, (*(*node->_v__ast__Expr)._v__ast__CallExpr).is_method); v__dotgraph__DotGraph_new_edge(&m->dg, m->dot_caller_name, dot_called_name, ((v__dotgraph__NewEdgeConfig){.should_highlight = string__eq(m->caller_name, _SLIT("main.main")),.ctx = ((voidptr)(0)),.name2node_fn = v__dotgraph__node_name,})); @@ -93687,7 +91752,7 @@ _option_void v__builder__Builder_front_and_middle_stages(v__builder__Builder* b, _option_void _t1 = v__builder__Builder_front_stages(b, v_files); if (_t1.state != 0 && _t1.err._typ != _IError_None___index) { _option_void _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -93695,7 +91760,7 @@ _option_void v__builder__Builder_front_and_middle_stages(v__builder__Builder* b, _option_void _t3 = v__builder__Builder_middle_stages(b); if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { _option_void _t4; - memcpy(&_t4, &_t3, sizeof(Option)); + memcpy(&_t4, &_t3, sizeof(_option)); return _t4; } @@ -93776,6 +91841,19 @@ bool v__builder__Builder_parse_imports_defer_0 = false; _v_exit(0); VUNREACHABLE(); } + if ((b->pref->dump_files).len != 0) { + Array_string _t19 = {0}; + Array_v__ast__File_ptr _t19_orig = b->parsed_files; + int _t19_len = _t19_orig.len; + _t19 = __new_array(0, _t19_len, sizeof(string)); + + for (int _t20 = 0; _t20 < _t19_len; ++_t20) { + v__ast__File* it = ((v__ast__File**) _t19_orig.data)[_t20]; + string ti = it->path; + array_push((array*)&_t19, &ti); + } + v__builder__Builder_dump_files(b,_t19); + } v__builder__Builder_rebuild_modules(b); // Defer begin if (v__builder__Builder_parse_imports_defer_0) { @@ -93808,6 +91886,7 @@ bool v__builder__Builder_resolve_deps_defer_0 = false; v__depgraph__DepGraphNode node = ((v__depgraph__DepGraphNode*)deps_resolved->nodes.data)[_t1]; array_push((array*)&mods, _MOV((string[]){ string_clone(node.name) })); } + v__builder__Builder_dump_modules(b, mods); if (b->pref->is_verbose) { eprintln(_SLIT("------ imported modules: ------")); eprintln(Array_string_str(mods)); @@ -93841,7 +91920,7 @@ v__depgraph__DepGraph* v__builder__Builder_import_graph(v__builder__Builder* b) if (!Array_string_contains(builtins, p->mod.name)) { array_push((array*)&deps, _MOV((string[]){ string_clone(_SLIT("builtin")) })); if (b->pref->backend == v__pref__Backend__c) { - if (b->pref->is_vsh && !(string__eq(p->mod.name, _SLIT("os")) || string__eq(p->mod.name, _SLIT("dl")))) { + if (b->pref->is_vsh && !(string__eq(p->mod.name, _SLIT("os")) || string__eq(p->mod.name, _SLIT("dl")) || string__eq(p->mod.name, _SLIT("strings.textscanner")))) { array_push((array*)&deps, _MOV((string[]){ string_clone(_SLIT("os")) })); } } @@ -94100,14 +92179,16 @@ bool v__builder__Builder_print_warnings_and_errors_defer_0 = false; for (int _t11 = 0; _t11 < b->table->redefined_fns.len; ++_t11) { string fn_name = ((string*)b->table->redefined_fns.data)[_t11]; Array_v__builder__FunctionRedefinition redefines = __new_array_with_default(0, 0, sizeof(v__builder__FunctionRedefinition), 0); - Map_string_int redefine_conflicts = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int redefine_conflicts = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; for (int _t12 = 0; _t12 < b->parsed_files.len; ++_t12) { v__ast__File* file = ((v__ast__File**)b->parsed_files.data)[_t12]; for (int _t13 = 0; _t13 < file->stmts.len; ++_t13) { v__ast__Stmt stmt = ((v__ast__Stmt*)file->stmts.data)[_t13]; if ((stmt)._typ == 220 /* v.ast.FnDecl */) { if (string__eq((*stmt._v__ast__FnDecl).name, fn_name)) { - string fheader = v__ast__FnDecl_stringify(&(*stmt._v__ast__FnDecl), b->table, _SLIT("main"), new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string)); + string fheader = v__ast__FnDecl_stringify(&(*stmt._v__ast__FnDecl), b->table, _SLIT("main"), new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ); array_push((array*)&redefines, _MOV((v__builder__FunctionRedefinition[]){ ((v__builder__FunctionRedefinition){.fpath = file->path,.fline = (*stmt._v__ast__FnDecl).pos.line_nr,.fheader = fheader,.f = (*stmt._v__ast__FnDecl),}) })); (*(int*)map_get_and_set((map*)&redefine_conflicts, &(string[]){fheader}, &(int[]){ 0 }))++; } @@ -94509,36 +92590,6 @@ VV_LOCAL_SYMBOL void v__builder__Builder_setup_output_name(v__builder__Builder* array_push((array*)&v->ccoptions.o_args, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-o \""), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); } -VV_LOCAL_SYMBOL void v__builder__Builder_dump_c_options(v__builder__Builder* v, Array_string all_args) { - if ((v->pref->dump_c_flags).len != 0) { - Array_string _t1 = {0}; - Array_string _t1_orig = all_args; - 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]; - if ((it).len != 0) { - array_push((array*)&_t1, &it); - } - } - string non_empty_args = string__plus(Array_string_join(_t1, _SLIT("\n")), _SLIT("\n")); - if (string__eq(v->pref->dump_c_flags, _SLIT("-"))) { - print(non_empty_args); - } else { - _option_void _t3 = os__write_file(v->pref->dump_c_flags, non_empty_args); - if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { - IError err = _t3.err; - _v_panic(IError_str(err)); - VUNREACHABLE(); - ; - } - - ; - } - } -} - void v__builder__Builder_cc(v__builder__Builder* v) { if (string_contains(os__executable(), _SLIT("vfmt"))) { return; @@ -94809,10 +92860,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_23274 = Array_v__cflag__CFlag_defines_others_libs(cflags); - Array_string defines = mr_23274.arg0; - Array_string others = mr_23274.arg1; - Array_string libs = mr_23274.arg2; + multi_return_Array_string_Array_string_Array_string mr_22971 = Array_v__cflag__CFlag_defines_others_libs(cflags); + Array_string defines = mr_22971.arg0; + Array_string others = mr_22971.arg1; + Array_string libs = mr_22971.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")) })); @@ -95462,6 +93513,48 @@ Array_string v__builder__Builder_get_user_files(v__builder__Builder* v) { return _t15; } +void v__builder__Builder_dump_c_options(v__builder__Builder* b, Array_string all_args) { + v__builder__dump_list(b->pref->dump_c_flags, all_args); +} + +void v__builder__Builder_dump_modules(v__builder__Builder* b, Array_string mods) { + v__builder__dump_list(b->pref->dump_modules, mods); +} + +void v__builder__Builder_dump_files(v__builder__Builder* b, Array_string files) { + v__builder__dump_list(b->pref->dump_files, files); +} + +VV_LOCAL_SYMBOL void v__builder__dump_list(string file_path, Array_string list) { + if ((file_path).len != 0) { + Array_string _t1 = {0}; + Array_string _t1_orig = list; + 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]; + if ((it).len != 0) { + array_push((array*)&_t1, &it); + } + } + string content = string__plus(Array_string_join(_t1, _SLIT("\n")), _SLIT("\n")); + if (string__eq(file_path, _SLIT("-"))) { + print(content); + } else { + _option_void _t3 = os__write_file(file_path, content); + if (_t3.state != 0 && _t3.err._typ != _IError_None___index) { + IError err = _t3.err; + _v_panic(IError_str(err)); + VUNREACHABLE(); + ; + } + + ; + } + } +} + // TypeDecl VV_LOCAL_SYMBOL _option_string v__builder__find_windows_kit_internal(v__builder__RegKey key, Array_string versions) { { // Unsafe block @@ -95556,7 +93649,7 @@ VV_LOCAL_SYMBOL _option_v__builder__WindowsKit v__builder__new_windows_kit(strin _option_Array_string _t1 = os__ls(kit_lib); if (_t1.state != 0) { /*or block*/ _option_v__builder__WindowsKit _t2; - memcpy(&_t2, &_t1, sizeof(Option)); + memcpy(&_t2, &_t1, sizeof(_option)); return _t2; } @@ -95761,20 +93854,15 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { Array_string lib_paths = sflags.lib_paths; Array_string defines = sflags.defines; Array_string other_flags = sflags.other_flags; - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.ucrt_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.vs_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.um_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r.shared_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - _PUSH_MANY(&a, (defines), _t17, Array_string); - _PUSH_MANY(&a, (inc_paths), _t18, Array_string); - _PUSH_MANY(&a, (other_flags), _t19, Array_string); + _PUSH_MANY(&a, (v__builder__MsvcResult_include_paths(&r)), _t13, Array_string); + _PUSH_MANY(&a, (defines), _t14, Array_string); + _PUSH_MANY(&a, (inc_paths), _t15, Array_string); + _PUSH_MANY(&a, (other_flags), _t16, Array_string); array_push((array*)&a, _MOV((string[]){ string_clone(Array_string_join(real_libs, _SLIT(" "))) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/link")) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/NOLOGO")) })); array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/OUT:\""), /*115 &string*/0xfe10, {.d_s = v->pref->out_name}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.ucrt_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.um_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); - array_push((array*)&a, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r.vs_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + _PUSH_MANY(&a, (v__builder__MsvcResult_library_paths(&r)), _t21, Array_string); if (!string_contains(all_cflags, _SLIT("/DEBUG"))) { array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/DEBUG:FULL")) })); } @@ -95783,15 +93871,16 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/OPT:REF")) })); array_push((array*)&a, _MOV((string[]){ string_clone(_SLIT("/OPT:ICF")) })); } - _PUSH_MANY(&a, (lib_paths), _t31, Array_string); + _PUSH_MANY(&a, (lib_paths), _t26, Array_string); string env_ldflags = os__getenv(_SLIT("LDFLAGS")); if ((env_ldflags).len != 0) { array_push((array*)&a, _MOV((string[]){ string_clone(env_ldflags) })); } + v__builder__Builder_dump_c_options(v, a); string args = Array_string_join(a, _SLIT(" ")); - _option_void _t33 = os__write_file(out_name_cmd_line, args); - if (_t33.state != 0 && _t33.err._typ != _IError_None___index) { - IError err = _t33.err; + _option_void _t28 = os__write_file(out_name_cmd_line, args); + if (_t28.state != 0 && _t28.err._typ != _IError_None___index) { + IError err = _t28.err; v__builder__verror( str_intp(2, _MOV((StrIntpData[]){{_SLIT("Unable to write response file to \""), /*115 &string*/0xfe10, {.d_s = out_name_cmd_line}}, {_SLIT("\""), 0, { .d_c = 0 }}}))); VUNREACHABLE(); ; @@ -95817,9 +93906,9 @@ void v__builder__Builder_cc_msvc(v__builder__Builder* v) { } else { v__builder__Builder_post_process_c_compiler_output(v, res); } - _option_void _t34 = os__rm(out_name_obj); - if (_t34.state != 0 && _t34.err._typ != _IError_None___index) { - IError err = _t34.err; + _option_void _t29 = os__rm(out_name_obj); + if (_t29.state != 0 && _t29.err._typ != _IError_None___index) { + IError err = _t29.err; } ; @@ -95842,13 +93931,14 @@ VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__ v__builder__MsvcStringFlags flags = v__builder__msvc_string_flags(moduleflags); string inc_dirs = Array_string_join(flags.inc_paths, _SLIT(" ")); string defines = Array_string_join(flags.defines, _SLIT(" ")); - string include_string = str_intp(6, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = msvc.ucrt_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.vs_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.um_include_path}}, {_SLIT("\" -I \""), /*115 &string*/0xfe10, {.d_s = msvc.shared_include_path}}, {_SLIT("\" "), /*115 &string*/0xfe10, {.d_s = inc_dirs}}, {_SLIT0, 0, { .d_c = 0 }}})); Array_string oargs = __new_array_with_default(0, 0, sizeof(string), 0); string env_cflags = os__getenv(_SLIT("CFLAGS")); string all_cflags = str_intp(3, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = env_cflags}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = v->pref->cflags}}, {_SLIT0, 0, { .d_c = 0 }}})); if (!string__eq(all_cflags, _SLIT(" "))) { array_push((array*)&oargs, _MOV((string[]){ string_clone(all_cflags) })); } + array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/NOLOGO")) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/volatile:ms")) })); if (v->pref->is_prod) { array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/O2")) })); array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/MD")) })); @@ -95857,12 +93947,18 @@ VV_LOCAL_SYMBOL void v__builder__Builder_build_thirdparty_obj_file_with_msvc(v__ array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/MDd")) })); array_push((array*)&oargs, _MOV((string[]){ string_clone(_SLIT("/D_DEBUG")) })); } + array_push((array*)&oargs, _MOV((string[]){ string_clone(defines) })); + _PUSH_MANY(&oargs, (v__builder__MsvcResult_include_paths(&msvc)), _t10, Array_string); + array_push((array*)&oargs, _MOV((string[]){ string_clone(inc_dirs) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/c \""), /*115 &string*/0xfe10, {.d_s = cfile}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + array_push((array*)&oargs, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/Fo\""), /*115 &string*/0xfe10, {.d_s = obj_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); string env_ldflags = os__getenv(_SLIT("LDFLAGS")); if ((env_ldflags).len != 0) { array_push((array*)&oargs, _MOV((string[]){ string_clone(env_ldflags) })); } + v__builder__Builder_dump_c_options(v, oargs); string str_oargs = Array_string_join(oargs, _SLIT(" ")); - string cmd = str_intp(7, _MOV((StrIntpData[]){{_SLIT("\""), /*115 &string*/0xfe10, {.d_s = msvc.full_cl_exe_path}}, {_SLIT("\" /volatile:ms "), /*115 &string*/0xfe10, {.d_s = str_oargs}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = defines}}, {_SLIT(" "), /*115 &string*/0xfe10, {.d_s = include_string}}, {_SLIT(" /c \""), /*115 &string*/0xfe10, {.d_s = cfile}}, {_SLIT("\" /Fo\""), /*115 &string*/0xfe10, {.d_s = obj_path}}, {_SLIT("\""), 0, { .d_c = 0 }}})); + string cmd = str_intp(3, _MOV((StrIntpData[]){{_SLIT("\""), /*115 &string*/0xfe10, {.d_s = msvc.full_cl_exe_path}}, {_SLIT("\" "), /*115 &string*/0xfe10, {.d_s = str_oargs}}, {_SLIT0, 0, { .d_c = 0 }}})); os__Result res = os__execute(cmd); if (res.exit_code != 0) { println( str_intp(2, _MOV((StrIntpData[]){{_SLIT("msvc: failed to build a thirdparty object; cmd: "), /*115 &string*/0xfe10, {.d_s = cmd}}, {_SLIT0, 0, { .d_c = 0 }}}))); @@ -95905,19 +94001,54 @@ v__builder__MsvcStringFlags v__builder__msvc_string_flags(Array_v__cflag__CFlag Array_string lpaths = __new_array_with_default(0, 0, sizeof(string), 0); for (int _t10 = 0; _t10 < lib_paths.len; ++_t10) { string l = ((string*)lib_paths.data)[_t10]; - array_push((array*)&lpaths, _MOV((string[]){ string_clone(string__plus(string__plus(_SLIT("/LIBPATH:\""), os__real_path(l)), _SLIT("\""))) })); + array_push((array*)&lpaths, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = os__real_path(l)}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); } v__builder__MsvcStringFlags _t12 = ((v__builder__MsvcStringFlags){.real_libs = real_libs,.inc_paths = inc_paths,.lib_paths = lpaths,.defines = defines,.other_flags = other_flags,}); return _t12; } +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_include_paths(v__builder__MsvcResult* r) { + Array_string res = __new_array_with_default(0, 4, sizeof(string), 0); + if ((r->ucrt_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->ucrt_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->vs_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->vs_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->um_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->um_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->shared_include_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("-I \""), /*115 &string*/0xfe10, {.d_s = r->shared_include_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + Array_string _t5 = res; + return _t5; +} + +VV_LOCAL_SYMBOL Array_string v__builder__MsvcResult_library_paths(v__builder__MsvcResult* r) { + Array_string res = __new_array_with_default(0, 3, sizeof(string), 0); + if ((r->ucrt_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->ucrt_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->um_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->um_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + if ((r->vs_lib_path).len != 0) { + array_push((array*)&res, _MOV((string[]){ string_clone( str_intp(2, _MOV((StrIntpData[]){{_SLIT("/LIBPATH:\""), /*115 &string*/0xfe10, {.d_s = r->vs_lib_path}}, {_SLIT("\""), 0, { .d_c = 0 }}}))) })); + } + Array_string _t4 = res; + return _t4; +} + void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { if (!b->pref->use_cache || b->pref->build_mode == v__pref__BuildMode__build_module) { return; } v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); - Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_string new_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_string old_hashes = new_map(sizeof(string), sizeof(string), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; strings__Builder sb_new_hashes = strings__new_builder(1024); Array_string _t1 = {0}; Array_v__ast__File_ptr _t1_orig = b->parsed_files; @@ -95976,8 +94107,10 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { v__util__timing_measure( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" source_hashing"), 0, { .d_c = 0 }}}))); if (!Map_string_string_map_eq(new_hashes, old_hashes)) { v__util__timing_start( str_intp(2, _MOV((StrIntpData[]){{_SLIT0, /*115 &string*/0xfe10, {.d_s = _SLIT("Builder.rebuild_modules")}}, {_SLIT(" rebuilding"), 0, { .d_c = 0 }}}))); - Map_string_int invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); - Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; + Map_string_int invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t9 = new_hashes.key_values.len; for (int _t8 = 0; _t8 < _t9; ++_t8 ) { int _t10 = new_hashes.key_values.len - _t9; @@ -96022,7 +94155,8 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { } bool rebuild_everything = false; for (int cycle = 0; true; cycle++) { - Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + Map_string_int new_invalidated_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t15 = invalidated_paths.key_values.len; for (int _t14 = 0; _t14 < _t15; ++_t14 ) { int _t16 = invalidated_paths.key_values.len - _t15; @@ -96065,7 +94199,8 @@ void v__builder__Builder_rebuild_modules(v__builder__Builder* b) { invalidated_paths = map_clone(&new_invalidated_paths); } if (rebuild_everything) { - invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string); + invalidated_mod_paths = new_map(sizeof(string), sizeof(int), &map_hash_string, &map_eq_string, &map_clone_string, &map_free_string) + ; int _t21 = new_hashes.key_values.len; for (int _t20 = 0; _t20 < _t21; ++_t20 ) { int _t22 = new_hashes.key_values.len - _t21; @@ -96449,106 +94584,106 @@ void _vinit(int ___argc, voidptr ___argv) { #endif as_cast_type_indexes = new_array_from_c_array(102, 102, sizeof(VCastTypeIndexName), _MOV((VCastTypeIndexName[102]){ (VCastTypeIndexName){.tindex = 0, .tname = _SLIT("unknown")} - , (VCastTypeIndexName){.tindex = 470, .tname = _SLIT("v.ast.Aggregate")} - , (VCastTypeIndexName){.tindex = 472, .tname = _SLIT("v.ast.Alias")} - , (VCastTypeIndexName){.tindex = 452, .tname = _SLIT("v.ast.Array")} - , (VCastTypeIndexName){.tindex = 480, .tname = _SLIT("v.ast.ArrayFixed")} - , (VCastTypeIndexName){.tindex = 481, .tname = _SLIT("v.ast.Chan")} - , (VCastTypeIndexName){.tindex = 486, .tname = _SLIT("v.ast.Enum")} - , (VCastTypeIndexName){.tindex = 484, .tname = _SLIT("v.ast.FnType")} - , (VCastTypeIndexName){.tindex = 485, .tname = _SLIT("v.ast.GenericInst")} - , (VCastTypeIndexName){.tindex = 475, .tname = _SLIT("v.ast.Interface")} - , (VCastTypeIndexName){.tindex = 453, .tname = _SLIT("v.ast.Map")} - , (VCastTypeIndexName){.tindex = 483, .tname = _SLIT("v.ast.MultiReturn")} - , (VCastTypeIndexName){.tindex = 457, .tname = _SLIT("v.ast.Struct")} - , (VCastTypeIndexName){.tindex = 476, .tname = _SLIT("v.ast.SumType")} - , (VCastTypeIndexName){.tindex = 482, .tname = _SLIT("v.ast.Thread")} - , (VCastTypeIndexName){.tindex = 416, .tname = _SLIT("v.ast.IdentFn")} - , (VCastTypeIndexName){.tindex = 417, .tname = _SLIT("v.ast.IdentVar")} - , (VCastTypeIndexName){.tindex = 285, .tname = _SLIT("v.ast.AnonFn")} - , (VCastTypeIndexName){.tindex = 286, .tname = _SLIT("v.ast.ArrayDecompose")} - , (VCastTypeIndexName){.tindex = 287, .tname = _SLIT("v.ast.ArrayInit")} - , (VCastTypeIndexName){.tindex = 288, .tname = _SLIT("v.ast.AsCast")} - , (VCastTypeIndexName){.tindex = 289, .tname = _SLIT("v.ast.Assoc")} - , (VCastTypeIndexName){.tindex = 290, .tname = _SLIT("v.ast.AtExpr")} - , (VCastTypeIndexName){.tindex = 291, .tname = _SLIT("v.ast.BoolLiteral")} - , (VCastTypeIndexName){.tindex = 292, .tname = _SLIT("v.ast.CTempVar")} - , (VCastTypeIndexName){.tindex = 293, .tname = _SLIT("v.ast.CallExpr")} - , (VCastTypeIndexName){.tindex = 294, .tname = _SLIT("v.ast.CastExpr")} - , (VCastTypeIndexName){.tindex = 295, .tname = _SLIT("v.ast.ChanInit")} - , (VCastTypeIndexName){.tindex = 296, .tname = _SLIT("v.ast.CharLiteral")} - , (VCastTypeIndexName){.tindex = 297, .tname = _SLIT("v.ast.Comment")} - , (VCastTypeIndexName){.tindex = 298, .tname = _SLIT("v.ast.ComptimeCall")} - , (VCastTypeIndexName){.tindex = 299, .tname = _SLIT("v.ast.ComptimeSelector")} - , (VCastTypeIndexName){.tindex = 300, .tname = _SLIT("v.ast.ComptimeType")} - , (VCastTypeIndexName){.tindex = 301, .tname = _SLIT("v.ast.ConcatExpr")} - , (VCastTypeIndexName){.tindex = 302, .tname = _SLIT("v.ast.DumpExpr")} - , (VCastTypeIndexName){.tindex = 303, .tname = _SLIT("v.ast.EmptyExpr")} - , (VCastTypeIndexName){.tindex = 304, .tname = _SLIT("v.ast.EnumVal")} - , (VCastTypeIndexName){.tindex = 305, .tname = _SLIT("v.ast.FloatLiteral")} - , (VCastTypeIndexName){.tindex = 306, .tname = _SLIT("v.ast.GoExpr")} - , (VCastTypeIndexName){.tindex = 307, .tname = _SLIT("v.ast.Ident")} - , (VCastTypeIndexName){.tindex = 308, .tname = _SLIT("v.ast.IfExpr")} - , (VCastTypeIndexName){.tindex = 309, .tname = _SLIT("v.ast.IfGuardExpr")} - , (VCastTypeIndexName){.tindex = 310, .tname = _SLIT("v.ast.IndexExpr")} - , (VCastTypeIndexName){.tindex = 311, .tname = _SLIT("v.ast.InfixExpr")} - , (VCastTypeIndexName){.tindex = 312, .tname = _SLIT("v.ast.IntegerLiteral")} - , (VCastTypeIndexName){.tindex = 313, .tname = _SLIT("v.ast.IsRefType")} - , (VCastTypeIndexName){.tindex = 314, .tname = _SLIT("v.ast.Likely")} - , (VCastTypeIndexName){.tindex = 315, .tname = _SLIT("v.ast.LockExpr")} - , (VCastTypeIndexName){.tindex = 316, .tname = _SLIT("v.ast.MapInit")} - , (VCastTypeIndexName){.tindex = 317, .tname = _SLIT("v.ast.MatchExpr")} - , (VCastTypeIndexName){.tindex = 318, .tname = _SLIT("v.ast.NodeError")} - , (VCastTypeIndexName){.tindex = 319, .tname = _SLIT("v.ast.None")} - , (VCastTypeIndexName){.tindex = 320, .tname = _SLIT("v.ast.OffsetOf")} - , (VCastTypeIndexName){.tindex = 321, .tname = _SLIT("v.ast.OrExpr")} - , (VCastTypeIndexName){.tindex = 322, .tname = _SLIT("v.ast.ParExpr")} - , (VCastTypeIndexName){.tindex = 323, .tname = _SLIT("v.ast.PostfixExpr")} - , (VCastTypeIndexName){.tindex = 324, .tname = _SLIT("v.ast.PrefixExpr")} - , (VCastTypeIndexName){.tindex = 325, .tname = _SLIT("v.ast.RangeExpr")} - , (VCastTypeIndexName){.tindex = 326, .tname = _SLIT("v.ast.SelectExpr")} - , (VCastTypeIndexName){.tindex = 327, .tname = _SLIT("v.ast.SelectorExpr")} - , (VCastTypeIndexName){.tindex = 328, .tname = _SLIT("v.ast.SizeOf")} - , (VCastTypeIndexName){.tindex = 329, .tname = _SLIT("v.ast.SqlExpr")} - , (VCastTypeIndexName){.tindex = 330, .tname = _SLIT("v.ast.StringInterLiteral")} - , (VCastTypeIndexName){.tindex = 331, .tname = _SLIT("v.ast.StringLiteral")} - , (VCastTypeIndexName){.tindex = 332, .tname = _SLIT("v.ast.StructInit")} - , (VCastTypeIndexName){.tindex = 333, .tname = _SLIT("v.ast.TypeNode")} - , (VCastTypeIndexName){.tindex = 334, .tname = _SLIT("v.ast.TypeOf")} - , (VCastTypeIndexName){.tindex = 335, .tname = _SLIT("v.ast.UnsafeExpr")} - , (VCastTypeIndexName){.tindex = 362, .tname = _SLIT("v.ast.AsmRegister")} - , (VCastTypeIndexName){.tindex = 363, .tname = _SLIT("v.ast.ConstField")} - , (VCastTypeIndexName){.tindex = 364, .tname = _SLIT("v.ast.GlobalField")} - , (VCastTypeIndexName){.tindex = 365, .tname = _SLIT("v.ast.Var")} - , (VCastTypeIndexName){.tindex = 337, .tname = _SLIT("v.ast.AsmStmt")} - , (VCastTypeIndexName){.tindex = 338, .tname = _SLIT("v.ast.AssertStmt")} - , (VCastTypeIndexName){.tindex = 339, .tname = _SLIT("v.ast.AssignStmt")} - , (VCastTypeIndexName){.tindex = 340, .tname = _SLIT("v.ast.Block")} - , (VCastTypeIndexName){.tindex = 341, .tname = _SLIT("v.ast.BranchStmt")} - , (VCastTypeIndexName){.tindex = 342, .tname = _SLIT("v.ast.ComptimeFor")} - , (VCastTypeIndexName){.tindex = 343, .tname = _SLIT("v.ast.ConstDecl")} - , (VCastTypeIndexName){.tindex = 344, .tname = _SLIT("v.ast.DeferStmt")} - , (VCastTypeIndexName){.tindex = 345, .tname = _SLIT("v.ast.EmptyStmt")} - , (VCastTypeIndexName){.tindex = 346, .tname = _SLIT("v.ast.EnumDecl")} - , (VCastTypeIndexName){.tindex = 347, .tname = _SLIT("v.ast.ExprStmt")} + , (VCastTypeIndexName){.tindex = 472, .tname = _SLIT("v.ast.Aggregate")} + , (VCastTypeIndexName){.tindex = 474, .tname = _SLIT("v.ast.Alias")} + , (VCastTypeIndexName){.tindex = 454, .tname = _SLIT("v.ast.Array")} + , (VCastTypeIndexName){.tindex = 482, .tname = _SLIT("v.ast.ArrayFixed")} + , (VCastTypeIndexName){.tindex = 483, .tname = _SLIT("v.ast.Chan")} + , (VCastTypeIndexName){.tindex = 488, .tname = _SLIT("v.ast.Enum")} + , (VCastTypeIndexName){.tindex = 486, .tname = _SLIT("v.ast.FnType")} + , (VCastTypeIndexName){.tindex = 487, .tname = _SLIT("v.ast.GenericInst")} + , (VCastTypeIndexName){.tindex = 477, .tname = _SLIT("v.ast.Interface")} + , (VCastTypeIndexName){.tindex = 455, .tname = _SLIT("v.ast.Map")} + , (VCastTypeIndexName){.tindex = 485, .tname = _SLIT("v.ast.MultiReturn")} + , (VCastTypeIndexName){.tindex = 459, .tname = _SLIT("v.ast.Struct")} + , (VCastTypeIndexName){.tindex = 478, .tname = _SLIT("v.ast.SumType")} + , (VCastTypeIndexName){.tindex = 484, .tname = _SLIT("v.ast.Thread")} + , (VCastTypeIndexName){.tindex = 418, .tname = _SLIT("v.ast.IdentFn")} + , (VCastTypeIndexName){.tindex = 419, .tname = _SLIT("v.ast.IdentVar")} + , (VCastTypeIndexName){.tindex = 287, .tname = _SLIT("v.ast.AnonFn")} + , (VCastTypeIndexName){.tindex = 288, .tname = _SLIT("v.ast.ArrayDecompose")} + , (VCastTypeIndexName){.tindex = 289, .tname = _SLIT("v.ast.ArrayInit")} + , (VCastTypeIndexName){.tindex = 290, .tname = _SLIT("v.ast.AsCast")} + , (VCastTypeIndexName){.tindex = 291, .tname = _SLIT("v.ast.Assoc")} + , (VCastTypeIndexName){.tindex = 292, .tname = _SLIT("v.ast.AtExpr")} + , (VCastTypeIndexName){.tindex = 293, .tname = _SLIT("v.ast.BoolLiteral")} + , (VCastTypeIndexName){.tindex = 294, .tname = _SLIT("v.ast.CTempVar")} + , (VCastTypeIndexName){.tindex = 295, .tname = _SLIT("v.ast.CallExpr")} + , (VCastTypeIndexName){.tindex = 296, .tname = _SLIT("v.ast.CastExpr")} + , (VCastTypeIndexName){.tindex = 297, .tname = _SLIT("v.ast.ChanInit")} + , (VCastTypeIndexName){.tindex = 298, .tname = _SLIT("v.ast.CharLiteral")} + , (VCastTypeIndexName){.tindex = 299, .tname = _SLIT("v.ast.Comment")} + , (VCastTypeIndexName){.tindex = 300, .tname = _SLIT("v.ast.ComptimeCall")} + , (VCastTypeIndexName){.tindex = 301, .tname = _SLIT("v.ast.ComptimeSelector")} + , (VCastTypeIndexName){.tindex = 302, .tname = _SLIT("v.ast.ComptimeType")} + , (VCastTypeIndexName){.tindex = 303, .tname = _SLIT("v.ast.ConcatExpr")} + , (VCastTypeIndexName){.tindex = 304, .tname = _SLIT("v.ast.DumpExpr")} + , (VCastTypeIndexName){.tindex = 305, .tname = _SLIT("v.ast.EmptyExpr")} + , (VCastTypeIndexName){.tindex = 306, .tname = _SLIT("v.ast.EnumVal")} + , (VCastTypeIndexName){.tindex = 307, .tname = _SLIT("v.ast.FloatLiteral")} + , (VCastTypeIndexName){.tindex = 308, .tname = _SLIT("v.ast.GoExpr")} + , (VCastTypeIndexName){.tindex = 309, .tname = _SLIT("v.ast.Ident")} + , (VCastTypeIndexName){.tindex = 310, .tname = _SLIT("v.ast.IfExpr")} + , (VCastTypeIndexName){.tindex = 311, .tname = _SLIT("v.ast.IfGuardExpr")} + , (VCastTypeIndexName){.tindex = 312, .tname = _SLIT("v.ast.IndexExpr")} + , (VCastTypeIndexName){.tindex = 313, .tname = _SLIT("v.ast.InfixExpr")} + , (VCastTypeIndexName){.tindex = 314, .tname = _SLIT("v.ast.IntegerLiteral")} + , (VCastTypeIndexName){.tindex = 315, .tname = _SLIT("v.ast.IsRefType")} + , (VCastTypeIndexName){.tindex = 316, .tname = _SLIT("v.ast.Likely")} + , (VCastTypeIndexName){.tindex = 317, .tname = _SLIT("v.ast.LockExpr")} + , (VCastTypeIndexName){.tindex = 318, .tname = _SLIT("v.ast.MapInit")} + , (VCastTypeIndexName){.tindex = 319, .tname = _SLIT("v.ast.MatchExpr")} + , (VCastTypeIndexName){.tindex = 320, .tname = _SLIT("v.ast.NodeError")} + , (VCastTypeIndexName){.tindex = 321, .tname = _SLIT("v.ast.None")} + , (VCastTypeIndexName){.tindex = 322, .tname = _SLIT("v.ast.OffsetOf")} + , (VCastTypeIndexName){.tindex = 323, .tname = _SLIT("v.ast.OrExpr")} + , (VCastTypeIndexName){.tindex = 324, .tname = _SLIT("v.ast.ParExpr")} + , (VCastTypeIndexName){.tindex = 325, .tname = _SLIT("v.ast.PostfixExpr")} + , (VCastTypeIndexName){.tindex = 326, .tname = _SLIT("v.ast.PrefixExpr")} + , (VCastTypeIndexName){.tindex = 327, .tname = _SLIT("v.ast.RangeExpr")} + , (VCastTypeIndexName){.tindex = 328, .tname = _SLIT("v.ast.SelectExpr")} + , (VCastTypeIndexName){.tindex = 329, .tname = _SLIT("v.ast.SelectorExpr")} + , (VCastTypeIndexName){.tindex = 330, .tname = _SLIT("v.ast.SizeOf")} + , (VCastTypeIndexName){.tindex = 331, .tname = _SLIT("v.ast.SqlExpr")} + , (VCastTypeIndexName){.tindex = 332, .tname = _SLIT("v.ast.StringInterLiteral")} + , (VCastTypeIndexName){.tindex = 333, .tname = _SLIT("v.ast.StringLiteral")} + , (VCastTypeIndexName){.tindex = 334, .tname = _SLIT("v.ast.StructInit")} + , (VCastTypeIndexName){.tindex = 335, .tname = _SLIT("v.ast.TypeNode")} + , (VCastTypeIndexName){.tindex = 336, .tname = _SLIT("v.ast.TypeOf")} + , (VCastTypeIndexName){.tindex = 337, .tname = _SLIT("v.ast.UnsafeExpr")} + , (VCastTypeIndexName){.tindex = 364, .tname = _SLIT("v.ast.AsmRegister")} + , (VCastTypeIndexName){.tindex = 365, .tname = _SLIT("v.ast.ConstField")} + , (VCastTypeIndexName){.tindex = 366, .tname = _SLIT("v.ast.GlobalField")} + , (VCastTypeIndexName){.tindex = 367, .tname = _SLIT("v.ast.Var")} + , (VCastTypeIndexName){.tindex = 339, .tname = _SLIT("v.ast.AsmStmt")} + , (VCastTypeIndexName){.tindex = 340, .tname = _SLIT("v.ast.AssertStmt")} + , (VCastTypeIndexName){.tindex = 341, .tname = _SLIT("v.ast.AssignStmt")} + , (VCastTypeIndexName){.tindex = 342, .tname = _SLIT("v.ast.Block")} + , (VCastTypeIndexName){.tindex = 343, .tname = _SLIT("v.ast.BranchStmt")} + , (VCastTypeIndexName){.tindex = 344, .tname = _SLIT("v.ast.ComptimeFor")} + , (VCastTypeIndexName){.tindex = 345, .tname = _SLIT("v.ast.ConstDecl")} + , (VCastTypeIndexName){.tindex = 346, .tname = _SLIT("v.ast.DeferStmt")} + , (VCastTypeIndexName){.tindex = 347, .tname = _SLIT("v.ast.EmptyStmt")} + , (VCastTypeIndexName){.tindex = 348, .tname = _SLIT("v.ast.EnumDecl")} + , (VCastTypeIndexName){.tindex = 349, .tname = _SLIT("v.ast.ExprStmt")} , (VCastTypeIndexName){.tindex = 220, .tname = _SLIT("v.ast.FnDecl")} - , (VCastTypeIndexName){.tindex = 348, .tname = _SLIT("v.ast.ForCStmt")} - , (VCastTypeIndexName){.tindex = 349, .tname = _SLIT("v.ast.ForInStmt")} - , (VCastTypeIndexName){.tindex = 350, .tname = _SLIT("v.ast.ForStmt")} - , (VCastTypeIndexName){.tindex = 351, .tname = _SLIT("v.ast.GlobalDecl")} - , (VCastTypeIndexName){.tindex = 352, .tname = _SLIT("v.ast.GotoLabel")} - , (VCastTypeIndexName){.tindex = 353, .tname = _SLIT("v.ast.GotoStmt")} - , (VCastTypeIndexName){.tindex = 354, .tname = _SLIT("v.ast.HashStmt")} - , (VCastTypeIndexName){.tindex = 355, .tname = _SLIT("v.ast.Import")} - , (VCastTypeIndexName){.tindex = 356, .tname = _SLIT("v.ast.InterfaceDecl")} - , (VCastTypeIndexName){.tindex = 357, .tname = _SLIT("v.ast.Module")} - , (VCastTypeIndexName){.tindex = 358, .tname = _SLIT("v.ast.Return")} - , (VCastTypeIndexName){.tindex = 359, .tname = _SLIT("v.ast.SqlStmt")} - , (VCastTypeIndexName){.tindex = 360, .tname = _SLIT("v.ast.StructDecl")} - , (VCastTypeIndexName){.tindex = 284, .tname = _SLIT("v.ast.TypeDecl")} - , (VCastTypeIndexName){.tindex = 437, .tname = _SLIT("v.ast.AsmAddressing")} - , (VCastTypeIndexName){.tindex = 438, .tname = _SLIT("v.ast.AsmAlias")} - , (VCastTypeIndexName){.tindex = 439, .tname = _SLIT("v.ast.AsmDisp")} + , (VCastTypeIndexName){.tindex = 350, .tname = _SLIT("v.ast.ForCStmt")} + , (VCastTypeIndexName){.tindex = 351, .tname = _SLIT("v.ast.ForInStmt")} + , (VCastTypeIndexName){.tindex = 352, .tname = _SLIT("v.ast.ForStmt")} + , (VCastTypeIndexName){.tindex = 353, .tname = _SLIT("v.ast.GlobalDecl")} + , (VCastTypeIndexName){.tindex = 354, .tname = _SLIT("v.ast.GotoLabel")} + , (VCastTypeIndexName){.tindex = 355, .tname = _SLIT("v.ast.GotoStmt")} + , (VCastTypeIndexName){.tindex = 356, .tname = _SLIT("v.ast.HashStmt")} + , (VCastTypeIndexName){.tindex = 357, .tname = _SLIT("v.ast.Import")} + , (VCastTypeIndexName){.tindex = 358, .tname = _SLIT("v.ast.InterfaceDecl")} + , (VCastTypeIndexName){.tindex = 359, .tname = _SLIT("v.ast.Module")} + , (VCastTypeIndexName){.tindex = 360, .tname = _SLIT("v.ast.Return")} + , (VCastTypeIndexName){.tindex = 361, .tname = _SLIT("v.ast.SqlStmt")} + , (VCastTypeIndexName){.tindex = 362, .tname = _SLIT("v.ast.StructDecl")} + , (VCastTypeIndexName){.tindex = 286, .tname = _SLIT("v.ast.TypeDecl")} + , (VCastTypeIndexName){.tindex = 439, .tname = _SLIT("v.ast.AsmAddressing")} + , (VCastTypeIndexName){.tindex = 440, .tname = _SLIT("v.ast.AsmAlias")} + , (VCastTypeIndexName){.tindex = 441, .tname = _SLIT("v.ast.AsmDisp")} , (VCastTypeIndexName){.tindex = 20, .tname = _SLIT("string")} })); @@ -96900,11 +95035,11 @@ void _vinit(int ___argc, voidptr ___argv) { _const_none__ = /*&IError*/I_None___to_Interface_IError(((None__*)memdup(&(None__){.Error = ((Error){EMPTY_STRUCT_INITIALIZATION}),}, sizeof(None__)))); _const_children_bytes = sizeof(voidptr) * (_const_max_len + 1); } + { // Initializations for module strings.textscanner : + } { // Initializations for module dl : _const_dl__dl_ext = dl__get_shared_library_extension(); } - { // Initializations for module strings.textscanner : - } { // Initializations for module os.cmdline : } { // Initializations for module v.token : @@ -96921,141 +95056,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.mathutil : } - { // Initializations for module v.dotgraph : - } - { // Initializations for module hash : - } - { // Initializations for module rand.constants : - _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; - _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; - } - { // Initializations for module hash.fnv1a : - } - { // Initializations for module math.internal : - } - { // Initializations for module flag : - } - { // Initializations for module semver : - _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); - } - { // Initializations for module sync.stdatomic : - } - { // Initializations for module sync.threads : - } - { // Initializations for module os : - _const_os__invalid_handle_value = ((voidptr)(-1)); - _const_os__hkey_local_machine = ((voidptr)(0x80000002)); - _const_os__hkey_current_user = ((voidptr)(0x80000001)); - _const_os__hwnd_broadcast = ((voidptr)(0xFFFF)); - _const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv); - _const_os__wd_at_startup = os__getwd(); - } - { // Initializations for module v.errors : - } - { // Initializations for module v.depgraph : - } - { // Initializations for module math : - _const_math__pi_2 = _const_math__pi / 2.0; - _const_math__pi_4 = _const_math__pi / 4.0; - _const_math__log2_e = 1.0 / _const_math__ln2; - _const_math__log10_e = 1.0 / _const_math__ln10; - _const_math__min_i64 = ((i64)(-9223372036854775807 - 1)); - _const_math__max_i64 = ((i64)(9223372036854775807)); - _const_math__bernoulli = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ - 1.0 / (12.), -1.0 / (360), 1.0 / (1260), -1.0 / (1680), 5.0 / (5940), -691.0 / (360360), 7.0 / (1092.), -3617.0 / (122400), 43867.0 / (243576.), - -174611.0 / (125400)})); - _const_math__factorials_table = new_array_from_c_array(171, 171, sizeof(f64), _MOV((f64[171]){ - 1.000000000000000000000e+0, 1.000000000000000000000e+0, 2.000000000000000000000e+0, 6.000000000000000000000e+0, 2.400000000000000000000e+1, 1.200000000000000000000e+2, 7.200000000000000000000e+2, 5.040000000000000000000e+3, 4.032000000000000000000e+4, - 3.628800000000000000000e+5, 3.628800000000000000000e+6, 3.991680000000000000000e+7, 4.790016000000000000000e+8, 6.227020800000000000000e+9, 8.717829120000000000000e+10, 1.307674368000000000000e+12, 2.092278988800000000000e+13, - 3.556874280960000000000e+14, 6.402373705728000000000e+15, 1.216451004088320000000e+17, 2.432902008176640000000e+18, 5.109094217170944000000e+19, 1.124000727777607680000e+21, 2.585201673888497664000e+22, 6.204484017332394393600e+23, - 1.551121004333098598400e+25, 4.032914611266056355840e+26, 1.088886945041835216077e+28, 3.048883446117138605015e+29, 8.841761993739701954544e+30, 2.652528598121910586363e+32, 8.222838654177922817726e+33, 2.631308369336935301672e+35, - 8.683317618811886495518e+36, 2.952327990396041408476e+38, 1.033314796638614492967e+40, 3.719933267899012174680e+41, 1.376375309122634504632e+43, 5.230226174666011117600e+44, 2.039788208119744335864e+46, 8.159152832478977343456e+47, - 3.345252661316380710817e+49, 1.405006117752879898543e+51, 6.041526306337383563736e+52, 2.658271574788448768044e+54, 1.196222208654801945620e+56, 5.502622159812088949850e+57, 2.586232415111681806430e+59, 1.241391559253607267086e+61, - 6.082818640342675608723e+62, 3.041409320171337804361e+64, 1.551118753287382280224e+66, 8.065817517094387857166e+67, 4.274883284060025564298e+69, 2.308436973392413804721e+71, 1.269640335365827592597e+73, 7.109985878048634518540e+74, - 4.052691950487721675568e+76, 2.350561331282878571829e+78, 1.386831185456898357379e+80, 8.320987112741390144276e+81, 5.075802138772247988009e+83, 3.146997326038793752565e+85, 1.982608315404440064116e+87, 1.268869321858841641034e+89, - 8.247650592082470666723e+90, 5.443449390774430640037e+92, 3.647111091818868528825e+94, 2.480035542436830599601e+96, 1.711224524281413113725e+98, 1.197857166996989179607e+100, 8.504785885678623175212e+101, 6.123445837688608686152e+103, - 4.470115461512684340891e+105, 3.307885441519386412260e+107, 2.480914081139539809195e+109, 1.885494701666050254988e+111, 1.451830920282858696341e+113, 1.132428117820629783146e+115, 8.946182130782975286851e+116, 7.156945704626380229481e+118, - 5.797126020747367985880e+120, 4.753643337012841748421e+122, 3.945523969720658651190e+124, 3.314240134565353266999e+126, 2.817104114380550276949e+128, 2.422709538367273238177e+130, 2.107757298379527717214e+132, 1.854826422573984391148e+134, - 1.650795516090846108122e+136, 1.485715964481761497310e+138, 1.352001527678402962552e+140, 1.243841405464130725548e+142, 1.156772507081641574759e+144, 1.087366156656743080274e+146, 1.032997848823905926260e+148, 9.916779348709496892096e+149, - 9.619275968248211985333e+151, 9.426890448883247745626e+153, 9.332621544394415268170e+155, 9.332621544394415268170e+157, 9.425947759838359420852e+159, 9.614466715035126609269e+161, 9.902900716486180407547e+163, 1.029901674514562762385e+166, - 1.081396758240290900504e+168, 1.146280563734708354534e+170, 1.226520203196137939352e+172, 1.324641819451828974500e+174, 1.443859583202493582205e+176, 1.588245541522742940425e+178, 1.762952551090244663872e+180, 1.974506857221074023537e+182, - 2.231192748659813646597e+184, 2.543559733472187557120e+186, 2.925093693493015690688e+188, 3.393108684451898201198e+190, 3.969937160808720895402e+192, 4.684525849754290656574e+194, 5.574585761207605881323e+196, 6.689502913449127057588e+198, - 8.094298525273443739682e+200, 9.875044200833601362412e+202, 1.214630436702532967577e+205, 1.506141741511140879795e+207, 1.882677176888926099744e+209, 2.372173242880046885677e+211, 3.012660018457659544810e+213, 3.856204823625804217357e+215, - 4.974504222477287440390e+217, 6.466855489220473672507e+219, 8.471580690878820510985e+221, 1.118248651196004307450e+224, 1.487270706090685728908e+226, 1.992942746161518876737e+228, 2.690472707318050483595e+230, 3.659042881952548657690e+232, - 5.012888748274991661035e+234, 6.917786472619488492228e+236, 9.615723196941089004197e+238, 1.346201247571752460588e+241, 1.898143759076170969429e+243, 2.695364137888162776589e+245, 3.854370717180072770522e+247, 5.550293832739304789551e+249, - 8.047926057471991944849e+251, 1.174997204390910823948e+254, 1.727245890454638911203e+256, 2.556323917872865588581e+258, 3.808922637630569726986e+260, 5.713383956445854590479e+262, 8.627209774233240431623e+264, 1.311335885683452545607e+267, - 2.006343905095682394778e+269, 3.089769613847350887959e+271, 4.789142901463393876336e+273, 7.471062926282894447084e+275, 1.172956879426414428192e+278, 1.853271869493734796544e+280, 2.946702272495038326504e+282, 4.714723635992061322407e+284, - 7.590705053947218729075e+286, 1.229694218739449434110e+289, 2.004401576545302577600e+291, 3.287218585534296227263e+293, 5.423910666131588774984e+295, 9.003691705778437366474e+297, 1.503616514864999040201e+300, 2.526075744973198387538e+302, - 4.269068009004705274939e+304, 7.257415615307998967397e+306})); - _const_math__log_factorials_table = new_array_from_c_array(172, 172, sizeof(f64), _MOV((f64[172]){ - 0.000000000000000000000e+0, 0.000000000000000000000e+0, 6.931471805599453094172e-1, 1.791759469228055000812e+0, 3.178053830347945619647e+0, 4.787491742782045994248e+0, 6.579251212010100995060e+0, 8.525161361065414300166e+0, 1.060460290274525022842e+1, - 1.280182748008146961121e+1, 1.510441257307551529523e+1, 1.750230784587388583929e+1, 1.998721449566188614952e+1, 2.255216385312342288557e+1, 2.519122118273868150009e+1, 2.789927138384089156609e+1, 3.067186010608067280376e+1, - 3.350507345013688888401e+1, 3.639544520803305357622e+1, 3.933988418719949403622e+1, 4.233561646075348502966e+1, 4.538013889847690802616e+1, 4.847118135183522387964e+1, 5.160667556776437357045e+1, 5.478472939811231919009e+1, - 5.800360522298051993929e+1, 6.126170176100200198477e+1, 6.455753862700633105895e+1, 6.788974313718153498289e+1, 7.125703896716800901007e+1, 7.465823634883016438549e+1, 7.809222355331531063142e+1, 8.155795945611503717850e+1, - 8.505446701758151741396e+1, 8.858082754219767880363e+1, 9.213617560368709248333e+1, 9.571969454214320248496e+1, 9.933061245478742692933e+1, 1.029681986145138126988e+2, 1.066317602606434591262e+2, 1.103206397147573954291e+2, - 1.140342117814617032329e+2, 1.177718813997450715388e+2, 1.215330815154386339623e+2, 1.253172711493568951252e+2, 1.291239336391272148826e+2, 1.329525750356163098828e+2, 1.368027226373263684696e+2, 1.406739236482342593987e+2, - 1.445657439463448860089e+2, 1.484777669517730320675e+2, 1.524095925844973578392e+2, 1.563608363030787851941e+2, 1.603311282166309070282e+2, 1.643201122631951814118e+2, 1.683274454484276523305e+2, 1.723527971391628015638e+2, - 1.763958484069973517152e+2, 1.804562914175437710518e+2, 1.845338288614494905025e+2, 1.886281734236715911873e+2, 1.927390472878449024360e+2, 1.968661816728899939914e+2, 2.010093163992815266793e+2, 2.051681994826411985358e+2, - 2.093425867525368356464e+2, 2.135322414945632611913e+2, 2.177369341139542272510e+2, 2.219564418191303339501e+2, 2.261905483237275933323e+2, 2.304390435657769523214e+2, 2.347017234428182677427e+2, 2.389783895618343230538e+2, - 2.432688490029827141829e+2, 2.475729140961868839366e+2, 2.518904022097231943772e+2, 2.562211355500095254561e+2, 2.605649409718632093053e+2, 2.649216497985528010421e+2, 2.692910976510198225363e+2, 2.736731242856937041486e+2, - 2.780675734403661429141e+2, 2.824742926876303960274e+2, 2.868931332954269939509e+2, 2.913239500942703075662e+2, 2.957666013507606240211e+2, 3.002209486470141317540e+2, 3.046868567656687154726e+2, 3.091641935801469219449e+2, - 3.136528299498790617832e+2, 3.181526396202093268500e+2, 3.226634991267261768912e+2, 3.271852877037752172008e+2, 3.317178871969284731381e+2, 3.362611819791984770344e+2, 3.408150588707990178690e+2, 3.453794070622668541074e+2, - 3.499541180407702369296e+2, 3.545390855194408088492e+2, 3.591342053695753987760e+2, 3.637393755555634901441e+2, 3.683544960724047495950e+2, 3.729794688856890206760e+2, 3.776141978739186564468e+2, 3.822585887730600291111e+2, - 3.869125491232175524822e+2, 3.915759882173296196258e+2, 3.962488170517915257991e+2, 4.009309482789157454921e+2, 4.056222961611448891925e+2, 4.103227765269373054205e+2, 4.150323067282496395563e+2, 4.197508055995447340991e+2, - 4.244781934182570746677e+2, 4.292143918666515701285e+2, 4.339593239950148201939e+2, 4.387129141861211848399e+2, 4.434750881209189409588e+2, 4.482457727453846057188e+2, 4.530248962384961351041e+2, 4.578123879812781810984e+2, - 4.626081785268749221865e+2, 4.674121995716081787447e+2, 4.722243839269805962399e+2, 4.770446654925856331047e+2, 4.818729792298879342285e+2, 4.867092611368394122258e+2, 4.915534482232980034989e+2, 4.964054784872176206648e+2, - 5.012652908915792927797e+2, 5.061328253420348751997e+2, 5.110080226652360267439e+2, 5.158908245878223975982e+2, 5.207811737160441513633e+2, 5.256790135159950627324e+2, 5.305842882944334921812e+2, 5.354969431801695441897e+2, - 5.404169241059976691050e+2, 5.453441777911548737966e+2, 5.502786517242855655538e+2, 5.552202941468948698523e+2, 5.601690540372730381305e+2, 5.651248810948742988613e+2, 5.700877257251342061414e+2, 5.750575390247102067619e+2, - 5.800342727671307811636e+2, 5.850178793888391176022e+2, 5.900083119756178539038e+2, 5.950055242493819689670e+2, 6.000094705553274281080e+2, 6.050201058494236838580e+2, 6.100373856862386081868e+2, 6.150612662070848845750e+2, - 6.200917041284773200381e+2, 6.251286567308909491967e+2, 6.301720818478101958172e+2, 6.352219378550597328635e+2, 6.402781836604080409209e+2, 6.453407786934350077245e+2, 6.504096828956552392500e+2, 6.554848567108890661717e+2, - 6.605662610758735291676e+2, 6.656538574111059132426e+2, 6.707476076119126755767e+2, 6.758474740397368739994e+2, 6.809534195136374546094e+2, 6.860654073019939978423e+2, 6.911834011144107529496e+2, 6.963073650938140118743e+2, - 7.014372638087370853465e+2, 7.065730622457873471107e+2, 7.117147258022900069535e+2})); - _const_math__gamma_p = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.60119522476751861407e-04, 1.19135147006586384913e-03, 1.04213797561761569935e-02, 4.76367800457137231464e-02, 2.07448227648435975150e-01, 4.94214826801497100753e-01, 9.99999999999999996796e-01})); - _const_math__gamma_q = new_array_from_c_array(8, 8, sizeof(f64), _MOV((f64[8]){-2.31581873324120129819e-05, 5.39605580493303397842e-04, -4.45641913851797240494e-03, 1.18139785222060435552e-02, 3.58236398605498653373e-02, -2.34591795718243348568e-01, 7.14304917030273074085e-02, 1.00000000000000000320e+00})); - _const_math__gamma_s = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){7.87311395793093628397e-04, -2.29549961613378126380e-04, -2.68132617805781232825e-03, 3.47222221605458667310e-03, 8.33333333333482257126e-02})); - _const_math__lgamma_a = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ - 7.72156649015328655494e-02, 3.22467033424113591611e-01, 6.73523010531292681824e-02, 2.05808084325167332806e-02, 7.38555086081402883957e-03, 2.89051383673415629091e-03, 1.19270763183362067845e-03, 5.10069792153511336608e-04, 2.20862790713908385557e-04, - 1.08011567247583939954e-04, 2.52144565451257326939e-05, 4.48640949618915160150e-05})); - _const_math__lgamma_r = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){1.0, 1.39200533467621045958e+00, 7.21935547567138069525e-01, 1.71933865632803078993e-01, 1.86459191715652901344e-02, 7.77942496381893596434e-04, 7.32668430744625636189e-06})); - _const_math__lgamma_s = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){-7.72156649015328655494e-02, 2.14982415960608852501e-01, 3.25778796408930981787e-01, 1.46350472652464452805e-01, 2.66422703033638609560e-02, 1.84028451407337715652e-03, 3.19475326584100867617e-05})); - _const_math__lgamma_t = new_array_from_c_array(15, 15, sizeof(f64), _MOV((f64[15]){ - 4.83836122723810047042e-01, -1.47587722994593911752e-01, 6.46249402391333854778e-02, -3.27885410759859649565e-02, 1.79706750811820387126e-02, -1.03142241298341437450e-02, 6.10053870246291332635e-03, -3.68452016781138256760e-03, 2.25964780900612472250e-03, - -1.40346469989232843813e-03, 8.81081882437654011382e-04, -5.38595305356740546715e-04, 3.15632070903625950361e-04, -3.12754168375120860518e-04, 3.35529192635519073543e-04})); - _const_math__lgamma_u = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){-7.72156649015328655494e-02, 6.32827064025093366517e-01, 1.45492250137234768737e+00, 9.77717527963372745603e-01, 2.28963728064692451092e-01, 1.33810918536787660377e-02})); - _const_math__lgamma_v = new_array_from_c_array(6, 6, sizeof(f64), _MOV((f64[6]){1.0, 2.45597793713041134822e+00, 2.12848976379893395361e+00, 7.69285150456672783825e-01, 1.04222645593369134254e-01, 3.21709242282423911810e-03})); - _const_math__lgamma_w = new_array_from_c_array(7, 7, sizeof(f64), _MOV((f64[7]){4.18938533204672725052e-01, 8.33333333333329678849e-02, -2.77777777728775536470e-03, 7.93650558643019558500e-04, -5.95187557450339963135e-04, 8.36339918996282139126e-04, -1.63092934096575273989e-03})); - _const_math__pow10tab = new_array_from_c_array(32, 32, sizeof(f64), _MOV((f64[32]){ - ((f64)(1e+00)), 1e+01, 1e+02, 1e+03, 1e+04, 1e+05, 1e+06, 1e+07, 1e+08, - 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, - 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, - 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, 1e+31})); - _const_math__pow10postab32 = new_array_from_c_array(10, 10, sizeof(f64), _MOV((f64[10]){ - ((f64)(1e+00)), 1e+32, 1e+64, 1e+96, 1e+128, 1e+160, 1e+192, 1e+224, 1e+256, - 1e+288})); - _const_math__pow10negtab32 = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ - ((f64)(1e-00)), 1e-32, 1e-64, 1e-96, 1e-128, 1e-160, 1e-192, 1e-224, 1e-256, - 1e-288, 1e-320})); - _const_math__sin_data = new_array_from_c_array(12, 12, sizeof(f64), _MOV((f64[12]){ - -0.3295190160663511504173, 0.0025374284671667991990, 0.0006261928782647355874, -4.6495547521854042157541e-06, -5.6917531549379706526677e-07, 3.7283335140973803627866e-09, 3.0267376484747473727186e-10, -1.7400875016436622322022e-12, -1.0554678305790849834462e-13, - 5.3701981409132410797062e-16, 2.5984137983099020336115e-17, -1.1821555255364833468288e-19})); - _const_math__sin_cs = ((math__ChebSeries){.c = _const_math__sin_data,.order = 11,.a = -1,.b = 1,}); - _const_math__cos_data = new_array_from_c_array(11, 11, sizeof(f64), _MOV((f64[11]){ - 0.165391825637921473505668118136, -0.00084852883845000173671196530195, -0.000210086507222940730213625768083, 1.16582269619760204299639757584e-6, 1.43319375856259870334412701165e-7, -7.4770883429007141617951330184e-10, -6.0969994944584252706997438007e-11, 2.90748249201909353949854872638e-13, 1.77126739876261435667156490461e-14, - -7.6896421502815579078577263149e-17, -3.7363121133079412079201377318e-18})); - _const_math__cos_cs = ((math__ChebSeries){.c = _const_math__cos_data,.order = 10,.a = -1,.b = 1,}); - _const_math__tan_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-1.30936939181383777646e+4, 1.15351664838587416140e+6, -1.79565251976484877988e+7})); - _const_math__tan_q = new_array_from_c_array(5, 5, sizeof(f64), _MOV((f64[5]){1.00000000000000000000e+0, 1.36812963470692954678e+4, -1.32089234440210967447e+6, 2.50083801823357915839e+7, -5.38695755929454629881e+7})); - _const_math__tanh_p = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){-9.64399179425052238628e-1, -9.92877231001918586564e+1, -1.61468768441708447952e+3})); - _const_math__tanh_q = new_array_from_c_array(3, 3, sizeof(f64), _MOV((f64[3]){1.12811678491632931402e+2, 2.23548839060100448583e+3, 4.84406305325125486048e+3})); - } - { // Initializations for module v.vet : - } - { // Initializations for module term : - } - { // Initializations for module v.util.version : - } - { // Initializations for module v.vcache : - } { // Initializations for module time : _const_time__tokens_2 = new_array_from_c_array(16, 16, sizeof(string), _MOV((string[16]){ _SLIT("MM"), _SLIT("DD"), _SLIT("Do"), _SLIT("YY"), _SLIT("ss"), _SLIT("kk"), _SLIT("NN"), _SLIT("mm"), _SLIT("hh"), @@ -97084,6 +95084,51 @@ void _vinit(int ___argc, voidptr ___argv) { _const_time__freq_time = time__init_win_time_freq(); _const_time__start_local_time = time__local_as_unix_time(); } + { // Initializations for module v.dotgraph : + } + { // Initializations for module hash : + } + { // Initializations for module rand.constants : + _const_rand__constants__max_u32_as_f32 = ((f32)(_const_rand__constants__max_u32)) + 1; + _const_rand__constants__max_u64_as_f64 = ((f64)(_const_rand__constants__max_u64)) + 1; + } + { // Initializations for module hash.fnv1a : + } + { // Initializations for module rand.buffer : + } + { // Initializations for module flag : + } + { // Initializations for module semver : + _const_semver__versions = new_array_from_c_array(3, 3, sizeof(int), _MOV((int[3]){_const_semver__ver_major, _const_semver__ver_minor, _const_semver__ver_patch})); + } + { // Initializations for module sync.stdatomic : + } + { // Initializations for module sync.threads : + } + { // Initializations for module os : + _const_os__invalid_handle_value = ((voidptr)(-1)); + _const_os__hkey_local_machine = ((voidptr)(0x80000002)); + _const_os__hkey_current_user = ((voidptr)(0x80000001)); + _const_os__hwnd_broadcast = ((voidptr)(0xFFFF)); + _const_os__args = os__init_os_args_wide(___argc, (byteptr*)___argv); + _const_os__wd_at_startup = os__getwd(); + } + { // Initializations for module v.errors : + } + { // Initializations for module v.depgraph : + } + { // Initializations for module v.vet : + } + { // Initializations for module rand.seed : + } + { // Initializations for module term : + } + { // Initializations for module v.util.version : + } + { // Initializations for module v.vcache : + } + { // Initializations for module v.util.diff : + } { // Initializations for module v.vmod : _const_v__vmod__mod_file_stop_paths = new_array_from_c_array(4, 4, sizeof(string), _MOV((string[4]){_SLIT(".git"), _SLIT(".hg"), _SLIT(".svn"), _SLIT(".v.mod.stop")})); _const_v__vmod__private_file_cacher = v__vmod__new_mod_file_cacher(); @@ -97092,6 +95137,10 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module v.cflag : } + { // Initializations for module rand.config : + } + { // Initializations for module rand.wyrand : + } { // Initializations for module v.pkgconfig : _const_v__pkgconfig__default_paths = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("/usr/local/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/local/lib64/pkgconfig"), _SLIT("/usr/local/lib/pkgconfig"), _SLIT("/usr/local/share/pkgconfig"), _SLIT("/usr/lib/x86_64-linux-gnu/pkgconfig"), _SLIT("/usr/lib/aarch64-linux-gnu/pkgconfig"), _SLIT("/usr/lib64/pkgconfig"), _SLIT("/usr/lib/pkgconfig"), _SLIT("/usr/share/pkgconfig"), @@ -97099,14 +95148,6 @@ void _vinit(int ___argc, voidptr ___argv) { } { // Initializations for module runtime : } - { // Initializations for module v.util.diff : - } - { // Initializations for module rand.seed : - } - { // Initializations for module rand.config : - } - { // Initializations for module rand.wyrand : - } { // Initializations for module rand : _const_rand__clock_seq_hi_and_reserved_valid_values = new_array_from_c_array(4, 4, sizeof(rune), _MOV((rune[4]){'8', '9', 'a', 'b'})); default_rng = *(rand__PRNG**)&((rand__PRNG*[]){0}[0]); // global @@ -97128,7 +95169,16 @@ void _vinit(int ___argc, voidptr ___argv) { _const_v__util__invalid_escapes = string_bytes(_SLIT("({$`.")); _const_v__util__builtin_module_parts = new_array_from_c_array(6, 6, sizeof(string), _MOV((string[6]){_SLIT("math.bits"), _SLIT("strconv"), _SLIT("dlmalloc"), _SLIT("strconv.ftoa"), _SLIT("strings"), _SLIT("builtin")})); _const_v__util__bundle_modules = new_array_from_c_array(7, 7, sizeof(string), _MOV((string[7]){_SLIT("clipboard"), _SLIT("fontstash"), _SLIT("gg"), _SLIT("gx"), _SLIT("sokol"), _SLIT("szip"), _SLIT("ui")})); - _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), _MOV((string[1]){_SLIT("vdoc"), }), _MOV((Array_string[1]){new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("markdown")})), })); + _const_v__util__external_module_dependencies_for_tool = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(Array_string), + _MOV((string[1]){ + _SLIT("vdoc"), + }), + _MOV((Array_string[1]){ + new_array_from_c_array(1, 1, sizeof(string), _MOV((string[1]){_SLIT("markdown")})), + }) + ) + +; _const_v__util__const_tabs = new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT(""), _SLIT("\t"), _SLIT("\t\t"), _SLIT("\t\t\t"), _SLIT("\t\t\t\t"), _SLIT("\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t"), _SLIT("\t\t\t\t\t\t\t\t\t\t")})); @@ -97140,21 +95190,161 @@ void _vinit(int ___argc, voidptr ___argv) { _const_sync__pool__no_result = ((voidptr)(0)); } { // Initializations for module v.ast : - _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), _MOV((int[4]){8, 16, 32, 64, }), _MOV((Array_string[4]){new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ + _const_v__ast__x86_no_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 4, sizeof(int), sizeof(Array_string), + _MOV((int[4]){ + 8, + 16, + 32, + 64, + }), + _MOV((Array_string[4]){ + new_array_from_c_array(12, 12, sizeof(string), _MOV((string[12]){ _SLIT("al"), _SLIT("ah"), _SLIT("bl"), _SLIT("bh"), _SLIT("cl"), _SLIT("ch"), _SLIT("dl"), _SLIT("dh"), _SLIT("bpl"), - _SLIT("sil"), _SLIT("dil"), _SLIT("spl")})), new_array_from_c_array(23, 23, sizeof(string), _MOV((string[23]){ + _SLIT("sil"), _SLIT("dil"), _SLIT("spl")})), + new_array_from_c_array(23, 23, sizeof(string), _MOV((string[23]){ _SLIT("ax"), _SLIT("bx"), _SLIT("cx"), _SLIT("dx"), _SLIT("bp"), _SLIT("si"), _SLIT("di"), _SLIT("sp"), _SLIT("cs"), _SLIT("ss"), _SLIT("ds"), _SLIT("es"), _SLIT("fs"), _SLIT("gs"), _SLIT("flags"), _SLIT("ip"), _SLIT("gdtr"), - _SLIT("idtr"), _SLIT("tr"), _SLIT("ldtr"), _SLIT("fp_cs"), _SLIT("fp_ds"), _SLIT("fp_opc")})), new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ + _SLIT("idtr"), _SLIT("tr"), _SLIT("ldtr"), _SLIT("fp_cs"), _SLIT("fp_ds"), _SLIT("fp_opc")})), + new_array_from_c_array(11, 11, sizeof(string), _MOV((string[11]){ _SLIT("eax"), _SLIT("ebx"), _SLIT("ecx"), _SLIT("edx"), _SLIT("ebp"), _SLIT("esi"), _SLIT("edi"), _SLIT("esp"), _SLIT("eflags"), - _SLIT("eip"), _SLIT("mxcsr")})), new_array_from_c_array(10, 10, sizeof(string), _MOV((string[10]){ + _SLIT("eip"), _SLIT("mxcsr")})), + new_array_from_c_array(10, 10, sizeof(string), _MOV((string[10]){ _SLIT("rax"), _SLIT("rbx"), _SLIT("rcx"), _SLIT("rdx"), _SLIT("rbp"), _SLIT("rsi"), _SLIT("rdi"), _SLIT("rsp"), _SLIT("rflags"), - _SLIT("rip")})), })); - _const_v__ast__x86_with_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 8, sizeof(int), sizeof(Map_string_int), _MOV((int[8]){8, 16, 32, 64, 80, 128, 256, 512, }), _MOV((Map_string_int[8]){new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#b"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#w"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#d"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), _MOV((string[4]){_SLIT("r#"), _SLIT("mm#"), _SLIT("cr#"), _SLIT("dr#"), }), _MOV((int[4]){16, 16, 16, 16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("st#"), }), _MOV((int[1]){16, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("xmm#"), }), _MOV((int[1]){32, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("ymm#"), }), _MOV((int[1]){32, })), new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("zmm#"), }), _MOV((int[1]){32, })), })); + _SLIT("rip")})), + }) + ) + +; + _const_v__ast__x86_with_number_register_list = new_map_init(&map_hash_int_4, &map_eq_int_4, &map_clone_int_4, &map_free_nop, 8, sizeof(int), sizeof(Map_string_int), + _MOV((int[8]){ + 8, + 16, + 32, + 64, + 80, + 128, + 256, + 512, + }), + _MOV((Map_string_int[8]){ + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#b"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#w"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#d"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 4, sizeof(string), sizeof(int), + _MOV((string[4]){ + _SLIT("r#"), + _SLIT("mm#"), + _SLIT("cr#"), + _SLIT("dr#"), + }), + _MOV((int[4]){ + 16, + 16, + 16, + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("st#"), + }), + _MOV((int[1]){ + 16, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("xmm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("ymm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("zmm#"), + }), + _MOV((int[1]){ + 32, + }) + ) + +, + }) + ) + +; _const_v__ast__arm_no_number_register_list = new_array_from_c_array(5, 5, sizeof(string), _MOV((string[5]){_SLIT("fp"), _SLIT("ip"), _SLIT("sp"), _SLIT("lr"), _SLIT("pc")})); - _const_v__ast__arm_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), _MOV((string[1]){_SLIT("r#"), }), _MOV((int[1]){16, })); + _const_v__ast__arm_with_number_register_list = new_map_init(&map_hash_string, &map_eq_string, &map_clone_string, &map_free_string, 1, sizeof(string), sizeof(int), + _MOV((string[1]){ + _SLIT("r#"), + }), + _MOV((int[1]){ + 16, + }) + ) + +; _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__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){.methods = __new_array(0, 0, sizeof(v__ast__Fn)), .info = {0},