Commit Graph

5470 Commits (553ecf63e73b26bad664d66f59267081fb988294)

Author SHA1 Message Date
Daniel Däschle a38fe4fca9
checker: fix smartcast inside smartcast (#7215) 2020-12-10 00:59:39 +01:00
Seven Du 4a35a75b64
json: fix raw json string decoding crash when expected key is missing (#7206) 2020-12-09 20:10:41 +01:00
Daniel Däschle 032ea0f4f8
scanner: fix silent mode string parsing (#7220) 2020-12-09 20:09:07 +01:00
Ned Palacios b952bf2e6b
net.html: polish module, update docs (#7193) 2020-12-09 20:08:15 +01:00
yuyi 5fa1e403ec
scanner: fix interpolation with string args (#7214) 2020-12-09 19:58:27 +01:00
Nick Treleaven cf755d40b7
checker: allow ++, -- on byteptr, charptr (#7218) 2020-12-09 19:58:02 +01:00
Nick Treleaven 92a8db5b2b
checker: remove duplicated unsafe tests (#7216) 2020-12-09 19:57:15 +01:00
Delyan Angelov aa0ddec638
cgen: unify _name_table[0]{} generation (fix a bootstrapping problem with v_win.c and msvc) 2020-12-09 20:18:48 +02:00
Delyan Angelov 23f5cecbd0
ci: run vfmt over vlib/v/gen/cgen.v 2020-12-09 20:12:47 +02:00
Delyan Angelov c7bea03ce3
ci: fix msvc _name_table [0]{} generation 2020-12-09 20:08:51 +02:00
Delyan Angelov 9451233c34
cgen: force CI rebuild with newer vc/ 2020-12-09 19:49:37 +02:00
Delyan Angelov 6115db4820
cgen: fix msvc CI failure on `static struct _name_table[] = {}`, by skipping static for now 2020-12-09 19:25:36 +02:00
Delyan Angelov 80d12f6795 cgen: add static for the generated _name_table (fixes `./v -cc clang -o v2 -usecache cmd/v` on macos) 2020-12-09 19:03:48 +02:00
Delyan Angelov 8caf3829d7
checker: fix interface checking of array arguments; closes #2377 2020-12-09 18:51:37 +02:00
Delyan Angelov 3b94a2b77a
cgen: fix interface _name_table generation; closes issue #73 2020-12-09 17:07:11 +02:00
Lukas Neubert 0e7192c9b7
fmt: keep comments in struct init without fields (#7212) 2020-12-09 16:35:03 +02:00
Delyan Angelov ada02d4498
time: fix failing test_iso8601_parse_utc 2020-12-09 15:48:21 +02:00
Delyan Angelov 338f3afd31
vfmt: fix `type MyFn = fn (int) int mut arr := []MyFn{}` 2020-12-09 15:18:45 +02:00
Lukas Neubert 3b6b5b8090
vfmt: properly parse comments on lines after init fields (#7202) 2020-12-09 11:11:22 +02:00
yuyi 05a217aaf0
scanner: minor cleanup and optimization in scanner.v (#7204) 2020-12-09 02:09:46 +01:00
Alexander Medvednikov 1abb40dc46 cgen: use `cur_mode ast.Module` instead of a string 2020-12-08 19:52:33 +01:00
penguindark 2bc1076921
regex: bug fixes, improved tests 2020-12-08 19:38:25 +01:00
Alexander Medvednikov a1c0bb3585 os: File.write_string() 2020-12-08 19:37:33 +01:00
Takahiro Yaota 036e762446
time: make parse_iso8601 support format without microseconds (#7176) 2020-12-08 17:53:54 +01:00
Delyan Angelov d5915bde7c
parser: implement support for -Wimpure-v (#7195) 2020-12-08 17:52:24 +01:00
Leah Lundqvist 90c1c639fe
js: types (#7108) 2020-12-08 17:49:20 +01:00
Andréas Livet a2ec52b8c4
builtin: rewrite string.split_nth and fix some bugs (#7189) 2020-12-08 10:51:47 +02:00
joe-conigliaro 8931d3d39c
checker: include built-in pointer types when checking fn expects non reference. closes #7133 2020-12-08 17:11:15 +11:00
joe-conigliaro 44b9ea4a75
cgen: selector expr / method call on sumtype pointer #7191 2020-12-08 16:08:10 +11:00
joe-conigliaro 805da2325f
cgen: defer was broken in presence of anon fn. fixed #7171 2020-12-08 14:21:19 +11:00
Delyan Angelov 3386526610
builder: improve support for -g in cross compilation to windows 2020-12-07 23:38:21 +02:00
Nick Treleaven 63557d0d02
checker: disallow op= and infix on a voidptr (#7175) 2020-12-07 22:43:38 +02:00
Delyan Angelov ed9aa873c1
gg: use gg.system_font_path() as a fallback when a font can not be found 2020-12-07 21:40:24 +02:00
Delyan Angelov 0efdc7bbe8
gg: print a diagnostic message when a requested font file is not found 2020-12-07 21:28:41 +02:00
Delyan Angelov 1914bc790b
builder: add comment about the goal of cflags.c_options_only_object_files() in cross compilation 2020-12-07 20:35:04 +02:00
Delyan Angelov 4b4733d6b4
builder: fix cross compilation of examples from linux->windows 2020-12-07 19:57:12 +02:00
Nick Treleaven a100b05647
checker: improve 'operator not defined on right operand type' error (#7185) 2020-12-07 18:37:17 +01:00
spaceface777 744a36ed71
js: restructure namespaces (#7170) 2020-12-07 18:36:22 +01:00
Delyan Angelov d38bca5958
checker: tweak the import private function message a little 2020-12-07 19:22:37 +02:00
joe-conigliaro 78a6795319
all: change the way import symbols work & support consts (#7182) 2020-12-07 19:13:03 +02:00
Lukas Neubert f30faf2627
scanner: allow \e escape used for ANSI colors (#7177) 2020-12-07 17:21:34 +01:00
Takahiro Yaota b5982b638a
time: fix typo in test (#7174) 2020-12-07 17:21:12 +01:00
Uwe Krüger fd689f5fdd
cgen: optimize array op assign (#7178) 2020-12-07 17:13:19 +01:00
Delyan Angelov 91e18b039c
net: fix cross compilation with mingw, Ws2tcpip.h => ws2tcpip.h 2020-12-07 10:41:42 +02:00
yuyi f377710c0b
scanner: minor optimization in `text_scan()` (#7172) 2020-12-07 06:33:41 +01:00
joe-conigliaro 14887304d8
sokol: allow submodules to be built by themselves (add required imports) 2020-12-07 16:16:21 +11:00
Ned Palacios 2ba8d31118
vdoc: fix sorting; fix missing symbols; document functions (#7161) 2020-12-07 02:43:25 +01:00
joe-conigliaro dcca821000
cgen: autofree - set/reset g.branch_parent_pos for all for loops 2020-12-07 12:08:09 +11:00
yuyi bac6be2273
token: minor clean up (#7163) 2020-12-06 16:48:23 +01:00
Uwe Krüger 853dcc33c7
cgen: optimize map op_assign (#7162) 2020-12-06 15:20:31 +01:00
Takahiro Yaota 0c50f0c9dc
time: v fmt (#7160) 2020-12-06 15:19:39 +01:00
Delyan Angelov 2be0c6af47
builtin: implement -d exit_after_panic_message (speeds up `v test-parser` with gcc/clang) 2020-12-06 14:21:37 +02:00
joe-conigliaro 5931b26737
cgen: remove extraneous call to util.no_dots 2020-12-06 22:12:23 +11:00
Daniel Däschle 334d605d90
tools,vls: add `v test-parser examples/hello_world.v` (#7145) 2020-12-06 12:42:56 +02:00
Alexander Medvednikov 8eff8b0eff autofree: fix `for` args 2020-12-06 08:38:21 +01:00
Alexander Medvednikov b6ae81032f ast: Var.is_tmp field 2020-12-06 08:19:17 +01:00
joe-conigliaro cd72c25edb
cgen: vfmt cgen.v after changes from previous commit 2020-12-06 18:05:17 +11:00
joe-conigliaro 7733834751
parser/cgen: autofree - move branch_parent_pos to cgen. 2020-12-06 18:02:36 +11:00
joe-conigliaro d7c057840a
parser: autofree - reset p.branch_parent_pos to previous pos on return 2020-12-06 17:00:44 +11:00
joe-conigliaro aeb467e038
cgen: fix typo from previous commit 2020-12-06 15:18:24 +11:00
joe-conigliaro d779510616
cgen: remove debugging comments added in a05408b 2020-12-06 15:16:45 +11:00
João Victor Oliveira Couto cb5f75c7bf
net.html: change license in readme (#7157) 2020-12-06 05:11:43 +01:00
joe-conigliaro a05408b49a
all: make type system use source name & cleanup storing name in fields 2020-12-06 14:55:08 +11:00
Roland Lammel 028c82e255
fmt: improve map value alignment (#7105) (#7151) 2020-12-06 02:04:45 +01:00
Lukas Neubert 79a20c338b
regex: format readme examples (#7154) 2020-12-06 02:04:07 +01:00
ka-weihe 96d28b4485
map: more tests (#7153) 2020-12-06 01:28:11 +01:00
ka-weihe 5a7fdb0610
map: optimize free() and keys() (#7152) 2020-12-06 00:24:24 +01:00
Lukas Neubert 8adb1acf31
check-md: verify code example formatting (#7143) 2020-12-05 22:54:41 +01:00
Nick Treleaven 0d28f12c54
map: use untyped keys for DenseArray and interleave keys and values (#7142) 2020-12-05 22:53:50 +01:00
penguindark 6b7d7cee0c
regex: new examples, new utility functions (#7150) 2020-12-05 22:24:08 +01:00
Delyan Angelov 1739b08e73
builtin: add a test for the sorting of []u64 too 2020-12-05 23:21:20 +02:00
Delyan Angelov b99ea332f0
cgen,builtin: fix sort for []u64 2020-12-05 23:14:19 +02:00
yuyi 29857cb9d6
checker: fix interpolation recursive str (fix #1905) (#7141) 2020-12-05 21:41:54 +01:00
Alexander Medvednikov 22ebbab462 autofree: set tmp var pos 2020-12-05 21:27:49 +01:00
Delyan Angelov 946a1418fe
Revert "autofree: handle tmp vars in for loops"
This reverts commit 1d6c604664.
2020-12-05 21:52:50 +02:00
Alexander Medvednikov e2e0c625f1 net: add openssl header dir on arm64 macs 2020-12-05 20:27:16 +01:00
Alexander Medvednikov 1d6c604664 autofree: handle tmp vars in for loops 2020-12-05 20:11:31 +01:00
Delyan Angelov 6e76d5d1db
cgen: fix double escaping \n in @VMOD_FILE expansion 2020-12-05 20:13:36 +02:00
joe-conigliaro 7212b2eff2
parser: vfmt parser.v which was modified in previous commit 2020-12-06 02:39:56 +11:00
joe-conigliaro 83f651c29a
cgen: autofree - know where to stop freeing parent scops on continue/break 2020-12-06 02:36:27 +11:00
Xavier B fafe30b6aa
json: add support for aliased struct fields (#6556) 2020-12-05 16:13:18 +01:00
joe-conigliaro 865c30118f
checker: add fix & better comment for previous commit 2020-12-06 01:37:00 +11:00
joe-conigliaro 3172f324d1
checker: infer array_init type from call with in return of or block. closes #7135 2020-12-06 01:26:28 +11:00
Delyan Angelov daa659e1fd
builder: allow for `-os windows -cc msvc -o x.c` on any platform 2020-12-05 15:35:39 +02:00
Delyan Angelov fbf6910ab9
builder: remove executables after `v run file.v` 2020-12-05 13:03:12 +02:00
Delyan Angelov 7d9d42b2e2
math.fractions: document the remaining functions in math.fractions 2020-12-05 12:23:18 +02:00
Delyan Angelov 0dfcacd26b
cgen: fix `fn f(mut a []int) { a << [1,2] }` 2020-12-05 10:12:17 +02:00
Delyan Angelov b18915df62
tests: cleanup long running repl tests (replaced by faster ordinary tests in vlib/v/tests/) 2020-12-05 08:52:08 +02:00
yuyi 595efbac5b
checker: fix or_block return &type mismatch (#7138) 2020-12-05 08:06:51 +02:00
Alexander Medvednikov d1281ac6c1 autofree: handle` break` 2020-12-05 05:06:52 +01:00
penguindark 4fb37e81b2
regex: bug fixes (#7137) 2020-12-05 01:51:48 +01:00
Alexander Medvednikov 89952edd25 gg: remove unnecessary copy in draw_text 2020-12-05 00:03:46 +01:00
Alexander Medvednikov 5180013aef autofree: fix array re-assignment with struct fields 2020-12-04 23:30:30 +01:00
spaceface777 76ed8e3750
checker: don't disallow method call chains (#7128) 2020-12-04 21:27:38 +01:00
Alexander Medvednikov f14bd10c00 autofree: more `return` fixes 2020-12-04 20:44:33 +01:00
spaceface777 6a47deb3f8
checker: ensure array init matches the array's type (#7118) 2020-12-04 20:39:32 +02:00
yuyi 215a76a715
string: make `tos_lit` deprecated (#7129) 2020-12-04 20:34:58 +02:00
Daniel Däschle 47d0ed308d
parser: prepare for better VLS integration, more accurate parser errors (#7119) 2020-12-04 20:34:05 +02:00
spaceface777 52fb7033c3
gen: fix evaluating the receiver of array methods (.map(), .filter(), etc) more than once (#7130) 2020-12-04 20:29:34 +02:00
Nick Treleaven f21b2b41ac
gen: make _SLIT macro determine `len` at compile-time (#7131) 2020-12-04 20:14:39 +02:00
Alexander Medvednikov 0ea2fa228f autofree: fix `or {}`; ci: bring back gitly -autofree 2020-12-04 18:06:53 +01:00
Delyan Angelov 7a8d6a7c7b
scanner: treat warnings as errors on -W too, simillar to the parser 2020-12-04 15:11:35 +02:00
spaceface777 50a3009113
fmt: make single-stmt `or` blocks single-line (#7126) 2020-12-04 13:25:23 +02:00
spaceface777 9345d489f8
ci: fix self compilation with cached modules on macos (#7127) 2020-12-04 13:25:02 +02:00
Delyan Angelov 52ccdd747f
cgen: allow for `const ( x = opt() ? )` 2020-12-04 13:11:12 +02:00
Delyan Angelov d0a2992335
regex: align query/regex err pos in optional err messages/panics 2020-12-04 12:43:25 +02:00
Lukas Neubert 02ba923ba7
fmt: do not add braces for trailing struct arg (#7072) 2020-12-04 11:22:26 +02:00
Alexander Medvednikov b64945a6c0 autofree: lots of fixes in `return_statement()` 2020-12-04 10:10:40 +01:00
joe-conigliaro b578e60dd5
tests: add test for fix #cf7b45b 2020-12-04 15:43:28 +11:00
joe-conigliaro cf7b45b074
checker: correctly check arrays with element that is an alias. fixes #6735 2020-12-04 14:26:25 +11:00
Tomas Hellström d12f5f7ba0
x.websocket: vdoc (#7091) 2020-12-04 01:52:26 +01:00
Alexander Medvednikov cae3bd7f32 gg: vfmt gg.v 2020-12-04 01:27:40 +01:00
Alexander Medvednikov e160f6e7d2 gg: screen_size() 2020-12-03 23:17:00 +01:00
yuyi 9b6a1552e9
checker: check match return mismatch type (fix #6826) (#7109) 2020-12-03 21:14:23 +02:00
Nick Treleaven d590ce7675
map: add 3 DenseArray methods for bootstrapping (#7113) 2020-12-03 21:12:53 +02:00
Daniel Däschle 6c100a0bc3
vls,parser: fix an eof error in parsing invalid const declarations (#7115) 2020-12-03 21:11:43 +02:00
penguindark 15ffce1317
regex: fix compilation issues with gcc under ubuntu (#7112) 2020-12-03 19:33:53 +01:00
yuyi 06eaded6ea
string: change `tos_lit` to `_SLIT` (#7079) 2020-12-03 16:02:48 +01:00
Delyan Angelov eefdf4baa6
scanner: do not warn for \x07 in strings 2020-12-03 14:11:32 +02:00
Daniel Däschle 558a756431
parser: fix position offset by 1 (#7099) 2020-12-03 11:25:06 +02:00
Swastik Baranwal c5a7c51dfd
parser: add a check for known vars in or block (#7094) 2020-12-03 04:46:04 +01:00
yuyi 30da85a4d5
checker: fix optional or_block {none} (#7095) 2020-12-03 01:03:17 +01:00
Uwe Krüger c1b25dd61d
cgen: fix map value op-assign modification (#7101) 2020-12-03 00:40:11 +01:00
Alexander Medvednikov 1037d3a383 checker: make missing `mut` before an argument a warning 2020-12-02 23:58:06 +01:00
joe-conigliaro ce1fa1194d
parser: fix not used parent warning for selective imports. closes #6916 2020-12-03 01:14:49 +11:00
Lukas Neubert 2691163a7e
scope: remove redundant name arg from register() (#7077) 2020-12-02 14:40:25 +01:00
heronwr f8af866f76
builtin: make v_realloc use int parameter instead of u32 (#7080) 2020-12-02 15:35:11 +02:00
joe-conigliaro cd46eb42d7
checker: fix generic os.fn call (script) without mod prefix. fixes #7073 2020-12-02 21:40:44 +11:00
joe-conigliaro ca7692c839
error on unknown generic struct init. closes #7085 2020-12-02 20:53:40 +11:00
Enzo d8b8aca51e
gen: fix `arr.last().field` (#7076) 2020-12-02 04:35:00 +01:00
Lukas Neubert dedb8f7e41
fmt: smarter wrap of orm lines (#7070) 2020-12-02 04:06:20 +01:00
Tomas Hellström 7c394b9d58
x.websocket: docs and cleanup (#7078) 2020-12-02 04:02:53 +01:00
Alexander Medvednikov 953a51bec8 autofree: fix an off by 1 error 2020-12-02 03:45:08 +01:00
Lukas Neubert 8adc8ed103
parser: do not fail on comment direct after import (#7071) 2020-12-01 22:32:34 +02:00
Delyan Angelov 394e9c4c56
builder: replace single `goto start` usage, with `for { ... continue ... break}` 2020-12-01 22:11:44 +02:00
Alexander Medvednikov c5cd53ca79 parser: bring back old $if position calculation 2020-12-01 18:59:33 +01:00
Alexander Medvednikov 0ff541375d autofree: fix a bug with $if and add a test 2020-12-01 18:58:16 +01:00
Alexander Medvednikov 3612bd58ef fmt: revert the fn \n change 2020-12-01 17:00:06 +01:00
Alexander Medvednikov 0ddf0a4b92 gg: custom bold font path 2020-12-01 16:30:25 +01:00
yuyi d3deaa1f59
cgen: fix typeof variadic type (#7063) 2020-12-01 16:11:37 +01:00
Daniel Däschle 5b6eb7b2c9
cgen: simplify .str() generation (#7038) 2020-12-01 16:09:03 +01:00
Ned Palacios 54e03f60b9
x.json2: remove builder methods (#7008) 2020-12-01 16:23:59 +02:00
yuyi 6a1e0322bd
gen: fix interpolation variadic (#7059) 2020-12-01 12:40:38 +02:00
joe-conigliaro f1965c0510
ast: fmt ast.v 2020-12-01 21:20:27 +11:00
joe-conigliaro 88835a0456
cgen: remove some nasty replacements 2020-12-01 21:17:19 +11:00
joe-conigliaro 9b583f51f1
ast: remove field which should have been removed in #34e124d 2020-12-01 20:15:35 +11:00
joe-conigliaro 34e124d5f7
cgen: auto cast sum type in array init. fixes #6907 2020-12-01 20:03:45 +11:00
Delyan Angelov fe0ded9a91
tests: add a regression test for the inter module generics inference 2020-12-01 08:07:07 +02:00
joe-conigliaro a7d917474d
checker: simplify generic fn post processing 2020-12-01 16:43:10 +11:00
joe-conigliaro 0e54b9acb5
checker: remove debug println introduced in 4f658ec 2020-12-01 15:14:30 +11:00