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

4053 Commits

Author SHA1 Message Date
Delyan Angelov
a386be6505
v.table: correct table.types to table.type_symbols 2021-03-19 22:51:52 +02:00
Delyan Angelov
4a12546971
cgen,fmt: improve sizeof(), fix type PPType = &&Type 2021-03-19 22:49:46 +02:00
Delyan Angelov
c5884a5f4d
v.ast: improve Expr.str() for sizeof(Type) 2021-03-19 20:56:49 +02:00
zakuro
95a748e8b0
checker: cleanup call_method (#9365) 2021-03-19 14:19:38 +02:00
Delyan Angelov
4f6306f6d4
examples: fix v -cflags "-Werror" test examples/ 2021-03-19 13:13:56 +02:00
Lukas Neubert
82c4daa4b7
fmt: fail keep test when bin2v_keep preparation step fails (#9361) 2021-03-19 13:13:03 +02:00
Lukas Neubert
f8fcf3ff66
fmt: reorder and sort methods into section (#9363) 2021-03-19 11:26:34 +02:00
Delyan Angelov
00651c8deb
builtin: free all elements in a []string with -autofree too 2021-03-18 21:10:42 +02:00
Miccah
7222ee476b
all: implement array .any and .all (#9347) 2021-03-18 15:24:16 +01:00
spaceface
624c1f3bcf
cgen: make bools take up a single byte, not 4 (#9352) 2021-03-18 15:23:29 +01:00
zakuro
4ae2c22c18
checker: make optional array element an error (#9343) 2021-03-18 15:11:51 +02:00
yuyi
a6c2c5ba88
parser: minor cleanup in call_args() (#9344) 2021-03-18 15:06:48 +02:00
Swastik Baranwal
f28e67d526
cmd/tools/v/vdoc: keep _ sep in numeric literals and highlight modules properly (#9358) 2021-03-18 15:06:16 +02:00
Ned Palacios
eccf707270
vdoc: improve error message for non-existing symbols (#9359) 2021-03-18 15:04:53 +02:00
Delyan Angelov
7bbcf02134
ci: fix failing -Werror steps for code generated by json.encode(map{'a': []string{}}) 2021-03-18 12:13:06 +02:00
Delyan Angelov
f7a8a460f6
v.parser: add a test for db46ad5 2021-03-18 11:31:17 +02:00
Delyan Angelov
db46ad5481
v.parser: fix xxx.fncall(map{x: []string{}}) treatment as []xxx.string{} 2021-03-18 11:07:25 +02:00
Alexander Medvednikov
4e62bc0b81 autofree: fix free before return 2021-03-18 05:41:50 +03:00
Alexander Medvednikov
88097125f7 checker: remove "use ++ instead of += 1" 2021-03-18 01:37:36 +03:00
zakuro
6cfc2c217b
checker: fix #9330 (#9342) 2021-03-17 20:57:14 +02:00
Lukas Neubert
49eeddcd1c
parser: set correct last line for struct inits (#9349) 2021-03-17 20:46:08 +02:00
Lukas Neubert
0a06a83d9b
fmt: fix possible removal of PrefixExpr or blocks (#9351) 2021-03-17 20:43:28 +02:00
Delyan Angelov
e8df8bc8c3
ci: fix for -autofree vlib/v/tests/option_test.v 2021-03-17 14:44:45 +02:00
Delyan Angelov
99cc02685b
cgen: implement IError.free() and use it for the builtin none const 2021-03-17 12:38:24 +02:00
Delyan Angelov
ae401bd930
ci: fix the ./v -g -autofree -o v2 cmd/v step 2021-03-17 09:48:56 +02:00
crthpl
fafb035fb5
all: reimplement inline assembly (#8645) 2021-03-17 01:43:17 +01:00
yuyi
dd9f9c2718
checker: check array.sort(a < b) (#9321) 2021-03-17 01:42:51 +01:00
ka-weihe
2991cad4e8
map: fix delete in for-in (#9336) 2021-03-17 01:42:33 +01:00
Alexander Medvednikov
149151b1e8 cgen: minor vfmt 2021-03-17 03:41:52 +03:00
Alexander Medvednikov
091a1bab27 autofree: free global map consts and some vweb fixes 2021-03-17 01:33:35 +01:00
Enzo
4b6244c9c1
gen: fix generic variadic (#9333) 2021-03-17 00:18:43 +02:00
Lukas Neubert
05b51c5b01
parser: correctly set pos of sql blocks (#9334) 2021-03-16 23:00:50 +02:00
Delyan Angelov
1753445a64
builtin: make panics more IDE friendly 2021-03-16 20:50:11 +02:00
Lukas Neubert
e554415123
fmt: allow ascii art block comments (#9332) 2021-03-16 20:49:55 +02:00
Delyan Angelov
506561c792
cgen: fix a bug (deleting a map key while iterating on the same map) detected by -d debug_realloc 2021-03-16 09:20:45 +02:00
Leah Lundqvist
0823ea4af1
builder: produce an iOS binary instead of a bundle (#9316) 2021-03-15 19:03:05 +01:00
Nick Treleaven
446631ceb5
checker: fixed array cannot implicitly convert to fooptr (again) (#9302) 2021-03-15 15:55:07 +02:00
Uwe Krüger
9d168895ed
checker: check write access to shared elements of struct and array (#9314) 2021-03-15 15:54:06 +02:00
Anton Zavodchikov
1ad4623fb8
tmpl: move to v/parser (#9052) 2021-03-15 13:35:55 +02:00
yuyi
2d2e4610e7
cgen: make use of mut_rec in method consistent (#9308) 2021-03-15 12:22:52 +02:00
yuyi
e235022e10
cgen: fix error of for_in map_literal (#9310) 2021-03-15 12:22:32 +02:00
Delyan Angelov
25c07c2f43
v.ast: handle more expressions in Expr.str() 2021-03-15 06:27:56 +02:00
zakuro
80ac1aaf93
fmt: use type_to_str_using_aliases (#9306) 2021-03-15 06:27:08 +02:00
yuyi
945769a4f6
all: implement reference receiver optimization for big structs (#9268) 2021-03-14 18:11:21 +01:00
StunxFS
92e95f127a
checker: correct type check for generic function with ternary if return (#9296) 2021-03-14 19:01:32 +02:00
yuyi
e677daf608
cgen: fix array_sort and format array_filter/map generated codes (#9303) 2021-03-14 18:47:43 +02:00
Delyan Angelov
b6d089b605
v.depgraph: ensure v -d debug_realloc -o v cmd/v works 2021-03-14 16:15:33 +02:00
Enzo
db152868c0
fix: fix infering int and float literal in generic fn calls (#9287) 2021-03-14 15:00:47 +02:00
yuyi
c0779e8455
cgen: fix return_statement generated redundant ; (#9299) 2021-03-14 14:58:17 +02:00
Delyan Angelov
ddbe57e00a
v test-cleancode: ensure more .v files are kept vmft-ed 2021-03-14 12:17:31 +02:00
zakuro
8dc0e4d150
v.scanner: decode \uXXXX in scanner (#9298) 2021-03-14 12:09:17 +02:00
Delyan Angelov
69f1e7c9c3
v: fixes for v -autofree -o v2 cmd/v 2021-03-14 09:37:38 +02:00
Leah Lundqvist
64d0006ff9
jsgen: fix string and array for loops and improve casting (#9295) 2021-03-14 08:20:01 +02:00
Nick Treleaven
df46fe1373
builder: warn when using tcc with -prod (#9288) 2021-03-14 01:55:14 +01:00
spaceface
9ed9e7aff0
builtin: cleanup option names (part 1) (#9293) 2021-03-14 01:54:46 +01:00
yuyi
5a6b321656
cgen: format if_guard_expr generated c codes (#9290) 2021-03-14 01:54:05 +01:00
spaceface
e9797c618a
all: implement error interfaces (#9291) 2021-03-13 18:13:50 +01:00
Alexander Medvednikov
167dcc415d tests: fix a generic init test 2021-03-13 18:46:02 +03:00
Alexander Medvednikov
f86233c41f autofree: fix [manualfree] 2021-03-13 18:43:02 +03:00
Alexander Medvednikov
2f1810634e checker: do not allow direct initialization of builtin types (s := string{}) 2021-03-13 18:20:46 +03:00
Lukas Neubert
f648e3f10d
fmt: use iembed cmts in arrays at line start when exprs come afterwards (#9285) 2021-03-13 09:58:50 +02:00
Nick Treleaven
c06e58d418
gen: fix generating $if expr || expr (#9270) 2021-03-13 08:45:50 +02:00
zakuro
00dedaf6c1
scanner: replace ascii unicode(\u0020) with hex(\x20) (#9259) 2021-03-13 08:02:42 +02:00
spaceface
be409b52e9
builtin: prepare for error interfaces (#9043) 2021-03-12 20:05:05 +02:00
Delyan Angelov
c474106511
cgen: fix match expression with complex boolean conditions 2021-03-12 19:55:33 +02:00
StunxFS
3cb1bb7c36
checker: check the amount of parameters passed to json.decode() (#9267) 2021-03-12 19:02:09 +02:00
Nick Treleaven
9db8a61b92
checker: disallow array append in an expression (#9265) 2021-03-12 16:09:01 +01:00
Uwe Krüger
dbbf96702b
checker: require shared a to be rlocked to read a[i] or a.e (#9266) 2021-03-12 16:08:39 +01:00
Nick Treleaven
e229d0c1c3
checker: improve error message for invalid property (#9263) 2021-03-12 14:18:52 +02:00
Nick Treleaven
3be78d6777
parser: require anonymous fn to use _ for unused parameters (#9262)
Fixes a C error with gcc.
2021-03-12 14:17:37 +02:00
yuyi
504b87bcfd
checker: minor cleanup in if_expr() (#9258) 2021-03-12 13:40:05 +02:00
Lukas Neubert
cfbb783649
fmt: fix linebreak in non-block consts (#9260) 2021-03-12 12:27:05 +02:00
Lukas Neubert
a67d49050c
math: add a pure V math.mathutil, with generic min, max and abs functions (#9176), and use it consistently 2021-03-12 11:28:04 +02:00
Lukas Neubert
c40ab0db72
fmt: fix removal of attrs with comments afterwards (#9255) 2021-03-11 21:44:33 +01:00
StunxFS
04c4f16f75
checker: minor changes to Checker.hash_stmt() (#9249) 2021-03-11 21:43:42 +01:00
StunxFS
8f08795689
checker: warn/error about empty const blocks (#9252) 2021-03-11 21:43:04 +01:00
yuyi
9fbb139e29
checker: check map copy error in fn_mut_arg (#9242) 2021-03-11 15:19:36 +01:00
Miccah
f26d2f02b7
ast, cgen, checker, parser: support method arguments in comptime $for (#9208) 2021-03-11 15:04:34 +02:00
StunxFS
8de6511056
cgen: minor optimization to for ch in "StringLiteral" (#9240) 2021-03-11 15:01:53 +02:00
yuyi
a547e889af
checker: check array literal modify error (#9243) 2021-03-11 14:57:04 +02:00
Lukas Neubert
f69cef397c
fmt: do not insert a space before struct declaration generics (#9239) 2021-03-11 14:54:40 +02:00
spaceface
7d0cba5e96
v.ast: remove the stmt.position() method (#9233) 2021-03-11 14:50:02 +02:00
Delyan Angelov
6628bbc690
cgen: use the new __offsetof_ptr macro 2021-03-11 13:14:36 +02:00
Delyan Angelov
144546543c
cgen: add the __offsetof_ptr C macro 2021-03-11 13:08:45 +02:00
Delyan Angelov
5a231326d7
parser: improve syntax errors in module declarations 2021-03-11 10:42:36 +02:00
StunxFS
6a7ef4f5b2
v.scanner: fix position of hash statements (#9222) 2021-03-10 20:23:17 +02:00
zakuro
f280a5c230
checker: extract into call_array_builtin_method to cleanup (#9225) 2021-03-10 20:19:39 +02:00
zakuro
ef73e07e62
checker: split fn_decl into functions to cleanup (#9226) 2021-03-10 20:18:48 +02:00
zakuro
791dec7b01
v: support $if prod (#9228) 2021-03-10 19:26:34 +02:00
Swastik Baranwal
8d84206a8c
cgen: fix match for one branch (#9234) 2021-03-10 18:44:32 +02:00
spaceface
eefdad21c7
cgen: cleanup interface/sumtype casts (#9221) 2021-03-10 18:41:11 +02:00
yuyi
a187a4abb3
checker: check non-optional fn return or_block (#9227) 2021-03-10 12:53:23 +01:00
Delyan Angelov
0d2bb714bc
checker: disallow x := [13]SumType{} too 2021-03-10 11:07:36 +02:00
Delyan Angelov
f5ebfefdc9
ci: use a smaller fixed size array for the const eval test (fixes failing windows job) 2021-03-10 10:40:41 +02:00
Joe Conigliaro
fd2845e955
v.util: change naming behaviour for modules relative to working dir. closes #9138 2021-03-10 16:28:06 +11:00
Delyan Angelov
96a9e16e64
checker: allow a := [5*kb]byte{} where kb is a compile time known const too 2021-03-09 20:21:36 +02:00
Delyan Angelov
26cfd0eda9
checker: eval const a = 1024 * 1024 and other simple integer expressions at compile time 2021-03-09 20:07:08 +02:00
spaceface
f1469a8761
checker: allow accessing fields common to all sumtype members (#9201) 2021-03-09 19:16:18 +02:00
yuyi
c4b0fdcbaf
cgen: fix for_in fixed_array of fixed_array literal (#9206) 2021-03-09 16:18:07 +02:00
yuyi
e67ce5ea7b
cgen: fix error of alias interpolation (#9209) 2021-03-09 13:25:31 +02:00
Ned Palacios
114a7db6e5
vdoc: fix symbol filtering (#9210) 2021-03-09 13:05:50 +02:00
zakuro
00399b49ab
v.util: add util.tabs() (#9211) 2021-03-09 13:03:25 +02:00
Vassilis Panagiotopoulos
b893373e63
cgen: make .alias fields in structs use their proper string format, instead of the default %d (#9197) 2021-03-08 23:36:59 +02:00
Delyan Angelov
d7049ae2da
os: deprecate os.exec (returning ?os.Result), in favour of os.execute, which returns os.Result (#8974) 2021-03-08 20:52:13 +02:00
yuyi
10c9f61d61
checker: check empty map invalid syntax (fix #9162) (#9186) 2021-03-08 19:48:17 +02:00
yuyi
568faeed77
cgen: add `expr_string() and remove redundant codes (#9188) 2021-03-08 12:46:39 +02:00
yuyi
f2e570d63c
tests: add for tests of labelled continue and break (#9189) 2021-03-08 12:45:12 +02:00
Delyan Angelov
33bd22eda9
vlib/v/gen/tests: remove obsolete generation tests (used during the AST migration from v1 to v2) 2021-03-07 18:47:58 +02:00
pancake
ed9ca0b7bd
build: add address sanitizer make target (#9044) 2021-03-07 16:44:54 +01:00
zakuro
4c3ce97763
parser: fix Enum.value when Enum is an imported symbol (#9046) 2021-03-07 16:44:38 +01:00
Miccah
a1e0f2bc46
gen: add argument names to compile-time method struct (#9174) 2021-03-07 14:28:43 +01:00
yuyi
1b47e2953d
checker: check undefined ident of struct (#9164) 2021-03-07 14:09:38 +01:00
Delyan Angelov
f1c4e962f4
tests: add tests for -d debug, -cg, -g in combination for [if debug]fn etc 2021-03-07 12:42:30 +02:00
Delyan Angelov
64bc2fb40a
v: fix [if debug] fn abc(){} ... abc() 2021-03-07 12:05:07 +02:00
Delyan Angelov
c15de57f0f
tests: simplify the profile_test.v example program to not use net
(avoids unrelated openssl dependency)
2021-03-07 12:05:06 +02:00
Delyan Angelov
d0b89c5675
tests: rename for_c_multi_vars.v to for_c_multi_vars_test.v 2021-03-07 12:05:06 +02:00
yuyi
82085b0140
cgen: fix for_in map of fixed_array (#9133) 2021-03-07 11:41:08 +02:00
zakuro
45d51c76da
v.util: add an iabs(x) helper (#9172) 2021-03-07 11:24:05 +02:00
Lukas Neubert
6048d0e974
fmt: fix backslash doubling in attribute string args (#9175) 2021-03-07 09:44:58 +02:00
Lukas Neubert
053d6870d2
fmt: respect user choice of empty lines between type declarations (#9135) 2021-03-06 21:05:55 +02:00
Lukas Neubert
fdcfe397d4
fmt: write empty or blocks the same as empty fn bodies, empty structs, etc (#9136) 2021-03-06 21:04:51 +02:00
Lukas Neubert
043c29cf95
fmt: fix string interpolation with CastExpr (#9137) 2021-03-06 20:47:19 +02:00
zakuro
7333b1706c
checker: minor cleanup: clear_flag(.optional) in check_expr_opt_call (#9139) 2021-03-06 20:42:34 +02:00
zakuro
b83530e0ed
fmt: extract part of fmt.v into struct.v (#9141) 2021-03-06 20:40:44 +02:00
Lukas Neubert
7f7f9dca6b
parser,fmt: fix regression with non-void arrays in if conditions (#9161) 2021-03-06 20:39:38 +02:00
Delyan Angelov
849cde245c
v: support dump(expr) (#9160) 2021-03-06 18:09:28 +01:00
yuyi
c802515e71
cgen: minor optimization in gen_code buffer init (#9143) 2021-03-06 12:03:38 +02:00
Delyan Angelov
fa530683c7
v: fix warnings for v self 2021-03-05 17:24:00 +02:00
Alexander Medvednikov
845e8decce x64: basic mach-o and arm64 support 2021-03-05 17:52:39 +03:00
Joe Conigliaro
818be80581
parser: fix [] in if expr. closes #9131 2021-03-06 01:43:34 +11:00
joe-conigliaro
2d73411396
checker: define missing C fn args & check C & JS args (#8770) 2021-03-05 17:41:11 +03:00
Lukas Neubert
ead2ba6004
fmt: proper single line check for ConcatExpr (#9121) 2021-03-05 15:36:49 +03:00
yuyi
cbbfb460a7
cgen: fix for_in fixed_array (#9129) 2021-03-05 15:35:09 +03:00
zakuro
9ba312066e
fmt: extract type decls code into functions to cleanup (#9126) 2021-03-05 15:34:51 +03:00
Delyan Angelov
0f042124cb
tests: support fn test_fn() ? { opt()? } 2021-03-05 14:18:21 +02:00
yuyi
f4c03e8ed8
cgen: minor optimization in for_in_array (#9127) 2021-03-05 07:58:09 +02:00
Lukas Neubert
80356edd8c
fmt: combine simple attributes into a single line (#9120) 2021-03-05 07:17:57 +02:00
Gal Pasternak
208cabc994
checker: fix generic type ignores implemented interface (#9124) 2021-03-05 06:59:18 +02:00
Delyan Angelov
6da66226e5
vfmt: keep mut: in interface declarations (#9053) 2021-03-04 15:30:30 +02:00
zakuro
4f02da00ba
checker: check arguments count of sort (#9105) 2021-03-04 15:22:47 +02:00
Leah Lundqvist
65e888230a
jsgen: object equality checks, optimise casting and start builtin implementation (#9068) 2021-03-04 14:02:16 +01:00
yuyi
6097045b46
cgen: minor cleanup of cgen.v (#9108) 2021-03-04 14:40:57 +02:00
pancake
c65d65a3f5
v: use dash instead of lowerdash for -print-v-files (#9111) 2021-03-04 14:38:05 +02:00
Delyan Angelov
eb1e1afbc1
ci: fix failing fn_trailing_arg_syntax_keep.vv 2021-03-04 13:05:14 +02:00
yuyi
7c893895d8
cgen: minor cleanup in infix_expr() (#9086) 2021-03-04 12:50:18 +02:00
zakuro
6b2c7fd53e
fmt: remove tail space when using multiline short arg (#9110) 2021-03-04 12:44:50 +02:00
Lukas Neubert
8ce53b8b55
fmt: prevent code corruption with struct update syntax as trailing function arg (#9091) 2021-03-04 12:44:17 +02:00
Lukas Neubert
28fc91acb7
fmt: minor cleanups (#9090) 2021-03-04 12:43:11 +02:00
spaceface
7663f826e5
cgen: add auto str method generation for interfaces (#9095) 2021-03-04 12:41:42 +02:00
yuyi
5f9af3f594
cgen: fix for_in array of fixed_array (fix #9098) (#9099) 2021-03-04 12:39:39 +02:00