1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Commit Graph

1509 Commits

Author SHA1 Message Date
Alexander Medvednikov
014c3c97f0 all: byte => u8 2022-04-15 14:45:52 +03:00
Alexander Medvednikov
7f3b91e688 builtin: more byte => u8 2022-04-15 14:10:11 +03:00
Alexander Medvednikov
ba7b329c73 builtin: more byte=>u8 2022-04-15 13:55:56 +03:00
Alexander Medvednikov
e6ff1508d2 all: make u8 the primary type, byte the alias 2022-04-15 13:43:03 +03:00
Delyan Angelov
e555335bf0
ci: fix windows-msvc builds, as well as the windows-cross job, turn on deprecation notices for [windows_stdcall] and [_fastcall] 2022-04-14 13:36:51 +03:00
Nick Treleaven
c780de6282
checker: disallow 'small_unsigned == signed' (#13967) 2022-04-12 19:37:30 +03:00
Delyan Angelov
382586da6d
ci: fix toml segfault (remove unused low level builtin option IError.msg compatibility hack) 2022-04-11 21:49:59 +03:00
Nick Treleaven
2cd9c91e98
vdoc: highlight terminal examples for -comments -color (#13937) 2022-04-04 18:13:24 +03:00
Nick Treleaven
d10135e2c4
vdoc: HTML highlight generic function as function, not name (#13923) 2022-04-03 23:41:02 +03:00
Nick Treleaven
782d5374c9
builtin: add an array.drop(n) method (#13907) 2022-04-03 17:05:50 +03:00
yuyi
8c55a9ecd3
builtin: minor optimization of array.push() and array.push_noscan() (#13904) 2022-04-03 11:04:18 +03:00
Nick Treleaven
42f92db0ab
v.doc: parse multi-line examples (so they get highlighted) (#13894) 2022-04-02 18:29:12 +03:00
Nick Treleaven
a87cd9663e
vdoc: highlight inline examples for -f html (#13879) 2022-03-31 19:32:32 +03:00
Nick Treleaven
02f72c8230
builtin: improve docs for array methods that take an it expression, like .map, .filter etc (#13836)
Move explanation about boolean `it` expressions to `filter`, as `sort`
doesn't take a boolean expression. Also move `any` example.
Add 2 filter examples.
Add map example from docs.md.
2022-03-27 14:28:15 +03:00
Nick Treleaven
ea4410cdb5
builtin: document the rune.length_in_bytes method (#13826) 2022-03-25 20:09:39 +02:00
Delyan Angelov
5b492e26dd
builtin: support a.flags.set(.noslices | .noshrink), use it in the particles example (#13818) 2022-03-24 23:37:13 +02:00
Nick Treleaven
afbccf79f7
builtin: don't memdup element for array.pop (depends on how cgen works) (#13789)
The voidptr returned is immediately dereferenced in cgen so the memory
is copied before the array can be appended to: `*(int*)array_pop(&a)`
2022-03-21 23:34:35 +02:00
Delyan Angelov
71edaa071a
builtin: use malloc, instead of calloc in array.ensure_cap/1 2022-03-20 15:08:42 +02:00
Delyan Angelov
8ab0bcb6aa
Revert "builtin: improve performance for common array ops, based on VTune analysis"
This reverts commit 57db261538.
2022-03-20 12:57:27 +02:00
Delyan Angelov
57db261538
builtin: improve performance for common array ops, based on VTune analysis 2022-03-20 12:42:04 +02:00
yuyi
49155ec312
parser: notice unnecessary parenthesis of reference (fix #11179) (#13739) 2022-03-15 16:11:53 +02:00
playX
78b1cbefff
builtin.wasm_bare: fix malloc invocation (#13740) 2022-03-15 12:55:39 +02:00
playX
c8b0f51c13
builtin.wasm_bare: use walloc as malloc/free implementation (#13731) 2022-03-14 09:20:20 +02:00
Delyan Angelov
8dc4b1d9a3
builtin: use malloc_noscan more (for map metas and in []byte.hex()) 2022-03-11 11:26:22 +02:00
Nick Treleaven
7231a3f135
vlib: add mut for the first parameter of builtin.copy, arrays.copy and crypto (#13702) 2022-03-09 20:26:00 +02:00
Nick Treleaven
54de04a916
arrays: improve fold/reduce docs (#13700) 2022-03-09 20:04:49 +02:00
Nick Treleaven
17fcc788f2
arrays: add generic copy fn (#13677) 2022-03-08 09:44:04 +02:00
Alexander Medvednikov
36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
Delyan Angelov
89b99ad4c3
scanner: remove the restriction for \x00 in strings (#13493) 2022-02-16 23:41:05 +02:00
Delyan Angelov
9c24d09dc3
strconv: bug fix for "${239.5:0.0f}" (#13483) 2022-02-16 11:33:29 +03:00
Tim Basel
37c151efe5
docs, builtin, encoding.csv: update error implementations (#13440) 2022-02-12 11:54:10 +02:00
Tim Basel
9d0a5942ac
builtin: change IError msg and code to methods + fix vlib, add a deprecation notice for the old usages (#13041) 2022-02-11 15:52:33 +02:00
Vincenzo Palazzo
7f29418c63
strconv: change atof64 to return an error, if the parsed value is not a valid number (#13424) 2022-02-10 13:27:32 +02:00
Delyan Angelov
1dc239227d
docs, builtin: clean up the homepage of modules.vlang.io a little, do not use //==== comments for now in builtin 2022-02-06 23:51:40 +02:00
Delyan Angelov
9344c27021
builtin: save a call to array.ensure_cap in array.insert, array.push, array.push_many in most cases 2022-02-02 11:01:07 +02:00
Delyan Angelov
96c8188083
builtin: fix warnings for tests inside vlib/builtin/js 2022-01-30 16:36:56 +02:00
Delyan Angelov
44dddecc09
builtin: use a pure V version of string.to_wide() on != windows (#13314) 2022-01-28 20:41:50 +02:00
Benjamin Stigsen
ceb05b163a
strings: rename Builder.write_b() to Builder.write_byte(), add deprecation (#13313) 2022-01-28 20:34:44 +02:00
Delyan Angelov
469282b20d
builtin: cleanup [trusted] tags for C function declarations 2022-01-25 19:31:40 +02:00
Alexander Medvednikov
4715fb67c1 checker: c2v fixes for enums and pointer to numbers 2022-01-25 20:15:45 +03:00
Alexander Medvednikov
216a505c2a builtin: more libc fn definitions 2022-01-24 06:14:31 +03:00
Alexander Medvednikov
38d3239b50 checker: c2v fixes 2022-01-19 15:26:24 +03:00
trueFireblade
727c9fb4a1
all: add string range OrExpr (#13189) 2022-01-17 13:03:10 +03:00
jeffmikels
f19197f9b0
builtin: make array.insert_many and array.prepend_many private (#13172) 2022-01-14 19:47:17 +02:00
jeffmikels
9329b6c8c8
builtin: add more documentation (#13160) 2022-01-14 17:27:38 +02:00
jeffmikels
70aedaf184
builtin: add a string.parse_int/2 method (wrapping strconv.parse_int/3) (#13164) 2022-01-14 00:31:11 +02:00
jeffmikels
4189b7e280
builtin: add a byterune method on []byte (#13145) 2022-01-13 22:26:17 +02:00
Delyan Angelov
ecc7accc8e
tests: test with valgrind rune.bytes(), fix leak in .str_escaped() 2022-01-11 15:23:40 +02:00
Delyan Angelov
8acd84d04a
builtin: reduce allocations in rune.bytes() 2022-01-11 15:23:39 +02:00
Ekopalypse
cb684b5c64
builtin: allow msvc users to link against a custom compiled Boehm library (#13133) 2022-01-11 15:23:21 +02:00
jeffmikels
078229f213
builtin: add a rune.bytes() convenience method (#13129) 2022-01-11 09:55:51 +02:00
jeffmikels
5e5d62ed4c
arrays,docs: remove arrays.zip; improve docs (#13082) 2022-01-09 16:12:33 +02:00
jeffmikels
6e6d51a1c9
docs: add more documentation to each of the modules in vlib (#13043) 2022-01-07 13:28:50 +02:00
playX
287331bc19
builtin: add builtin/wasm_bare (#13078) 2022-01-07 13:16:06 +02:00
playX
ec91de3504
builtin: use dlmalloc for -freestanding (#13054) 2022-01-06 14:10:37 +02:00
jeffmikels
a60b381d5e
docs: adding skeleton README.md files for all vlib modules (#13034) 2022-01-05 18:06:08 +02:00
Delyan Angelov
d3489d4246
builtin: s.trim_prefix/1 -> s.trim_string_left/1, s.trim_suffix/1 -> s.trim_string_right/1 2022-01-05 12:49:22 +02:00
Delyan Angelov
0f01236e52
strconv: fix assert .f64() == 0 2022-01-04 17:51:48 +02:00
Alexander Medvednikov
59ed4be49a all: update copyright year 2022-01-04 12:21:12 +03:00
pancake
7b4ba66720
js: use JS.String instead of string in builtin javascript functions (#13004) 2022-01-01 09:17:08 +02:00
yuyi
a0a1807e2b
builtin: add charptr str() and change string format (#12973) 2021-12-30 23:34:24 +03:00
yuyi
3b5de71e60
builtin: add none str() (fix #12964) (#12967) 2021-12-26 11:41:51 +02:00
penguindark
278c08704c
all: support slices with negative indexes #[start..end] (gated arrays) (#12914) 2021-12-22 16:34:02 +03:00
playX
ade14491d4
gg: add event handling for mouse down/up and mouse leave/out on VJS (#12917) 2021-12-21 12:31:29 +02:00
Delyan Angelov
f81654e3a7
builtin: add s.match_glob(wildcard_pattern) 2021-12-20 14:17:08 +02:00
yuyi
7c255f0ff2
builtin, cgen: fix array of map init with default value (#12885) 2021-12-18 10:07:25 +02:00
Delyan Angelov
6ff953d936
preludes,builder,cgen: add support for VTEST_RUNNER=tap and -test-runner tap (#12523) 2021-12-16 15:59:46 +02:00
playX
11d2b8b354
js: support -es5 flag (#12846) 2021-12-15 15:47:34 +02:00
Delyan Angelov
df7f2aa8a3
all: support [markused] tags for fns/consts/globals 2021-12-15 14:34:49 +02:00
spaceface
d13fe7843c
v: fix build and failing tests on arm64 (#12840) 2021-12-15 09:00:38 +02:00
yuyi
7c7cdf8ce7
builtin: clean up array.v (#12784) 2021-12-11 11:17:00 +03:00
playX
b116170735
js: add support for Promise.wait() (#12781)
* builtin/js: Change Promise<T,E> to Promise<T>

* js: codegen support for Promise.wait()

* checker: checker support for Promise.wait()
2021-12-10 14:54:20 +02:00
playX
1cb06a2de4
js: ast.GoExpr support using promises on JS backend (#12749) 2021-12-07 12:11:54 +03:00
penguindark
81a1490e31
builtin: add string.split_any/1 (#12720) 2021-12-04 20:13:40 +02:00
Delyan Angelov
d59aa14b26
builtin: fix {-7:08b} (interpolation of negative numbers with 0 padding), add tests 2021-12-04 13:11:05 +02:00
Delyan Angelov
33163238e7
strconv: add a small performance optimisation 2021-12-03 20:14:14 +02:00
playX
0da7e2f8ab
js: make vlib/v/util compile on JS backend (#12660) 2021-12-03 12:25:36 +02:00
Delyan Angelov
c4363bc78b
builtin: explain and better organise the different cstring_to_vstring/tos/tos_clone/vstring family of conversion functions 2021-12-02 15:46:53 +02:00
Delyan Angelov
d7bc2a88f7
builtin: add a non allocating rune.length_in_bytes() method and tests for it 2021-12-01 16:35:13 +02:00
Delyan Angelov
6d97b0a407
checker: improve checking of a << b, when a and b are numbers (#12589) 2021-11-29 03:48:49 +03:00
Delyan Angelov
31fe02de8c
builtin,crypto: fix problems detected by -fsanitize=address,undefined and -fsanitize=memory 2021-11-28 20:35:18 +02:00
Delyan Angelov
b4c52b72cf
builtin: change the -d debug_malloc byte pattern to M so it is easier to spot with a plain text terminal. 2021-11-28 19:23:11 +02:00
playX
b0bc112168
jsdom, examples: add more WebGL APIs; add interactive 3D cube example running on VJS (#12562) 2021-11-24 20:31:39 +02:00
pancake
70ff00efbb
bootstrapping: fix building V on OpenBSD (#12558) 2021-11-24 09:46:46 +02:00
playX
12ffe04212
jsdom, builtin/js: WebGL W.I.P; Added support for casting V arrays to typed arrays (#12551)
* builtin/js: TypedArray support

* jsdom: WebGL W.I.P
2021-11-23 14:51:59 +02:00
Delyan Angelov
1aaac13a60
cgen: make os less special, fix an -autofree leak on just import os
* Improve documentation of v.util.Surrounder

* Remove `os` from the list of "no auto free" `builtin` mods

* Fix -autofree freeing of `const x = []string{}`.

* Add a valgrind regression test.

* Implement os.getenv_opt in vlib/os/environment.js.v too.
2021-11-21 21:50:10 +02:00
playX
243e66a106
js,jsdom: Canvas & context API; Added TypeSymbol.is_js_compatible & temporary hacks for JS ifaces (#12526) 2021-11-20 21:28:11 +02:00
playX
2eb02ff5a7
jsdom, js: start refactoring jsdom; improve JS interfaces; add two attributes for them (#12488) 2021-11-17 11:41:33 +02:00
Delyan Angelov
6ac109a7c3
builtin: add a [has_globals] tag for all the .v files, with global declarations in them 2021-11-17 10:29:06 +02:00
yuyi
c28041cecc
all: cleanup/rename all comp_ names to be comptime_ (#12467) 2021-11-15 15:47:29 +02:00
playX
e3d98b1b28
js,strconv: port some functions to JS backend, improve rune.str() (#12460) 2021-11-14 21:06:58 +02:00
playX
a4c57ba56e
js: support JS interfaces (#12426) 2021-11-11 14:36:32 +02:00
Delyan Angelov
80242c8041
builtin,ast: apply small performance improvements, suggested by hotspot 2021-11-07 13:30:44 +02:00
playX
5f3dcde358
jsdom,builtin: add all methods for DOMMatrix; add conversion methods to convet from/to JS types (#12395) 2021-11-06 15:52:24 +02:00
Alexander Medvednikov
7ea57bfa1e builtin: make map.keys() public 2021-11-04 19:09:37 +03:00
Delyan Angelov
6937074e7a
strings,builder: reduce V cgen and parser memory consumption, fix strings.Builder leak (#12342) 2021-10-31 12:58:55 +02:00
Delyan Angelov
579d5ae649
builtin,checker: add array.flags. Allow changing it in unsafe {} blocks 2021-10-31 11:04:56 +02:00
Delyan Angelov
b86c79329b
os, builtin: reduce leaks without -autofree 2021-10-29 15:49:30 +03:00
Delyan Angelov
475a2f9b43
ci: fix failing vlib/orm/orm_test.v 2021-10-28 17:33:18 +03:00
Delyan Angelov
4d0f6767b1
builtin: use malloc instead of calloc for []Type{cap: size} 2021-10-28 17:18:03 +03:00
Delyan Angelov
8014235e0e
scanner: speed up text_scan by using a specialised keywords matcher, instead of a generic V map of keywords 2021-10-28 15:41:13 +03:00
playX
cfecb62299
js: DOM API. Part 1 (#12296) 2021-10-27 23:18:09 +03:00
Wertzui123
ea6d2d53db
parser: disallow for mut in range (fix #12234) (#12277) 2021-10-27 14:55:36 +03:00
Bakul Shah
cc2847f6ff
builtin: fix compilation with -gc boehm on some FreeBSD versions (#12289) 2021-10-25 10:24:08 +03:00
Delyan Angelov
eed94c727c
os: move C struct declarations in their own _default.c.v files (#12268) 2021-10-22 17:08:08 +03:00
playX
57c79770b3
js: port more methods (os, builtin) (#12238) 2021-10-20 16:02:21 +03:00
playX
c1aa782a6c
js,checker: fix some modules build for v -b js self, fix or block check in ast.CallExpr (#12231) 2021-10-19 12:11:54 +03:00
playX
d373eba79b
js: implement more functions for JS backend (#12167) 2021-10-13 09:40:14 +03:00
playX
22962dd2d2
js: change codegen for match statement, speedup string.split_into_lines (#12157) 2021-10-12 09:52:16 +03:00
playX
a8ace2c41c
math: implement pow in pure V (#12105) 2021-10-08 17:44:55 +03:00
playX
33a1006cc5
js: comptime&assert improvements, more byte and strings.Builder methods ported (#12096) 2021-10-07 15:55:47 +03:00
playX
b2945e916f
js: add initial support for runes (#12077) 2021-10-06 10:43:49 +03:00
playX
8d1ba52d0c
js: fix string.bytes codegen, readline, add tests for strings (#12060) 2021-10-04 18:28:30 +03:00
Larpon
a8c2c419cd
builtin: improve malloc panic messages (#12054) 2021-10-03 20:27:46 +03:00
playX
9145cd66ec
js: add more tests to builtin/js and implement more builtin functions (#12049) 2021-10-03 10:08:21 +03:00
playX
82f187e5e0
js: fix rand build, properly use key values on map, add rand.string (#12020) 2021-10-01 21:23:49 +03:00
Wertzui123
e3d379a1eb
builtin: add byte.repeat() and rune.repeat() (#12007) 2021-09-30 09:32:20 +03:00
playX
4333a53f28
js: support running .js.v tests in v test-self, fixes for array methods & codegen (#12011) 2021-09-29 15:33:14 +03:00
yuyi
8789cc422c
v.ast: fix fmt of 'bytestr' to '&byte' (#12014) 2021-09-29 13:53:46 +03:00
crthpl
85b58b03a3
cgen: parallelize (#10844) 2021-09-28 10:28:04 +03:00
Ken
a17b943e87
builtin: add method byte() for string (#11998) 2021-09-28 10:08:10 +03:00
Wertzui123
07d65b2aab
builtin: move byte methods from rune.v to int.v (#11987) 2021-09-26 22:34:25 +03:00
playX
863dd0b23e
js: array improvements (#11952) 2021-09-26 07:33:53 +03:00
yuyi
108a01d65f
fmt: fix unnecessary line break in array init (fix #11448) (#11562) 2021-09-21 16:20:09 +03:00
Enzo
b2ecca3966
all: remove size_t (#11478) 2021-09-21 02:12:38 +03:00
Ruofan XU
b343f19bec
v.scanner: fix ambiguity of two-level generics and shift-right (#11540) 2021-09-19 16:22:28 +03:00
Delyan Angelov
bd65ceb463
v.markused: remove __print_assert_failure from all_fn_root_names 2021-09-17 21:47:22 +03:00
playX
7d1776b84d
js: equality method generation for V types (#11503) 2021-09-16 07:07:48 +03:00
Alexander Medvednikov
ae41d1d3c6 builtin, cgen: more -nofloat fixes 2021-09-13 19:06:19 +03:00
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