Commit Graph

1380 Commits (54b10e99a15212ae4e2f42fc26101c0a61468017)

Author SHA1 Message Date
Alexander Medvednikov 8fc0b486a2 builtin: fix string interpolation when compiling with -nofloat 2021-09-13 18:40:32 +03:00
Alexander Medvednikov cfcc57f5d3 checker: remove unnecessary "no methods" error; builder: skip float.c.v with -nofloat 2021-09-13 18:14:26 +03:00
playX 5b619b99c2
v.gen.js: Interfaces support, fix for error propagation & panic stacktraces (#11471) 2021-09-11 14:24:47 +03:00
Alexander Medvednikov ab3adf3346 checker: no longer allow automatic dereferncing in `a = b` 2021-09-09 20:21:01 +03:00
Enzo 1a2d5f65fb
builtin: add `size_t.str()` again (#11446) 2021-09-09 10:50:35 +03:00
Delyan Angelov 4faa0f8487
v.checker: add checks for `.free()` methods 2021-09-09 09:54:06 +03:00
playX 72089c4feb
js: use prefixed names for functions and global symbols (#11387) 2021-09-08 20:30:46 +03:00
Alexander Medvednikov 55451baa03 builtin: i32 alias 2021-09-08 14:49:02 +03:00
Enzo bef3390f36
builtin: fix compilation (#11445) 2021-09-08 14:19:21 +03:00
Enzo 56ad5d72ef
builtin: add `.str` method for `i/usize` (#11441) 2021-09-08 13:41:08 +03:00
Enzo e3b65092d6
parser: deprecate `size_t` (#11443) 2021-09-08 13:09:32 +03:00
Enzo cc8ee5fb84
all: introduce `isize` and `usize` (#11437) 2021-09-08 05:53:39 +03:00
penguindark bd10a63839
builtin: string interpolation: binary format support (#11421) 2021-09-07 00:12:54 +03:00
Lathanao 78c26e69cf
builtin: fix the string.index_any method (#11310) 2021-09-06 15:06:37 +03:00
yuyi 5181031480
builtin: check array.sort_with_compare() arg mismatch (#11385) 2021-09-04 15:02:05 +03:00
Delyan Angelov 91f7be98d0
builtin.js.v: run vfmt 2021-09-03 14:13:36 +03:00
playX a4df418a68
js: support `[export: 'AnotherName']` for FnDecl codegen (#11377) 2021-09-03 13:00:24 +03:00
playX 08c517c966
strconv,v.gen.js: proper optionals returns, strconv compiles to the JS backend (#11364) 2021-09-03 12:16:07 +03:00
playX a9b705bfd8
js: fix printing, make builtins for result and option types behave correctly (#11336) 2021-08-30 20:47:18 +03:00
yuyi f44eb88a8d
vfmt: fmt '!(a in/is b)' to 'a !in/is b' (#11335) 2021-08-30 09:45:36 +03:00
playX 61ac7b671d
js: add initial support for optional types, IfGuardExpr codegen for `if` (#11332) 2021-08-29 14:27:17 +03:00
playX 118c5fdcd8
js: fix -stats compilation of tests, proper alias codegen (#11327) 2021-08-28 16:57:33 +03:00
Alexander Medvednikov cf4081e2dd all: more chdir/chmod fixes 2021-08-28 12:52:48 +03:00
playX bdf11d969a
js: add basic support for running tests, fix string.replace_each (#11314) 2021-08-26 15:20:54 +03:00
playX 109d5d5847
js: `os` now compiles to the JS backend, more builtins & minor codegen fixes (#11302) 2021-08-25 14:40:53 +03:00
playX d78e7e3b2b
js: codegen fixes, W.I.P `os` availability for JS backend (#11281) 2021-08-23 14:25:02 +03:00
penguindark fde934cd93
builtin: optimize hex() (#11261) 2021-08-22 11:10:24 +03:00
Delyan Angelov fe08e1c504
strings: add Builder.write_rune/1 and Builder.write_runes/1 methods 2021-08-19 07:18:09 +03:00
Alexander Medvednikov 26b77515b9 builtin: optimize []rune.string() 2021-08-19 06:58:53 +03:00
playX 0121c8b4fd
v.gen.js: fix method calls and other codegen parts, rand module compiles (#11205) 2021-08-18 11:33:37 +03:00
Subhomoy Haldar 8dc043ba2c
builtin: fix minor C fn definitions (#11180) 2021-08-14 17:19:27 +03:00
Delyan Angelov 34d39ccb64
builtin: fix leak in rune.str(), fix leaks in most assert x == y statements in tests (#11091) 2021-08-13 18:37:34 +03:00
Subhomoy Haldar 0bd68bf5a2
builtin: rename invalid parameter names in C fn declarations (#11173) 2021-08-13 17:03:39 +03:00
Delyan Angelov 47884dfd1f
builtin: move C. calls to .c.v files (#11164) 2021-08-12 21:46:38 +03:00
playX c9e9556a92
js: array.delete_last() (#11160) 2021-08-12 19:39:33 +03:00
Enzo 506c30a291
builtin: remove methods that can be autogenerated (#11109) 2021-08-09 15:42:31 +03:00
playX 7a67a08d2f
js: implement codegen for array.sort and implement .any,.all (#11100) 2021-08-09 01:46:40 +03:00
playX 94c321c80d
v.gen.js: port fully the array test suite & add fixes (#11073) 2021-08-07 17:58:49 +03:00
zakuro 490dec222f
fmt: keep char literal, `'` (#11060) 2021-08-06 06:21:28 +03:00
Enzo 7346aeca5f
cgen: refactor array sort generation (#11067) 2021-08-06 03:55:48 +03:00
playX 8743b616a0
v.gen.js: codegen fixes, add a few builtins, port more array tests (#11049) 2021-08-04 12:46:24 +03:00
Daniel Däschle 800c0e5092
vlib: remove deprecated map{} usages as well as deprecated functions (#11035) 2021-08-04 12:44:41 +03:00
yuyi b870f7a6f1
cgen: fix array sort error (#11046) 2021-08-04 06:31:57 +03:00
Enzo fc193bebf2
builtin: add documentation for builtin array functions (#11023) 2021-08-03 06:25:33 +03:00
playX 836ac54d12
v.gen.js: add more array tests and fixes (#11014) 2021-08-01 14:08:49 +03:00
playX a7ca051016
v.gen.js: fix for array filter, add more tests and other fixes (#10999) 2021-07-30 11:17:11 +03:00
playX 75c41252d9
js: add more tests & add array prepend codegen (#10988) 2021-07-29 11:39:36 +03:00
Alexander Medvednikov b79dd7f0b3 builtin: re-enable u8 alias 2021-07-29 06:46:12 +03:00
Alexander Medvednikov 09df5adbdd builtin: re-gen v.c 2021-07-29 06:45:04 +03:00
Alexander Medvednikov 1343ec7444 builtin: fix temporary u8 alias 2021-07-29 06:42:22 +03:00
Alexander Medvednikov a7270148e5 builtin: remove u8 alias to re-generate v.c 2021-07-28 22:41:41 +03:00
Alexander Medvednikov 65126efdc3 builtin: remove u8 for now 2021-07-28 22:36:04 +03:00
playX e3cf95b058
js: add more tests for array, support array insert_many, minor fixes for references (#10983) 2021-07-28 13:01:00 +03:00
shadow 66bc8bc0cb
vlib: remove many deprecated functions (#10972) 2021-07-28 09:22:19 +03:00
Delyan Angelov b0a721b2ec
js: draft support for compiling `-b js x_test.v` 2021-07-27 13:49:47 +03:00
Delyan Angelov b44f81528f
v.gen.c: fix codegen for `const a = u64(5) + 5` 2021-07-26 08:06:59 +03:00
Delyan Angelov 6438099644
builtin: fix building vinix (missing C.strerror) 2021-07-25 23:31:22 +03:00
Uwe Krüger a6245a56d8
builtin: fix Windows panic message (#10952) 2021-07-25 15:34:48 +03:00
Uwe Krüger 55c5b9ce7b
cgen: panic with error message when `go` command fails (#10943) 2021-07-25 01:13:34 +03:00
spaceface a621149fc2
builtin: add bdwgc to thirdparty, statically link it on Windows (#10542) 2021-07-24 16:04:26 +03:00
playX f51fa7e665
v.gen.js: fix references and add iterator to map (#10938) 2021-07-24 15:35:17 +03:00
yuyi 29cda252f1
builtin: fix multiple array init (#10929) 2021-07-23 23:25:12 +03:00
playX 69cbdf9fdc
v.gen.js, os_js: port the OS module to JS (#10872) 2021-07-23 18:04:36 +03:00
Louis Schmieder 26db3b0995
orm: redesign orm (re-write it in V) (#10353) 2021-07-23 12:33:55 +03:00
Daniel Däschle 091ce6cc08
cgen: fix several sort declarations (#10919) 2021-07-23 08:55:55 +03:00
Delyan Angelov 06de9c799c
Revert "gen: add type name to comp for (#10881)"
Reason: 713a079 is more general and provides the same information.

This reverts commit dd3ee20566.
2021-07-21 23:56:00 +03:00
Louis Schmieder dd3ee20566
gen: add type name to comp for (#10881) 2021-07-21 23:45:08 +03:00
Uwe Krüger 41982053f1
builtin: make `array.delete()` reallocate, provide `.delete_many()` (#10889) 2021-07-21 20:55:32 +03:00
Daniel Däschle aebb028349
gen: fix C keyword escape to _v_ instead of just v_ (#10876) 2021-07-21 11:46:04 +03:00
Delyan Angelov 5098334e65
os: add execute_or_exit(cmd), use it consistently instead of execute_or_panic(cmd) 2021-07-20 15:22:04 +03:00
Daniel Däschle ad3835b598
parser: deprecate short struct init (#10842) 2021-07-20 11:17:08 +03:00
Delyan Angelov 48546d0f45
all: do compile time const evaluation for `const x = "abc" + "xyz"` and `const x = 16 * 1024 + 5` (fix const prealloc_block_size) 2021-07-18 22:59:18 +03:00
Delyan Angelov 3ccde5ce55
builtin: use `prealloc_block_size = 16777216` temporarily 2021-07-18 17:03:25 +03:00
playX d5e0fa6d1b
v.gen.js: port string methods and fix booleans (#10824) 2021-07-18 09:00:20 +03:00
Delyan Angelov ee9e91b8e7
builtin: fix `-d no_backtrace` error with tcc 2021-07-17 18:09:16 +03:00
Delyan Angelov b0167297e5
builtin: support `-d no_backtrace` on macos/bsd too 2021-07-17 17:49:28 +03:00
playX 06edbc8a38
v.gen.js: implement most of array and map methods in builtin/js (#10806) 2021-07-15 17:36:53 +03:00
shadowninja55 806d6172cb
checker: prohibit casting `void` (#10690) 2021-07-07 21:59:58 +03:00
Uwe Krüger a1f123bd42
cgen: enable string index error handling `s[i] or {...}` (#10670) 2021-07-05 21:00:30 +03:00
Delyan Angelov 972542d6ee
checker: `[noreturn]` part 2 (cleanup) (#10667) 2021-07-05 05:05:37 +03:00
Delyan Angelov 6aecda3be8
all: support `[noreturn] fn abc() { for{} }`, mark panic/1 and exit/1with it too. (#10654) 2021-07-04 20:24:19 +03:00
Alexander Medvednikov 6a64259527 string: bring back the is_lit comment 2021-07-03 20:16:49 +03:00
Daniel Däschle 0f9537ece5
all: remove ustring (#10630) 2021-07-03 20:14:09 +03:00
Flinner 1486258591
strconv: fix `atoi` returning 0 on large strings (#10635) 2021-07-02 10:39:57 +03:00
Alexander Medvednikov 41e88423aa Revert "builtin: use == 0 instead of isnil()"
This reverts commit 8650ec6916.
2021-07-01 06:21:03 +03:00
Daniel Däschle 3881e97a40
vlib: remove ustring usage (#10618) 2021-06-30 22:30:28 +03:00
Daniel Däschle 6838030ab5
builtin: add string.runes() (#10611) 2021-06-30 09:17:38 +03:00
Delyan Angelov ab5a4cf4e5
builtin: cleanup .before() documentation 2021-06-29 14:50:55 +03:00
Delyan Angelov 1b5d0ba8fd
builtin: document existing behaviour of .before() methods on strings 2021-06-29 14:40:37 +03:00
Delyan Angelov 63638fd271
cgen: optimize generated array.index(elem) 2021-06-28 17:45:13 +03:00
Delyan Angelov 8650ec6916
builtin: use == 0 instead of isnil()
Do not rely on C inlining that may not happen for a *very* frequently
called fn in lower level code.
2021-06-28 10:59:14 +03:00
Thomas Treffner 9651a9796b
builtin: fix termux prints (#10595) 2021-06-28 08:27:12 +03:00
Delyan Angelov b2391424d9
examples: add examples/gg/random.v demonstrating how to stream images/pixels 2021-06-24 17:45:14 +03:00
Delyan Angelov f580597ffc
ci: fix -cstrict compilation on tests-sanitize-undefined-clang 2021-06-23 20:17:58 +03:00
Delyan Angelov 66bf963a48
builtin: remove C.printf call from string.free() 2021-06-23 16:31:46 +03:00
Delyan Angelov 9151f085f5
ci: fix failing Freestanding task 2021-06-23 13:18:17 +03:00
Delyan Angelov dd254a6652
builtin: streamline print/eprint/println/eprintln, do not println in 2 steps when possible 2021-06-23 12:22:05 +03:00
Delyan Angelov 79df7f51c3
v: deprecate `[if ident]` in favour of `[if ident ?]` 2021-06-22 10:30:14 +03:00
Ekopalypse 81fe702b77
builtin: disable the unhandled exception handler, when `-d no_backtrace` is used (#10530) 2021-06-21 08:01:18 +03:00
yuyi afc81277be
v.gen.c: fix assigning a fixed array variable to a map value (#10523) 2021-06-20 08:09:24 +03:00
Ekopalypse c53a344d2f
builtin: allow a static gc build on windows (#10510) 2021-06-19 17:06:25 +03:00
Delyan Angelov aea23e8a40
strconv: fix fxx_to_str_l_parse/fxx_to_str_l_parse_no_dot returning s without cloning 2021-06-19 07:48:46 +03:00
Bastian Buck acf9d168cb
os: fix some C compiler warnings for windows (#10506) 2021-06-18 20:07:25 +03:00
Alexander Medvednikov eacdd0d7e1 comptime: fix $(field.name) in $for; vweb: shared fields 2021-06-16 20:33:39 +03:00
Uwe Krüger 60c880a0cc
vlib: use `malloc_noscan()` where possible (#10465) 2021-06-15 14:47:11 +03:00
Delyan Angelov be3702dcb7
builtin: uncomment already working test functions in array_test.v 2021-06-14 10:13:59 +03:00
Uwe Krüger 5ee1ded3fb
gc: extend optimized mode to maps (#10426) 2021-06-13 06:26:43 +03:00
Uwe Krüger 652e7ba973
gc: extend optimized mode to strings (#10431) 2021-06-12 11:27:08 +03:00
Alexander Medvednikov e02d1d4a4b Revert "gc: extend optimized mode to strings (#10409)"
This reverts commit 3f654a69e3.
2021-06-12 01:52:06 +03:00
Uwe Krüger 3f654a69e3
gc: extend optimized mode to strings (#10409) 2021-06-12 00:03:05 +03:00
Uwe Krüger daeeaef030
vfmt: hot fix to allow separate `array_d_gcboehm_opt.v` (#10413) 2021-06-11 12:00:18 +03:00
Uwe Krüger 0e2c86310a
GC-boehm: extend optimized mode to all `array` methods (#10406) 2021-06-10 21:26:17 +03:00
pancake 5be982d63e
builtin: fix memory leak on empty strings (#10408) 2021-06-10 15:21:57 +03:00
Andreas Heissenberger 96c8d147b2
v.gen.js: add source map creation support (inline only, no src) (#10384) 2021-06-10 08:33:46 +03:00
Uwe Krüger 811a3e1d38
builtin: optimize `array.repeat()` (#10396) 2021-06-09 12:52:30 +03:00
Uwe Krüger a2243054a5
builtin: fix memory corruption in array `.clone()` and `.repeat()` (#10394) 2021-06-08 23:23:28 +03:00
Delyan Angelov 95cf120e2e
ci: fix linux-cross job; os.real_path cleanup 2021-06-08 18:34:15 +03:00
Delyan Angelov 40ac7d4892
builtin: support -d trace_vcalloc, -d trace_realloc 2021-06-08 17:24:07 +03:00
Delyan Angelov 665c386771
builtin: simplify the .si_c and .si_vp cases in StrIntpData.get_fmt_format, free intermediate results 2021-06-08 13:29:03 +03:00
Uwe Krüger 89aab95177
builtin: fix -gc boehm on windows (#10330) 2021-06-04 17:38:51 +03:00
Uwe Krüger ce3e71cb8e
OpenBSD: support Boehm-GC, X11 and Sqlite (#10300) 2021-06-01 22:28:30 +03:00
Delyan Angelov 8fee140fc0
builtin: small cleanup in string_interpolation.v 2021-06-01 16:21:43 +03:00
penguindark 1343787009
builtin: fix interpolation bug for `${x:g/G}`, where `x` is a zero or an infinity (#10271) 2021-05-30 19:30:18 +03:00
Thomas Treffner ba86d619fa
builtin: fix print/println on termux (#10253) 2021-05-30 08:10:32 +03:00
Uwe Krüger 15557161cc
builtin: add trailing `0` to reversed string (#10248) 2021-05-29 16:45:26 +03:00
penguindark 7089ff3957
builtin: fix a bug in str_intp (#10238) 2021-05-28 18:44:30 +03:00
Uwe Krüger 8828054e5b
builtin: fix arrays/slices memory bug (#10219) 2021-05-27 15:50:06 +03:00
penguindark 2dd1d3fcbb
all: string interpolation code cleaning (#10204) 2021-05-26 09:30:08 +03:00
Joe Conigliaro 560301dbfe
cgen: dont preallocate zero length with capacity of 1 2021-05-26 14:51:20 +10:00
Enzo 39c376bb5b
builtin,gen: use operator overloading on ustring (#10197) 2021-05-25 14:51:48 +03:00
Enzo ce7f78522d
builtin: remove former string operator methods (#10184) 2021-05-24 14:05:29 +03:00
Enzo 886f69bfcf
all: use operator overloading on strings (p. 2) (#10183) 2021-05-24 11:38:31 +03:00
penguindark d8d05e0106
all: new string interpolation in pure V (#10181) 2021-05-24 05:20:45 +03:00
Delyan Angelov 7f12bfa563
builtin: optimise `sx == sy` in the case where strings have common prefixes 2021-05-23 17:22:57 +03:00
Delyan Angelov 5efd8c62d0
ci: fix tests-sanitize-undefined-clang 2021-05-23 15:13:53 +03:00
Delyan Angelov a27e7f7675
builtin: remove commented code; improve print_backtrace with tcc 2021-05-23 12:37:40 +03:00
yuyi ae9f8627fc
checker: simplify generic structs (#10167) 2021-05-23 05:54:58 +03:00
Alexander Medvednikov 7c0f8f7644 builtin: a small optimization in string.replace() 2021-05-22 14:35:36 +03:00
Delyan Angelov 2086e6f1c1
builtin, cgen: implement chunked allocation of 16MB blocks with -prealloc (#10130) 2021-05-19 10:35:56 +03:00
Delyan Angelov 94e7a55b97
builtin: implement -d trace_error
With debugger backtraces, it can help pinpoint the original source of a
bubbled error, until we can store stacktraces in the errors in an
efficient way.
2021-05-18 20:03:00 +03:00
Alexander Medvednikov ed6ad728d9 vweb: fix serving static files 2021-05-16 04:28:14 +03:00
JalonSolov 274c817028
builtin.string: optimize split_into_lines (#10081) 2021-05-11 18:57:32 +03:00
Delyan Angelov e6011e83ce
builtin: cleanup string.v 2021-05-11 13:59:44 +03:00
Delyan Angelov 159ee00563
builtin: remove `import hash` 2021-05-10 09:22:50 +03:00
Enzo 2d2b4f79cc
strings: add Builder.cut_to (#10042) 2021-05-07 19:41:27 +03:00
Uwe Krüger d26ac5692e
all: various fixes for [heap]/auto-heap handling (#10033) 2021-05-07 15:58:48 +03:00
Delyan Angelov 2eafea6308
v: reduce the memory usage of the compiler (analysed with heaptrack) 2021-05-06 11:44:48 +03:00
Delyan Angelov 84f9789e72
v: tag more low level functions with `[direct_array_access]` 2021-05-06 00:35:16 +03:00
Enzo 4ac751d773
os: add `signal_opt` and deprecate `signal` (#10005) 2021-05-05 15:39:02 +03:00
Miccah 12c3f85507
os: add getuid and geteuid (#10002) 2021-05-05 14:20:11 +03:00