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

12240 Commits

Author SHA1 Message Date
yuyi
17b576227f
checker: change 'fail_if_immutable(expr_ ast.Expr)' to 'fail_if_immutable(mut expr ast.Expr)' (#18811) 2023-07-07 23:27:52 +03:00
kbkpbot
b3a6b73306
eventbus: add generic support for event name (#18805) 2023-07-07 22:33:57 +03:00
yuyi
97a726b188
cgen: fix nested or expr call (fix #18803) (#18807) 2023-07-07 22:06:10 +03:00
Felipe Pena
7fe794a974
json: fix option alias support (#18801) 2023-07-07 22:03:41 +03:00
encyclopaedia
e7e5a07aa2
arrays: add more util functions and tests for them - find_first, find_last, join_to_string (#18784) 2023-07-07 06:52:08 +03:00
okk
7d6e15fa66
net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804) 2023-07-07 06:50:20 +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
Felipe Pena
de392003be
cgen: fix code generation for array.clear (#18792) 2023-07-07 00:28:06 +03:00
yuyi
11f06e41c0
ast: clean up in types.v (#18793) 2023-07-07 00:27:21 +03:00
yuyi
2d838d5178
v: use autocasting in complex conditions (#18797) 2023-07-06 19:18:57 +03:00
yuyi
b3f89e1417
ast: minor simplification of new_table() (#18795) 2023-07-06 13:51:46 +03:00
Felipe Pena
8f7f2c8cf7
checker: fix try_pop with fixed array (#18789) 2023-07-06 02:34:22 +03:00
Delyan Angelov
d851ecffb7
parser: fix anonymous fns parameter checks, behaving differently than named fns (fix #18779) (#18785) 2023-07-06 02:30:26 +03:00
shove
cd6330e218
parser: fix compiler error when match returns reference (#18728) (#18783) 2023-07-05 23:28:58 +03:00
Felipe Pena
072364fc59
checker: fix interface param resolution (#18780) 2023-07-05 23:26:44 +03:00
yuyi
4a196989a9
doc: cleanup with 'mut expr ast.Expr' (#18787) 2023-07-05 23:26:02 +03:00
Delyan Angelov
aa61fcb3dc
orm: fix inserting sequential values (id=0), in tables with an i64 primary field (#18791) 2023-07-05 23:25:22 +03:00
yuyi
7f8749afdd
checker: change 'expr(expr_ ast.Expr)' to 'expr(mut expr ast.Expr)' (#18781) 2023-07-05 17:02:22 +03:00
Eliyaan (Nopana)
b0323c79ad
native: move for_in_stmt to stmt.v (#18705) 2023-07-04 22:43:23 +03:00
Felipe Pena
578264c815
checker: fix comptime selector evaluate when checked against type of array (#18774) 2023-07-04 22:42:55 +03:00
yuyi
5fd0338399
checker: change smartcast(expr_ ast.Expr,..) to smartcast(mut expr ast.Expr,..) (#18777) 2023-07-04 16:29:11 +03:00
Felipe Pena
52ddefbdc5
checker: fix comptime evaluation is/!is operator with typenode (#18773) 2023-07-04 16:28:35 +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
Felipe Pena
5d269ba703
cli: fix custom help without execute handler (#18732) 2023-07-04 06:48:53 +03:00
yuyi
7279e49077
checker: clean up in assign_stmt() (#18759) 2023-07-04 06:48:01 +03:00
phoebe
2fb561ba7f
checker, cgen: allow comptime ident is array of types (#18765) 2023-07-04 06:45:30 +03:00
phoebe
1db67f7505
checker: allow no return in compile_error else block (#18758) 2023-07-04 06:44:24 +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
Felipe Pena
3f5995ace8
cgen: fix regression with unalised naming conflict with C interop (#18752) 2023-07-03 23:12:20 +03:00
yuyi
c1550b3efa
ast, checker: change stmt(node_ ast.Stmt) to stmt(mut node ast.Stmt) (#18756) 2023-07-03 23:10:00 +03:00
Swastik Baranwal
ab258aebfb
checker: disallow invalid prefix on left side of assign stmt (#18750) 2023-07-03 18:54:23 +03:00
yuyi
df3c85eb36
checker: use autocasting in complex if conditions (#18753) 2023-07-03 11:03:05 +03:00
Mark aka walkingdevel
c48ae86132
cgen: fix autofree inserting string declarations for multiple functions calls (#18723) 2023-07-03 08:01:55 +03:00
phoebe
e01d973c27
checker: fix comptime "ident is type" (#18747) 2023-07-03 08:01:34 +03:00
yuyi
ad1d5e7adb
cgen: remove 'mut mut_table := unsafe { &ast.Table(g.table) }' (#18742) 2023-07-02 23:54:44 +03:00
yuyi
fd6983fcb4
checker: fix autocast in complex if condtions 4 (#18744) 2023-07-02 23:54:17 +03:00
Ikko Eltociear Ashimine
c75382ad23
term: fix typo in term_windows.c.v (#18745) 2023-07-02 23:53:56 +03:00
Herman
af38f8b3ba
channels: refactor the channel_select function (#18711) 2023-07-02 15:45:30 +03:00
Felipe Pena
329e063752
checker: fix wrong interface parameter resolution for anonymous fn (#18724) 2023-07-02 14:18:53 +03:00
Spydr
f3942417c4
native, builder: enable processing of .v files in the builtin module (for now most functions there are blacklisted) (#18735) 2023-07-02 14:16:15 +03:00
Swastik Baranwal
0ce3e46823
checker: disallow assigning nil to struct fields (#18725) 2023-07-02 14:04:28 +03:00
yuyi
44a6741bc3
ast, checker: change check(ast.file &ast.File) to check(mut ast.file ast.File) (#18729) 2023-07-02 09:41:04 +03:00
Turiiya
a27f2ddcc3
term.ui, vweb, v: update deprecated functions (#18726) 2023-07-02 09:38:33 +03:00
yuyi
5d4c2cd832
v: use autocasting in complex conditions (#18731) 2023-07-02 09:23:15 +03:00
Felipe Pena
29c8aaeb89
cgen: fix selector code to use interface method table on closure when needed (#18736) 2023-07-02 06:54:52 +03:00
Alexander Medvednikov
e407579e99 V 0.4 2023-07-01 13:50:33 +03:00
yuyi
049fa3c70f
cgen: minor cleanup in ref_or_deref_arg() (#18713) 2023-07-01 12:07:53 +03:00
yuyi
36577eed09
checker: fix autocast in complex if conditions 3 (#18715) 2023-07-01 12:07:17 +03:00
Isaiah
20c6d87fd4
fmt: fix formatting of imported static methods (#18720) 2023-07-01 12:04:52 +03:00
Spydr
ee429bb51d
native: increase support for ast.Alias and ast.TypeOf (#18722) 2023-07-01 11:39:39 +03:00
Alexander Medvednikov
015ccc2a7f V 0.3.5 2023-06-29 22:16:34 +03:00
Subhomoy Haldar
7ab11097be
rand: fix edge case, when bit length is 31 and 63, add tests for rand.intn(2147483647)! etc (#18714) 2023-06-29 22:11:27 +03:00
Alexander Medvednikov
cf323cd0ef Revert "checker: fix autocast in complex if conditions 3 (#18710)"
This reverts commit e74723c1e7.
2023-06-29 21:37:11 +03:00
Turiiya
357a4a00bf
checker: fix generic infix expr type mismatch error (#18706) 2023-06-29 21:32:21 +03:00
yuyi
e74723c1e7
checker: fix autocast in complex if conditions 3 (#18710) 2023-06-29 21:31:40 +03:00
Spydr
c4ba47a131
native: inital support for aliased types (#18703) 2023-06-29 21:30:48 +03:00
yuyi
f122703a43
v: use autocasting in if conditions inside the compiler (#18708) 2023-06-29 19:37:36 +03:00
Alexander Medvednikov
85160923b6 changelog: 0.3.5 (p. 1) 2023-06-29 19:28:38 +03:00
yuyi
60f9f53e36
checker: fix autocast in complex if condtions 2 (#18702) 2023-06-29 07:01:21 +03:00
Mark aka walkingdevel
7ee25843c2
db.mysql: fix the support for TIMESTAMP columns (#18704) 2023-06-29 06:49:58 +03:00
Daniel Daudysh
f0fb86f76e
checker,orm: skip compile-time error msg for fields tagged with [skip] and [sql: '-'] (#18700) 2023-06-29 06:43:24 +03:00
Swastik Baranwal
499d0526fc
checker,orm: add compile error for unsupported field data types like field []int etc (#18537) 2023-06-28 13:40:36 +03:00
yuyi
2b2aca6eb7
checker: fix autocast in complex if condtions (#18699) 2023-06-28 13:37:20 +03:00
phoebe
735654296c
math.big: refactor big_test.v for scalability (#18696) 2023-06-28 13:35:13 +03:00
Felipe Pena
89c56fb5ee
parser, checker: fix static method naming and generic call (#18694) 2023-06-28 07:07:07 +03:00
Felipe Pena
83ee2827d4
cgen: fix alias to struct ptr on structinit (#18571) 2023-06-28 07:02:32 +03:00
Turiiya
b2ca3ac089
net.html: fix semantic inconsistencies of tag retrieving functions (#18558) 2023-06-27 20:10:31 +03:00
phoebe
1bae9e4538
math.big: minor gcd improvements/fixups and internal rsh_to_set_bit (#18569) 2023-06-27 20:09:22 +03:00
yuyi
8508c552d2
checker: implement autocast in if conditions (#18573) 2023-06-27 20:08:50 +03:00
Swastik Baranwal
e48b55fc80
checker: disallow Result type aliases (#18693) 2023-06-27 20:08:37 +03:00
Hitalo Souza
aeebb4f118
json2: small refactor (#16913) 2023-06-27 20:07:44 +03:00
Felipe Pena
d523bb0306
checker: fix missing check for taking address of literal value member (#18570) 2023-06-27 10:54:03 +03:00
yuyi
3558e05bfb
tests: fix reflection_sym_test.v (#18574) 2023-06-27 10:53:35 +03:00
Alexander Medvednikov
02c382569c gen.golang: fix anon fn 2023-06-27 02:17:09 +03:00
Alexander Medvednikov
21ccb9b48e doc: clarify new static type methods a bit 2023-06-27 01:38:31 +03:00
Alexander Medvednikov
d52bac8ee9 doc: document new static type methods 2023-06-27 01:31:56 +03:00
Casper Kuethe
21d9730cde
context, vweb: add ability to set and get values on vweb.Context (#18564) 2023-06-27 01:25:45 +03:00
Eliyaan (Nopana)
7a9c885b31
native: replace abs() with mathutils.abs() (#18568) 2023-06-27 01:25:12 +03:00
yuyi
a67342d05b
checker: minor cleanup in infix_expr() (#18567) 2023-06-27 01:24:46 +03:00
Alexander Medvednikov
a9f8b5dadc all: static type methods 2023-06-27 01:23:30 +03:00
Delyan Angelov
ec35d76574
cgen: cleanup return comments in generated code after dbd2517 (-32KB for v.c) 2023-06-25 09:51:32 +03:00
Felipe Pena
1ee83bf639
checker: disallow using Result !Type as a map[Key]!Type (#18543) 2023-06-25 09:51:10 +03:00
Spydr
31f68eea94
native: split codegen into multiple files and refactor assign statement generation (#18546) 2023-06-25 09:47:10 +03:00
Felipe Pena
e9960339f9
cgen: fix generic resolver on non generic function (#18381) 2023-06-25 09:07:14 +03:00
yuyi
84a5fd0051
cgen: minor cleanup for ast.clear_flags() (#18549) 2023-06-25 09:01:36 +03:00
Felipe Pena
34ac3269bc
cgen: fix initialising a map, using option type as value (#18540) 2023-06-25 01:55:42 +03:00
Felipe Pena
752e4c2e47
cgen, checker: allow a << none, where a is []?&int (#18539) 2023-06-24 20:54:49 +03:00
yuyi
11fa28edff
flag: fix finalize with multiple shortargs (#18544) 2023-06-24 20:35:44 +03:00
yuyi
3e3b289583
checker: check shared parameter assigning (fix #18525) (#18534) 2023-06-24 14:18:11 +03:00
kbkpbot
5f0ad64155
runtime: add new functions total_memory/0 and free_memory/0 (#18499) 2023-06-24 14:15:15 +03:00
Felipe Pena
2abd2e2c2a
cgen, checker: fix indexexpr with sumtype of array types (#18515) 2023-06-24 09:09:49 +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
Delyan Angelov
2c7643661e
time: small cleanup of parse_iso8601 comments, make the C.strftime declaratione forwards compatible 2023-06-24 08:01:57 +03:00
yuyi
f3e1859ee8
parser: fix multiple embedded external module interface (#18531) 2023-06-23 21:23:24 +03:00
Felipe Pena
9d77fd90bf
checker: fix missing check for diff type on map value declaration (#18522) 2023-06-22 22:48:15 +03:00
yuyi
68ba39084d
checker: check struct field init with result value (fix #18511) (#18514) 2023-06-22 22:40:11 +03:00
Swastik Baranwal
0b2e947e0c
parser: disallow multi else branches in match (#18526) 2023-06-22 22:39:35 +03:00
Delyan Angelov
0e4eea80ca
cgen: fix code generation for generic unions (#18513) 2023-06-22 22:39:05 +03:00
Casper Kuethe
a12e82aa15
stbi: allow customisation of number of channels in stbi.load (#18491) 2023-06-22 16:47:52 +03:00
yuyi
22bd1b9d55
ast: clean up ast.StructInit (#18518) 2023-06-22 16:41:08 +03:00
Turiiya
af4e113f6c
vweb: use <head> instead of <header> in the html templates (#18516) 2023-06-22 11:11:02 +03:00
Joe Koop
8b25c4c9a3
net.http: copy IANA's list of methods to the http.Method enum (#18508) 2023-06-22 09:31:34 +03:00
yuyi
76ae9dba5c
checker: check struct init with pointer field (fix #18485) (#18501) 2023-06-21 12:36:28 +03:00
squidink7
5006ffb304
time, x.json2: improve iso8601 time decoding (#18496) 2023-06-21 12:34:50 +03:00
yuyi
d7a50b4a22
builtin: minor cleanup in sorted_map.v (#18502) 2023-06-21 12:34:05 +03:00
Turiiya
867f4376d8
checker: abstract repetitive error handling (#18507) 2023-06-21 12:13:18 +03:00
yuyi
b61fdfa094
checker, cgen: fix generic method variable (#18509) 2023-06-21 12:09:53 +03:00
phoebe
4485f1ca1e
math.big: fix documentation for mod_inverse (#18494) 2023-06-20 14:31:04 +03:00
Felipe Pena
c657384f72
cgen: fix alias to option handling (#18490) 2023-06-20 11:55:25 +03:00
Turiiya
a7f00e7594
checker: add hint to sumtype cannot hold reference types error (#18486) 2023-06-20 11:54:57 +03:00
Felipe Pena
0232f074a8
cgen: fix alias eq method + map init with option (#18483) 2023-06-20 11:52:59 +03:00
l-m
15cb343065
picoev: support for freebsd (#18492) 2023-06-20 09:04:07 +03:00
Turiiya
958e456790
parser: fix match for array of reference sumtype (#18487) 2023-06-19 18:40:17 +03:00
yuyi
7c1ace02f3
checker: fix a bug checking generic closures (#18489) 2023-06-19 18:22:25 +03:00
Casper Kuethe
2bedb6ffd7
stbi: add a resize_uint8 function for resizing images in memory (#18484) 2023-06-19 18:14:26 +03:00
phoebe
a3f24caffc
math.big: add mod_inverse and improve big_mod_pow to allow for large exponents and moduli (#18461) 2023-06-19 17:59:49 +03:00
Turiiya
396d46d9ca
ast, builder, checker, parser: fix typos (#18480) 2023-06-18 22:36:17 +03:00
Turiiya
0454f43fa3
checker: fix error assigning generic function variable with generic struct return (#18472) 2023-06-18 22:22:22 +03:00
Delyan Angelov
017cc6738b
checker: add a hard to reach limit of 1_000_000 iterations for resolving all generics (usually <10 are enough) (#18477) 2023-06-17 22:29:36 +03:00
Turiiya
9c5aeb62b2
checker: disallow import names and import aliases, shadowing the module name (#18431) 2023-06-17 16:39:10 +03:00
yuyi
acfe785597
all: clean up with is_any_kind_of_pointer() (#18467) 2023-06-17 14:10:06 +03:00
Louis Schmieder
dbd251793e
all: add $res compile time function to get returned value in defer block (#18382) 2023-06-17 14:08:50 +03:00
yuyi
ac32d2a803
checker, cgen: fix if/match expr with continue or break in a branch (#18466) 2023-06-16 12:06:00 +03:00
Felipe Pena
d17f6f69cd
checker: fix missing check for unwrapped shift operation (#18451) 2023-06-16 09:49:24 +03:00
Felipe Pena
84cf448f2f
checker: fix enum max value validation (#18446) 2023-06-16 09:48:47 +03:00
yuyi
05f2798c88
ast: remove redundant method is_real_pointer() (#18453) 2023-06-16 09:48:24 +03:00
yuyi
073a651f7f
cgen: fix fn voidptr param calling with nonpointer rvalue (fix #18424) (#18462) 2023-06-16 09:48:12 +03:00
yuyi
1623cc3a51
fmt: fix functions with short arguments (fix #18398) (#18459) 2023-06-16 09:47:40 +03:00
Felipe Pena
ccb70b1292
checker: fix missing unwrap check for option to non-option argument (#18460) 2023-06-16 09:46:33 +03:00
Turiiya
5d0af69bfd
parser: fix dump removing empty lines (#18452) 2023-06-16 09:45:50 +03:00
Ethan Hansen
5001b17336
docs: add docstring for map.move() (#18430) 2023-06-16 09:45:16 +03:00
Felipe Pena
06583be9ec
cgen: fix fixed array of chan (#18438) 2023-06-16 09:44:53 +03:00
Turiiya
34163ae44b
checker: extend check assigning mut reference to immutable var in nested parens (#18442) 2023-06-15 02:07:25 +03:00
Turiiya
77a1f5928f
checker: include import aliases when checking for import duplicates (#18450) 2023-06-15 02:06:44 +03:00
yuyi
27b3303eeb
ast: clean up is_float()/is_float_valptr() (#18448) 2023-06-15 02:06:08 +03:00
Turiiya
bbd1027a04
fmt: remove all unnecessary parenthesis at once, instead of one pair at a time (#18441) 2023-06-14 15:05:50 +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
yuyi
3fb31b971d
checker: clean up method_call() (#18443) 2023-06-14 14:46:00 +03:00
Felipe Pena
23da2128d5
cgen: fix msvc packed attr (#18437) 2023-06-14 10:44:48 +03:00
yuyi
530f73b927
vlib/compress: correct comments in compress module (#18434) 2023-06-13 19:10:27 +03:00
Turiiya
2ca3046bf8
checker: disallow assigning mutable reference to immutable ParExpr (#18420) 2023-06-13 08:52:37 +03:00
Felipe Pena
ada702ec66
cgen: fix opt ptr argument passing with and without heap usage (#18423) 2023-06-13 08:51:42 +03:00
Alexander Medvednikov
24c09881f7 Revert "fmt: fix parens around reference module prefix expressions (#18416)"
This reverts commit 7f178d4662.
2023-06-13 08:50:50 +03:00
yuyi
126fbe8e33
scanner: fix indent error for line comment generated by vdoc (#18422) 2023-06-13 08:50:02 +03:00
Mark aka walkingdevel
f634f7b01f
mysql: connection fixes (#18428) 2023-06-13 08:49:41 +03:00
Turiiya
7f178d4662
fmt: fix parens around reference module prefix expressions (#18416) 2023-06-12 13:35:44 +03:00
phoebe
37386697a3
math.big: fix internal subtract_align_last_byte_in_place overflow (#18413) 2023-06-12 13:33:53 +03:00
Felipe Pena
54eabcb242
cgen: make the default values for all enums, be their first listed entry, even if it was enum MyEnum { first = 999 second}, not just the defaul 0 (#18388) 2023-06-11 21:57:36 +03:00
Swastik Baranwal
fc6726b2b1
checker: no notice for interface field initialized struct with ...other syntax (#18405) 2023-06-11 20:03:20 +03:00
Felipe Pena
2e9c469158
checker: fix external enum value resolution, i.e. enum { enum_value = C.VALUE } (#18401) 2023-06-11 19:08:45 +03:00