Commit graph

1598 commits

Author SHA1 Message Date
yuyi
ec30256c7f
builtin: cleanup obsolete function in string.v and array.v (#19451) 2023-09-27 19:49:33 +03:00
yuyi
981f76cd04
builtin, cgen: fix printing slice of fn call string (#19450) 2023-09-27 14:53:56 +03:00
Delyan Angelov
e115d4461c
checker: allow for each(a, |x| println(x)), i.e. using lambda expressions, when expecting fn (x int) 2023-09-27 11:49:12 +03:00
Ikko Eltociear Ashimine
7e08a50ea5
builtin: fix typo in string.v (#19431) 2023-09-24 15:11:47 +03:00
Delyan Angelov
a685088fbd
checker: support lambda expressions in array methods like a.map(|x|x*10) too (#19424) 2023-09-23 22:08:48 +03:00
Delyan Angelov
f93d257d29
all: support short lambda expressions like a.sorted(|x,y| x > y), in all callsites that accept a fn callback (#19390) 2023-09-20 17:22:16 +03:00
Delyan Angelov
7ffa8c13bf
vlib: remove functions and fields, deprecated before 2023-03-20
* remove []int.reduce in favour of arrays.fold
  * remove datatypes.Set.equal in favour of datatypes.Set.==
  * remove datatypes.Set.difference in favour of datatypes.Set.-
  * remove gg.Context.set_cfg in favour of gg.Context.set_text_cfg
  * remove gg.Context.timage_pip in favour of gg.Context.pipeline.alpha
  * remove os.is_writable_folder in favour of os.ensure_folder_is_writable

  Discovered with `v run cmd/tools/show_ancient_deprecations.v 180`
2023-09-16 17:16:54 +03:00
shuankio
a0490f2b67
net.http: fix post error with https on windows (#19334) 2023-09-12 15:43:13 +03:00
yuyi
55ca8d8d8e
fmt: align the custom values of the enum fields (#19331) 2023-09-12 14:44:38 +03:00
Kim Shrier
621cb6dde0
builtin: use libgc-threaded on FreeBSD, to get the threaded version of libgc (#19294) 2023-09-07 12:26:46 +03:00
Delyan Angelov
fca8092523
builtin: fix the wording of panic messages, about sorting not working with -freestanding
Thanks @MPetr for spotting it.
2023-09-01 10:04:29 +03:00
Delyan Angelov
58b6ba81d1
builtin: implement array.sorted() and array.sorted_with_compare() methods, that do not modify their receivers (#19251) 2023-09-01 09:12:00 +03:00
Delyan Angelov
803001edaa
builtin: add support for -d bultin_writeln_should_write_at_once and -d bultin_write_buf_to_fd_should_use_c_write (#19243) 2023-08-30 23:44:33 +03:00
Delyan Angelov
d503435dd4
builtin: always show the assert message, if it was defined in the source, in non test programs too (fix #19240) 2023-08-30 21:05:23 +03:00
Turiiya
f755118e7c
vlib: update doc comments (#19231) 2023-08-30 08:50:00 +03:00
yuyi
815439a381
checker: fix assigning an array slice (fix #19120) (#19137) 2023-08-15 20:37:51 +03:00
shove
11a8a46ade
tests: cleanup test cases (#19104) 2023-08-13 13:36:08 +03:00
Delyan Angelov
eef9b5f168
builtin,os: fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095) 2023-08-09 15:04:44 +03:00
katekyy
b622dca915
builtin: fix split_nth() and rsplit_nth() on an empty delimeter (#19005) 2023-07-30 00:12:51 +03:00
Alexander Medvednikov
b29a084257 builtin: move array.data to the top of the struct 2023-07-23 18:53:19 +03:00
Delyan Angelov
466c80f80a
vlib: remove methods deprecated before 2022-07-22 (#18944) 2023-07-22 18:11:12 +03:00
Kim Shrier
64a8c14a3c
builtin: fix the comments about flushing on print/1 and println/1 (#18927) 2023-07-21 18:44:13 +03:00
l-m
c422919481
wasm: remove dependency on thirdparty/binaryen, webassembly backend rewrite (#18120) 2023-07-12 15:24:38 +03:00
Delyan Angelov
ded6c38061
vlib: add a new module builtin.wchar, to ease dealing with C APIs that accept wchar_t* (#18794) 2023-07-07 02:40:11 +03:00
Delyan Angelov
884fbb0a98
builtin: implement string_from_wide/1 and string_from_wide2/2 on *nix too (#18776) 2023-07-04 15:49:15 +03:00
Delyan Angelov
9bf2449a7b
cgen: fix memleak for [][]T{len: x}, or []Struct{len: x} (#18763) 2023-07-04 06:32:19 +03:00
Delyan Angelov
4c9c515f8b
parser: remove hardcoded check for function calls for C.stat, C.sigaction, etc (#18535) 2023-06-24 08:03:12 +03:00
yuyi
d7a50b4a22
builtin: minor cleanup in sorted_map.v (#18502) 2023-06-21 12:34:05 +03:00
Ethan Hansen
5001b17336
docs: add docstring for map.move() (#18430) 2023-06-16 09:45:16 +03:00
Delyan Angelov
6806086bf1
builtin: zero out internal map/array pointers on m.free(), to reduce the work for the GC mark phase for non escaping maps/arrays, used in hot loops (#18415) 2023-06-14 15:00:36 +03:00
sandbankdisperser
e97aff8742
time: add more detailed error descriptions, add custom format parsing with time.parse_format (#18257) 2023-06-06 18:43:10 +03:00
Delyan Angelov
d47c722c1f
builtin: fix byte deprecation warnings for v test-all (the -freestanding compilation) 2023-05-29 13:20:29 +03:00
Alexander Medvednikov
f22ba836fd prealloc: use u8 instead of byte 2023-05-29 01:42:52 +02:00
Ikko Eltociear Ashimine
abcbba1e81
builtin: fix typo in string.js.v (#18213) 2023-05-21 02:46:11 +03:00
Petr Makhnev
9d0a1d8496
builtin: speed up string methods with vmemcpy instead of for loop for copying data (#18211) 2023-05-19 21:24:23 +03:00
Petr Makhnev
a39c26507c
builtin: speed up string concatenation and repeat() method with vmemcpy instead of for loop for copying data (#18206)
These changes almost do not speed up the program with the `-prod` flag,
since modern С compilers can do such optimization on their own, but in
normal mode, the performance gain is from 1.6 (concatenation) to 1.8 (repeat) times.

Concatenation:
Old (`for` loop):
Time (mean):          3.699 s +- 0.071 s  [User: 3.629 s, System: 0.069 s]
Range (min ... max):  3.548 s ... 3.741 s  10 runs

New (vmemcpy):
Time (mean):          2.305 s +- 0.065 s  [User: 2.263 s, System: 0.041 s]
Range (min ... max):  2.172 s ... 2.355 s  10 runs

`vmemcpy version` ran 1.60 +- 0.05 times faster than 'for loop version'
2023-05-19 16:18:23 +03:00
Felipe Pena
47761a42e9
all: attr for enum fields (+ json encode/decode) (#18163) 2023-05-13 01:08:30 +02:00
Felipe Pena
5008515b03
builtin: heap memory usage api (#18103) 2023-05-03 20:33:52 +03:00
Swastik Baranwal
d3de7adcc0
builtin: add C.scanf fn decl to cfns.c.v (#17965) 2023-04-16 08:00:19 +03:00
Alexander Medvednikov
9f5e2aeea9 backtrace: use unsafe { nil } 2023-04-14 08:28:22 +02:00
Swastik Baranwal
3d99f1f2c2
checker: disallow struct int to ptr outside unsafe (#17923) 2023-04-13 07:38:21 +02:00
lapingenieur
f9c186a400
builtin: correct a small documentation mistake (#17935) 2023-04-11 12:37:14 +02:00
Delyan Angelov
abe0ad886b
ci: workaround flakyness of array_test.v on windows, with the default GC mode 2023-04-09 09:48:15 +03:00
Delyan Angelov
ebfc4b4663
builtin: remove test for the deprecated []int.reduce/2 2023-04-08 18:47:04 +03:00
yuyi
467a1b4435
fmt: remove redundant parenthesis in the complex infix expr (#17873) 2023-04-04 13:47:48 +03:00
Alexander Medvednikov
6756d28595 all: 2023 copyright 2023-03-28 22:55:57 +02:00
Delyan Angelov
3793bf1c99
builtin: optimise the common case of s.contains("x") add s.contains_byte(x) (#17702) 2023-03-19 01:10:13 +03:00
Felipe Pena
3197ec1a41
v: add compile-time enum evaluation with $for item in MyEnum.fields { dump(item.value) dump(item.name) } (#17517) 2023-03-12 12:46:54 +02:00
ChAoS_UnItY
f02b423f80
builtin: string test refactor, string functions inlining (#17598) 2023-03-11 20:44:45 +02:00
ChAoS_UnItY
9fa49da9d5
builtin: add rsplit functions (#17577) 2023-03-11 00:07:02 +01:00