Commit Graph

7479 Commits (0d25106b4d3e11e942d096b0f8c458ed1a71990e)

Author SHA1 Message Date
yuyi e310513a5f
cgen: fix generics with generics fn type parameter (#10078) 2021-05-11 09:24:23 +03:00
penguindark d60a55d30b
strconv: float functions cleaning and speed optimization (#10076) 2021-05-11 08:09:17 +03:00
yuyi 3b062388ba
checker: minor cleanup in check_files() (#10075) 2021-05-11 03:43:26 +03:00
yuyi dcf4d73c87
cgen: format generated struct definition c codes (#10074) 2021-05-10 20:27:52 +03:00
kevin70g 28a22e5a84
v.builder: try finding msvc from env variables, when not found from registry (#10072) 2021-05-10 10:15:50 +03:00
kevin70g e9c84ce154
os: fix is_abs_path() panic, when path is only one letter on windows (#10071) 2021-05-10 10:01:32 +03:00
Delyan Angelov 159ee00563
builtin: remove `import hash` 2021-05-10 09:22:50 +03:00
Delyan Angelov 4728d102d9
os: add Process.finalise() and Process.free() methods to cleanup pipe descriptors 2021-05-09 21:50:47 +03:00
yuyi 74defc4b82
checker: minor cleanup of FnDecl (#10000) 2021-05-09 15:27:45 +03:00
Delyan Angelov 38d16229ef
os: fix panic on os.is_abs_path('') 2021-05-09 10:45:34 +03:00
Leigh McCulloch 26652c8a23
io: make new_multi_writer use varargs (#10062) 2021-05-09 09:21:08 +03:00
El Koulali András 3e5a5754f3
cgen: fix constants with multi-statement C initializations (#10058) 2021-05-09 03:25:44 +03:00
Delyan Angelov 8547762ab8
v.preludes: avoid warnings for short const names like `b` in tests with -stats 2021-05-08 23:00:38 +03:00
Delyan Angelov 21f207e781
v.checker: use more concise error messages (remove please) 2021-05-08 22:32:18 +03:00
yuyi a9eb8931ed
table: minor cleanup of resolve_generic_to_concrete() (#10046) 2021-05-08 22:27:58 +03:00
spaceface ef7454b5e2
checker: fix calling functions with variadic interface parameters (#10052) 2021-05-08 22:26:13 +03:00
Louis Schmieder 23513ae35c
v.parser: fix vfmt eating the file name in `$tmpl('non_existant_file')` (#10056) 2021-05-08 21:11:13 +03:00
ka-weihe 0d205510d5
hash.wyhash: fix memory errors (#10051) 2021-05-08 21:09:58 +03:00
Delyan Angelov c16d4911c2
v.checker: deprecate `$if linux_or_macos {` in favor of `$if linux || macos {` 2021-05-08 21:00:21 +03:00
Delyan Angelov cbf30bd13a
checker: fix regression for generics_test.v 2021-05-08 18:23:12 +03:00
Delyan Angelov d8d6e9b901
ci: run vfmt over sha256_test.v 2021-05-08 17:38:05 +03:00
Delyan Angelov 3a1cae0c4f
v.markused: assume methods for operator overload are always used 2021-05-08 15:13:16 +03:00
Delyan Angelov 7db6d602de
tools: vfmt math_test.v and remove it from the exceptions in vtest-cleancode.v 2021-05-08 14:46:06 +03:00
Enzo 7d922c877d
thirdparty: remove unused dependecy wyhash (#10038)
\
2021-05-08 14:36:52 +03:00
yuyi ed7c8d5e19
checker: fix generics return recursive generic struct (fix #10028) (#10031) 2021-05-08 14:33:09 +03:00
Cabral b5afa049e9
math: sign function (#10014) 2021-05-08 14:32:18 +03:00
Leigh McCulloch 68c8709343
io: add MultiWriter (#10021) 2021-05-08 14:21:53 +03:00
yuyi 3dfbd2351b
checker,cgen: fix generics with generic_fn type parameter (#10022) 2021-05-08 14:06:56 +03:00
zakuro 82a9add25b
cgen: insert a newline every 8 elements in array init (#10034) 2021-05-08 13:35:21 +03:00
El Koulali András 262ef7598d
checker: fix unchecked optional in match condition (#10041) 2021-05-08 13:33:13 +03:00
Delyan Angelov 8a380f4699
tools: make `v test-cleancode` test everything by default (#10050) 2021-05-08 13:32:29 +03:00
Leigh McCulloch cba2cb6b9c
crypto/sha256: make digest sum public (#10047) 2021-05-08 13:14:37 +03:00
penguindark e9d7ff751f
strconv: new decimal digits counts function (#10029) 2021-05-08 00:24: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 13ea92a77d
ci: use hash.fnv1a.sum64_string instead of hash.sum64_string in Parser.set_path (fix sanitize jobs) 2021-05-07 11:20:13 +03:00
Delyan Angelov ea74e2bc64
v.parser: add p.unique_prefix, add run_project_folders_test.v (closes #10023) 2021-05-06 21:14:19 +03:00
yuyi a6764e3cc3
table: fix generics struct with anon fn fields (#10024) 2021-05-06 20:24:08 +03:00
Delyan Angelov ac2eaa05c7
tests: add interface_many_named_test.v regression test (closes #10013) 2021-05-06 19:54:49 +03:00
Delyan Angelov 3aa85bb5d7
v.ast: ensure interface->types info is complete 2021-05-06 19:48:11 +03:00
Delyan Angelov 483068f071
ci: fix tests-sanitize-undefined-gcc job 2021-05-06 15:15:35 +03:00
Delyan Angelov adffae4453
v.builder: refactor to make adding other post checker stages easier 2021-05-06 14:37:49 +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
Delyan Angelov 3405f517a4
v.scanner: apply `[direct_array_access]` for key frequently called low level functions 2021-05-05 23:45:23 +03:00
Delyan Angelov ab39011fb9
cgen: honor `[direct_array_access]` for `a_string[idx]` too 2021-05-05 23:43:46 +03:00
Enzo 4ac751d773
os: add `signal_opt` and deprecate `signal` (#10005) 2021-05-05 15:39:02 +03:00
Miccah 8b50a5a171
vweb: fix route matching on `/` (#10001) 2021-05-05 14:20:40 +03:00
Miccah 12c3f85507
os: add getuid and geteuid (#10002) 2021-05-05 14:20:11 +03:00
yuyi 7c58dfb88b
checker: fix for_in mut var unused warning (#10008) 2021-05-05 14:11:32 +03:00
zakuro 8c44873674
fmt,parser: prevent unknown module error (#10004) 2021-05-05 14:09:30 +03:00
penguindark 99a2fd76c8
strconv: separate v_sprintf (#10007) 2021-05-05 04:12:18 +03:00
Delyan Angelov 818983de43
v.markused: fix for `v -skip-unused ~/.vmodules/ui/examples/users.v` 2021-05-04 19:05:52 +03:00
Lukas Neubert 9e717e02c9
parser, fmt: prevent error with comment after expr inside match (#9995) 2021-05-04 18:26:10 +03:00
Louis Schmieder b8e070b2a1
orm: fix multi substructs (#9941) 2021-05-04 12:35:18 +03:00
zakuro 92a22e9ec5
ast: fix bug where fn_signature return wrong str for variadic arg (#9993) 2021-05-04 12:33:24 +03:00
Ned Palacios 177f8f585b
checker: fn_call fixes (#9994) 2021-05-04 12:31:32 +03:00
zakuro 1e856c0f94
parser: improve error message for `mod.unknownsubmod.Type` (#9976) 2021-05-04 11:31:31 +03:00
Delyan Angelov 298fc533e4
ci: run `v fmt -w vlib/os/file.c.v` 2021-05-04 08:40:27 +03:00
Rhialto The M c21df2d44c
v: building on NetBSD (#9953) 2021-05-03 19:50:54 +03:00
yuyi 1d045e5496
checker: check generics fn called outside of generic fn (#9984) 2021-05-03 19:50:08 +03:00
yuyi ddc003380c
checker: check generics fn that return generic struct (#9979) 2021-05-03 19:48:54 +03:00
yuyi 035fd052d1
checker: check generic struct declaration (fix #9974) (#9978) 2021-05-03 19:47:02 +03:00
Leigh McCulloch 0fa9a648ae
os: add os.stdout() and os.stderr(), returning os.File, similarly to os.stdin() (#9990) 2021-05-03 19:00:51 +03:00
Leigh McCulloch 4ba11b7752
os: deprecate os.open_stdin in favor of os.stdin (#9989) 2021-05-03 18:57:21 +03:00
Delyan Angelov ae898e77c5
v.markused: handle interface implementation methods, and vweb programs 2021-05-03 18:40:39 +03:00
Enzo 106cd384da
parser: remove obsolete exceptions (#9987) 2021-05-03 17:35:09 +03:00
Delyan Angelov 07f00440bf
picohttpparser: fix setting of req.body 2021-05-03 16:55:20 +03:00
Lukas Neubert 5b826b2663
fmt: keep module alias in interfaces (#9985) 2021-05-03 15:07:12 +03:00
Delyan Angelov 597a774d36
scanner: speed up Scanner.skip_whitespace (~2-3% speed up of `-o x.c cmd/v`) 2021-05-03 14:14:32 +03:00
Delyan Angelov d3f2d6f6df
cgen: speed up c_name/1 by using a map lookup, instead of a linear search in []string{} 2021-05-03 12:58:40 +03:00
pancake 9d4783a2dd
native: initial support for macos-amd64 targets (#9975) 2021-05-03 02:41:36 +03:00
Enzo fb7ddcd4c9
checker: fix looking for unprefixed `os` functions (#9968) 2021-05-02 21:46:12 +03:00
Delyan Angelov 53ae9dda4b
cgen: speed up auto generated Array_*_contains and Array_*_index methods
Uses a.data instead of array_get, since the auto generated methods
have the calls in a loop that guarantees that the bounds of the arrays
will not be exceeded, thus the inner bounds checking can be skipped.

Results in +5% improvement for V compiled with tcc, doing `v -o x.c cmd/v`,
more with -prod.
2021-05-02 20:35:04 +03:00
Mark feb60674b4
builtin.string: minor fixes in join() (#9952) 2021-05-02 19:31:47 +03:00
yuyi 581fe375cc
checker: fix generics with cascaded multi nested generic fn (fix #3815) (#9965) 2021-05-02 19:30:57 +03:00
yuyi ae22967d1d
parser: ensure generic function declaration specifies type names (fix #9959) (#9967) 2021-05-02 19:30:39 +03:00
JalonSolov 3175525b5e
builtin.string: optimize replace (#9969) 2021-05-02 19:30:07 +03:00
penguindark dbadda84e5
builtin: clean up int.v (#9960) 2021-05-02 16:31:29 +03:00
Delyan Angelov 4b818fa2be
v: implement interface embedding (#9935) 2021-05-02 03:00:47 +03:00
JalonSolov 3363c3ef65
builtin.string: optimize replace() (#9955) 2021-05-01 21:27:49 +03:00
Enzo 000d4d3064
checker: cleanup typeof (#9954) 2021-05-01 21:21:44 +03:00
spaceface ef63491a8c
cgen: fix calling function-pointer fields on interfaces (#9948) 2021-05-01 16:45:53 +03:00
ka-weihe 4348c2322d
builtin.map: test more key types (#9947) 2021-05-01 14:26:20 +03:00
ka-weihe daac31aec5
cgen: update wyhash (#9945) 2021-05-01 14:25:27 +03:00
Anton Zavodchikov b621595c05
picoev: error handling workaround (#9913) 2021-05-01 14:20:10 +03:00
yuyi f82f1977d1
tests: enable test_generic_fn_with_variadics() test (#9944) 2021-05-01 12:52:47 +03:00
yuyi fec947c7e1
ast: minor cleanup in ast.FnDecl (#9950) 2021-05-01 12:50:49 +03:00
Alexander Medvednikov c16bb7f3e4 ast: a minor format of ast.v 2021-04-30 15:36:34 +03:00
Alexander Medvednikov e949d4b26c tools/fast: add "V lines" and "V lines/s" 2021-04-30 15:31:50 +03:00
yuyi d236d6a473
parser, cgen: fix generics fn typeof name (fix #7357) (#9939) 2021-04-30 13:40:36 +03:00
yuyi 844662e0d6
cgen: fix generics fn str() (fix #7403) (#9940) 2021-04-30 13:40:07 +03:00
Louis Schmieder fb685eee18
orm: support arrays (#9936) 2021-04-30 09:13:26 +03:00
Louis Schmieder b15156d465
orm: fix mysql substructs (#9930) 2021-04-29 21:00:17 +03:00
yuyi ea0ac09297
checker: fix generics with nested external generics fn (#9933) 2021-04-29 17:37:54 +03:00
Louis Schmieder e9bbb7de3a
orm: add pg select expr (#9927) 2021-04-29 13:38:36 +03:00
R cqls 8af6237e28
gg: fix width and height in draw_rounded_rect primitive (#9926) 2021-04-29 10:58:57 +03:00
Thomas Treffner e05da04b4c
builtin: fix termux prints (#9921) 2021-04-29 09:49:26 +03:00
Lukas Neubert b406de20df
parser, vfmt: multi line comments are not treated as follow-up comments anymore (#9892) 2021-04-29 09:48:08 +03:00
Louis Schmieder c8e07b28e2
orm: fix pg orm statements (#9909) 2021-04-29 09:45:49 +03:00
yuyi 25d9272c84
all: rename `table.register_fn_generic_types` to `table.register_fn_concrete_types` (#9914) 2021-04-29 09:06:50 +03:00
crthpl 6945f987cf
checker: fix sumtype comparison and sumtype in itself (#9917) 2021-04-29 09:04:02 +03:00
zakuro 191a167f42
checker: allow omitting the enum name of map key (#9919) 2021-04-29 08:33:41 +03:00
Lukas Neubert e711e8634e
fmt: prevent rare code corruption with array pre comments (#9908) 2021-04-29 08:28:44 +03:00
Lukas Neubert dee733aae4
fmt: reset const field align after multi line exprs (#9916) 2021-04-29 02:17:37 +03:00
yuyi c82c8059cf
tests: add recursive generics fn test (#9907) 2021-04-28 22:12:06 +03:00
ka-weihe 6795b02e24
cgen: fix enum in map (#9912) 2021-04-28 22:11:32 +03:00
Lukas Neubert a065d014a2
fmt: keep constant sizes in struct field fixed array types (#9910) 2021-04-28 22:11:15 +03:00
Delyan Angelov 626517f5f7
tools: turn `v -watch` into a `v watch` sub-command, so that it can have its own options 2021-04-28 12:29:50 +03:00
Thomas Treffner 1fbf75f2e8
builtin: fix termux println (#9829) 2021-04-28 09:11:50 +03:00
Uwe Krüger f4e92997f2
checker: support value array elements of `[heap]` type inside struct ref (#9899) 2021-04-28 07:47:00 +03:00
Carlos Esquerdo Bernat f46868133b
vweb: remove calling .to_lower too early while processing url and url params (#9805) 2021-04-28 07:46:36 +03:00
ka-weihe 3edbf71770
parser: fix maps with aliases as key (#9900) 2021-04-28 07:45:21 +03:00
Enzo 4f246222b0
v: replace `--enable-globals` with `-enable-globals` (#9898) 2021-04-28 07:44:28 +03:00
penguindark a2014f86b7
strconv: new faster atof function (#9903) 2021-04-28 07:42:22 +03:00
Louis Schmieder faf2656335
orm: support multiline statements (#9888) 2021-04-27 15:28:57 +03:00
yuyi 9f1ac39770
checker: fix generics with anon generics fn argument (fix #9859) (#9897)
* checker: fix generics with anon generics fn argument

* cgen: fix typedef of generics anon fn

* fix check generics argument types
2021-04-27 15:25:42 +03:00
pancake d8bb939072 native: fix tests, address comments and a little cleaner macho 2021-04-27 12:24:58 +03:00
pancake 5be41ebc80 native: handle ident and integer args in exit and add arm64 2021-04-27 12:24:58 +03:00
pancake a31a1eb9cb native: define println and exit builtins or verror() 2021-04-27 12:24:58 +03:00
pancake 1eac6eee59 native: use pref.arch to host_arch() by default 2021-04-27 12:24:58 +03:00
pancake 9b07278930 native: better raw output and more arm64 cleanup 2021-04-27 12:24:58 +03:00
pancake 9a3869c521 v.ast: rename aarch64 to arm64 and aarch32 to arm32 2021-04-27 12:24:58 +03:00
pancake 6750ed254f x64: rename to `native` to not conflict with the x64 comptime variable 2021-04-27 12:24:58 +03:00
pancake 7587458521 x64: move all the amd64 specific code out of gen.v 2021-04-27 12:24:58 +03:00
Don Park aebb551e93
cgen: do full struct initialisation for V structs, fixes invalid data from `map[string]Struct{}['unknown']` (#9878) 2021-04-27 08:18:48 +03:00
Uwe Krüger 787a63dab6
cgen: execute `defer` block *after* return expression is evaluated (#9893) 2021-04-27 01:42:16 +03:00
Enzo 4eb8072882
parser: remove ++/-- exception for some modules (#9895) 2021-04-27 01:41:42 +03:00
yuyi 3877522ee3
table,checker,cgen: fix generics with recursive generics struct (#9862) 2021-04-26 20:05:10 +03:00
yuyi 21d1f86ead
checker: fix generics that return reference generics struct (fix #6218) (#9869) 2021-04-26 20:01:01 +03:00
yuyi 7ddf569de6
cgen: fix generics multi_array in (#9885) 2021-04-26 19:59:40 +03:00
Enzo de8c4866a4
v.checker: fix postfix expr on generic types (#9887) 2021-04-26 19:57:05 +03:00
yuyi 2b43d3193b
checker: fix generics with assign generics struct (fix #7784) (#9889) 2021-04-26 19:54:22 +03:00
Lukas Neubert 181b0f1035
parser: improve error message for missing db expr in ORM (#9890) 2021-04-26 19:51:51 +03:00
Delyan Angelov cafe382424
vweb: update references to old .init_once() and .init() methods to .init_server() and .before_request() 2021-04-26 19:38:13 +03:00
Delyan Angelov 5e0ff5c524
cgen: cleanup g.type_default 2021-04-26 11:55:29 +03:00
yuyi 212b4fa089
parser: implement infering generic type parameters from receiver types (fix #5862) (#9870) 2021-04-26 10:56:08 +03:00
kahsa f36e46bfde
gg:fix draw_line for android (#9882) 2021-04-26 10:01:55 +03:00
spaceface 9d68f924c3
parser: don't disallow closures in the JS backend (#9884) 2021-04-26 10:00:39 +03:00
Louis Schmieder f5ce9388de
io: make io.cp use chunks (#9877) 2021-04-26 09:59:23 +03:00
spaceface 7acb48df83
parser: parse `JS.` interfaces properly (#9876) 2021-04-26 09:58:05 +03:00
spaceface 8b22dbbadb
jsgen: basic struct embedding support (#9879) 2021-04-26 09:56:03 +03:00
Uwe Krüger 3c0a368af3
all: automatically move (some) referenced objects to heap (#9873) 2021-04-25 21:40:38 +03:00
Louis Schmieder 00261afbc1
io: add a `cp` function (#9875) 2021-04-25 21:22:33 +03:00
Louis Schmieder 7184629969
orm: add initial pg support (#9827) 2021-04-25 18:57:55 +03:00
Louis Schmieder fc3b628440
v: support `$for attr in Test.attributes` (#9836) 2021-04-25 18:29:26 +03:00
zakuro a0835ac139
checker/cgen: implement in expression for alias of array/map (#9871) 2021-04-25 18:17:54 +03:00
Bastian Buck 160b605640
os: use C.GetUserNameW for os.loginname() instead + improvements os.uname() (#9872) 2021-04-25 18:16:14 +03:00
penguindark bfe0a7887f
builtin,strconv: fix and optimize utf8 and formatting functions (#9874) 2021-04-25 17:57:21 +03:00
Ulises Jeremias Cornejo Fandos 3c8d2bbaec
vlib/context: some clean up and more readable examples (#9868) 2021-04-25 16:04:07 +03:00