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

275 Commits

Author SHA1 Message Date
Delyan Angelov
517c1841c1
time: fix .sleep() with -gc boehm 2021-03-20 16:24:46 +02:00
joe-conigliaro
2d73411396
checker: define missing C fn args & check C & JS args (#8770) 2021-03-05 17:41:11 +03:00
Enzo
3e5a0dfc94
time: minor cleanup of operators (#9097) 2021-03-03 23:56:14 +01:00
Alexander Medvednikov
e6b4f9ff09 time: fix sleep() on windows 2021-02-27 20:53:27 +03:00
Alexander Medvednikov
3a2d696fac time: time.wait() => time.sleep() 2021-02-27 20:41:06 +03:00
zakuro
ac4791045f
time: consolidate the different sleep functions into time.wait(Duration) (#8853) 2021-02-21 17:05:03 +02:00
Swastik Baranwal
ad162cd6fc
checker: stricter unknown type checks, show better suggestions (#8816) 2021-02-19 11:23:13 +02:00
Nick Treleaven
ea803113c3
checker: check unsafe V function calls (#8752) 2021-02-14 19:31:42 +01:00
Swastik Baranwal
7ec116d588
all: only allow defining == and < and auto generate !=, >, >= and <= (#8520) 2021-02-03 15:18:38 +01:00
zakuro
e30e794884
checker: add check for using a private const in another module (#8501) 2021-02-03 10:17:13 +02:00
Lukas Neubert
d660f2cc6f
fmt: insert newline after last HashStmt (#8482) 2021-02-01 14:50:41 +01:00
yuyi
1be7cc14d3
checker: check duplicate of a const name (#8396) 2021-01-28 18:34:55 +01:00
Lukas Neubert
75d85403a6
fmt: better ternary concat wrapping (#8379) 2021-01-28 11:23:48 +01:00
Delyan Angelov
dbaccd4272
vfmt: shorten main.const_name to just const_name 2021-01-25 20:57:33 +02:00
Delyan Angelov
728344ff65
ci: fix v test-cleancode 2021-01-25 12:55:01 +02:00
Alexander Medvednikov
8bcb6c10cc checker: remove duplicate const error; fmt: force full path to consts 2021-01-24 10:01:13 +01:00
Lukas Neubert
8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
Daniel Däschle
dbf84520f1
all: update assoc syntax (#8274) 2021-01-22 23:24:48 +01:00
Lukas Neubert
ac2c3847af
all: update copyright to 2019-2021 (#8029) 2021-01-18 13:20:06 +01:00
Delyan Angelov
2677fcdf0c
time: add some tolerance for windows's minimum 1ms sleep resolution 2021-01-17 19:16:08 +02:00
Delyan Angelov
349eb95a28
time: comment .local() in time_windows.c.v too 2021-01-13 21:27:30 +02:00
crthpl
70ad49e186
time: complete doc (#8070) 2021-01-13 16:30:54 +02:00
zakuro
33694665f0
fmt: align each contiguous field of struct. not the whole. (#7981) 2021-01-12 04:38:43 +01:00
yuyi
a1c67232d0
checker: fix duplicate variable name (fix #265) (#7982) 2021-01-10 21:41:29 +01:00
Swastik Baranwal
8f4238e76a
time: use operator overloading for >= and <= (#8009) 2021-01-10 21:05:05 +01:00
Swastik Baranwal
7c290a7fe8
time: use operator overloading (#7882) 2021-01-05 12:43:34 +02:00
yuyi
52521554ce
time: fix parse_iso8601 on windows (#7853) 2021-01-04 18:26:21 +02:00
Alexander Medvednikov
13f16b4a82 time: rename to_local_time() to local(); time.offset() 2020-12-26 02:10:47 +01:00
Delyan Angelov
270ba07e83 clipboard: add a clipboard.x11 submodule, use it by default; add a clipboard.dummy for solaris 2020-12-25 19:34:21 +02:00
Lukas Neubert
8cd74df2f3
vfmt: keep UnsafeExpr linebreacks as set by developer (#7558) 2020-12-25 16:52:16 +02:00
spaceface
214290d55b
fmt: add a space around single-line unsafe expressions (#7505) 2020-12-23 19:13:42 +01:00
Lukas Neubert
304aafdc50
fmt: add a space after + operator/method overload (#7453) 2020-12-21 21:20:00 +02:00
zakuro
c639dd03d0
time: move - operator to operator.v (#7433) 2020-12-21 09:28:00 +01:00
zakuro
c69947160b
time: change type of duration constants from i64 to Duration (#7435) 2020-12-21 09:27:06 +01:00
zakuro
6a74058190
time: make parse_iso8601 support a date only format (#7277) 2020-12-16 13:10:02 +02:00
Uwe Krüger
591e523cf3
time: fix date parsing tests in winter for regions using DST (#7304) 2020-12-14 05:01:58 +01:00
zakuro
df27a2b8d2
time: add test_parse_is8601_invalid (#7278) 2020-12-12 11:00:07 +01:00
zakuro
5fec0d785a
time: fix timezone problems of parse_iso8601 (#7272) 2020-12-12 09:19:03 +01:00
Takahiro Yaota
eb48208599
time: Time.add (#7262) 2020-12-12 04:22:30 +01:00
Denis
a26e1e6e13
time: fix typo (#7274) 2020-12-11 19:30:34 +01:00
Takahiro Yaota
a2f7e0636d
time: - operator overloading (#7259) 2020-12-11 06:54:23 +01:00
Delyan Angelov
ada02d4498
time: fix failing test_iso8601_parse_utc 2020-12-09 15:48:21 +02:00
Takahiro Yaota
036e762446
time: make parse_iso8601 support format without microseconds (#7176) 2020-12-08 17:53:54 +01:00
Takahiro Yaota
b5982b638a
time: fix typo in test (#7174) 2020-12-07 17:21:12 +01:00
Takahiro Yaota
0c50f0c9dc
time: v fmt (#7160) 2020-12-06 15:19:39 +01:00
ka-weihe
9367dcda10
all: fix remaining c warnings and add -Werror to CI (#7021) 2020-11-29 21:23:37 +02:00
Takahiro Yaota
49a083fe79
time: improve parse_iso8601 (#7006) 2020-11-29 10:38:14 +02:00
spaceface777
a9e9554b11
all: fix most C warnings (#6758) 2020-11-06 16:26:59 +02:00
Daniel Däschle
d5a421e3f5
checker: add alias cast type check (closes #6705) (#6709) 2020-11-02 01:17:35 +01:00
Delyan Angelov
0c192cfd64 tests: fix warnings when doing ./v -W -progress -check-syntax test-fixed 2020-10-26 14:41:57 +02:00
Enzo
b083f4014b
fmt: fix multiple things and format most of the compiler (#6631)
Format expressions inside string interpolation like the rest (it used to be a+b instead of a + b, not too sure why)
Fix formatting some match branches when there were only one statement inside (it was inlined)
Fix parsing and formatting some comments edge case on struct field init. You should check out this test because the result is a bit different from before. I personally find it more logical but I would understand if the former format was to stay
Fix formatting of void-returning function signature
2020-10-15 22:12:59 +02:00
Alexander Medvednikov
7da1afa140 all: switch to the new fn arg syntax everywhere; add lots of vfmt -verify tests 2020-10-15 12:32:28 +02:00
Delyan Angelov
3c48a6e4ce tests: rename _test.v files with dup names (temp workaround for highly parallel testing) 2020-10-14 18:25:26 +03:00
Alexander Medvednikov
1123b8259a time: vfmt time/parse.v 2020-10-08 16:59:43 +02:00
spaceface777
b44620d065
time: use linux high-precision timers on Android as well (#6476) 2020-09-25 18:02:02 +03:00
Daniel Däschle
abc98c273c
parser: require assign on type alias (#6477) 2020-09-25 12:02:32 +02:00
Alexander Medvednikov
624f22e27e all: mutability check (part 1); enable mutable sumtype args 2020-09-22 05:28:29 +02:00
Delyan Angelov
e2e683199d time: do not panic on time.new_time({unix: 1608854400}).str() 2020-09-16 22:14:02 +03:00
Alexander Medvednikov
03327e5161 time: minor fixes + vfmt 2020-09-10 13:26:01 +02:00
Uwe Krüger
c3cdfa1c96
sync/channels: provide `try_push(), try_pop() as public methods (#6101) 2020-08-10 18:06:42 +02:00
Alexander Medvednikov
adafd24819 gen: auto_str_methods.v 2020-08-01 16:36:12 +02:00
penguindark
7d52d612ce
rand: add rand.ulid() (#5979)
* removed debug println

* added newline to the end of the file

* time: add .unix_time_milli() method; rand,time: add tests

* rand: add more ulid tests; move tests to a separate file random_identifiers_test.v

* run vfmt over vlib/rand/random_identifiers_test.v

* speed up time.unix_time_milli

* simplify and speedup time.unix_time/0 and time.new_time/1

* update comment about rand.ulid()

* fix terminating 0 off by 1 issue in rand.ulid()

* optimize time.new_time()

* restore the master version of vlib/time/parse.v

* make test_unix_time more robust

Co-authored-by: Delyan Angelov <delian66@gmail.com>
2020-07-26 13:10:56 +03:00
Delyan Angelov
8f23accc4e time: add .format_ss_milli and .format_ss_micro methods 2020-07-21 11:58:33 +03:00
Nick Treleaven
a74cbf55c7
checker: warn if C.m* or C.s* functions are called outside unsafe blocks (#5869) 2020-07-20 20:06:41 +03:00
Uwe Krüger
8df6e59678
sync: add semaphores (#5831) 2020-07-15 10:22:33 +02:00
ka-weihe
df45488e09
cgen: fix warnings (#5820) 2020-07-14 00:16:31 +02:00
Delyan Angelov
78e1127d99
cgen: treat the main module like any other v module 2020-07-01 00:53:53 +02:00
Louis Schmieder
616b07204d
vweb: add cookies with expire date 2020-06-29 21:14:36 +02:00
spaceface777
5f21b152a7
tcc: support tcc on Windows 2020-06-14 23:15:12 +02:00
Alexander Medvednikov
7750ce5f60 time: fix relative() 2020-06-12 15:28:28 +02:00
Alexander Medvednikov
72fdb09e46 time: relative_short(); fmt: handle $vweb.html() 2020-06-11 20:26:49 +02:00
Tomas Hellström
2dc547a45c
time: fix iso8601 parser and utc time 2020-06-10 11:14:55 +02:00
Hungry Blue Dev
e649cf84e3
rand: reorganize: phase 2 2020-06-09 15:06:07 +02:00
Enzo Baldisserri
11b7b97311
parser: fail when assigning to _ with := 2020-06-08 00:47:04 +02:00
Tomas Hellström
9c8769503f
time: add microsecond precision to Time struct 2020-06-07 16:19:09 +03:00
Uwe Krüger
076089d3c5
checker: apply stricter type checks to function args and return types 2020-06-01 21:15:59 +02:00
Delyan Angelov
ae8f7cf569 tests: fix some tests, that failed due to the stricter immutable checks 2020-06-01 18:24:38 +03:00
JalonSolov
b7dc5b2f7b
stopwatch: auto_start option, make pause cumulative 2020-05-30 10:20:54 +03:00
Uwe Krüger
013fdb8a4b
checker: restrict numeric promotions to cases where no data is lost 2020-05-27 05:42:48 +02:00
Uwe Krüger
fd4d28b7b6
tests: update for stricter type checks 2020-05-24 21:07:32 +02:00
Alexander Medvednikov
03525843a0 parser: do not allow calling private functions 2020-05-18 22:54:11 +02:00
Uwe Krüger
2635be511f
all: re-apply C++ support 2020-05-18 21:38:06 +02:00
Alexander Medvednikov
07a78b2843 Revert "all: C++ compiler support"
This reverts commit 9a237c3e82.
2020-05-18 17:05:48 +02:00
Uwe Krüger
9a237c3e82
all: C++ compiler support 2020-05-18 15:51:36 +02:00
yuyi
7f4cf08516
parser: check (mut f Foo) syntax 2020-05-17 13:51:18 +02:00
pancake
b5bf0eeac5
time: add .no_delimiter format option 2020-05-08 21:23:26 +03:00
Delyan Angelov
ddb5a8e6e4 time: add specialized vpc_now_darwin to fix -os cross 2020-05-05 17:31:21 +03:00
Delyan Angelov
59525c8c93 tests: fix missing ? after v fmt run 2020-05-01 12:01:30 +03:00
Delyan Angelov
84785bbb59 tests: fix msvc transient failures when sleep_ms takes longer 2020-05-01 11:58:56 +03:00
Delyan Angelov
3608c81cb9 time: add stopwatch_test.v 2020-05-01 10:21:15 +03:00
Enzo Baldisserri
682838a0cf
checker: check array and fields mutability 2020-04-27 22:53:26 +02:00
Delyan Angelov
e523540f3a profile: use specialized time__vpc_now 2020-04-26 22:14:54 +03:00
Enzo Baldisserri
3e68e429b6
checker: avert if else is unnecessary 2020-04-25 21:51:44 +02:00
Delyan Angelov
d6899788dd time: add back vlib/time/time_linux.c.v 2020-04-24 15:28:16 +03:00
Delyan Angelov
117ec722a2 time: remove temporary time__linux.c.v workaround 2020-04-24 09:12:34 +03:00
Delyan Angelov
20637ae54c time: restore building v on linux, till v.c is regenerated with -os cross 2020-04-24 09:00:07 +03:00
Major Taylor
25f2b171fc
time: Timer -> StopWatch; time.Duration 2020-04-24 07:33:25 +02:00
Major Taylor
be0a8794c2
time: add Timer; refactor benchmark to use Timer 2020-04-19 03:40:32 +02:00
lutherwenxu
dc4db87be3
vlib: use new filename format 2020-04-11 19:51:32 +02:00
Alexey
1fde205f97
time: return optional value directly 2020-04-11 18:56:39 +02:00
Daniel Däschle
b0dacef32b
time: change unix timestamp to u64 2020-04-07 03:35:47 +02:00
yuyi
8ba6e45d83
time: fix unix_time 2020-04-04 12:10:56 +02:00
joe-conigliaro
d048bf66b0
cgen: optimize/generalize typ method 2020-04-01 00:18:25 +11:00
Alexey
cedf185b41
v2: fix Windows errors 2020-03-28 10:19:38 +01:00
Alexander Medvednikov
473d9fef55 checker: do not allow extra () in if conditions 2020-03-27 14:57:19 +01:00
yuyi
2efc37947d
time: calc_unix => unix_time 2020-03-22 19:43:59 +01:00
radare
c21e976cad
builtin: do not use unsafe sprintf/vsprintf functions 2020-03-21 06:37:58 +01:00
Alexander Medvednikov
4b36098e07 cgen: 1 error left 2020-03-20 20:35:00 +01:00
Delyan Angelov
f89f83deb6
solaris: _solaris.v and #flag solaris (stage 1) 2020-03-20 20:20:01 +01:00
Alexander Medvednikov
b7a036945d cgen: in [] optimization 2020-03-19 16:12:49 +01:00
Alexander Medvednikov
b2f05e56b8 cgen: fix tests 2020-03-19 11:23:05 +01:00
Joe Conigliaro
147ecc5e17 v2: time - prefix C struct & ast.TypeName to ast.Type 2020-03-04 01:06:21 +11:00
spaceface777
ef8c1203b4
cleanup: replace C for loops with range 2020-02-24 17:55:16 +01:00
Alexander Medvednikov
8f9979eb8d fix time_windows.v 2020-02-07 23:11:15 +01:00
Alexander Medvednikov
d66bc24e7f remove as casts for basic types 2020-02-07 22:10:48 +01:00
Alexander Medvednikov
9034b1fd08 v2: match cgen; use as for casting 2020-02-07 14:50:52 +01:00
Alexey
65744207fc
time: reorganize module 2020-02-06 14:19:44 +01:00
Alexey
91e181b14a
time: return optional value in parse and parse_iso functions 2020-02-06 10:22:00 +01:00
Alexey
a61c9c617d
time: use _mkgmtime and timegm to calculate unix time 2020-02-05 06:13:11 +01:00
Alexander Medvednikov
80daaff874 v2: scopes, or, in, hex 2020-02-04 17:44:39 +01:00
vitalyster
21b54723e4
time: fix timezone 2020-02-04 12:17:04 +01:00
Delyan Angelov
7b18e5d198 compiler: add 'use -- instead of -= 1' 2020-01-23 21:09:47 +01:00
Shun Sakai
c8c43a2475 update copyright year 2020-01-23 21:04:46 +01:00
nsauk
84438c0139 time: add str() 2020-01-20 15:06:15 +01:00
Swastik Baranwal
26374971ab time: fix logic 2020-01-14 18:12:28 +01:00
Delyan Angelov
6d30697d9b time: move time.random() to time.misc module
avoids importing rand to programs that do not need pseudo random generation).
2020-01-07 12:58:24 +01:00
Alexander Medvednikov
2f8969c604 time: Windows fix 2020-01-01 12:01:03 +01:00
Alexander Medvednikov
87cff0386c time: gmt offset; macos syscalls 2020-01-01 10:09:19 +01:00
sh0f
3c17851200 time: add test for #3291 2020-01-01 08:00:23 +01:00
sh0f
a99f214a0f time: fix error: array index out of range 2020-01-01 07:27:48 +01:00
Alexander Medvednikov
4d31d5882d x64, v2 backends 2019-12-31 19:42:16 +01:00
lutherwenxu
286a0a1371 time: rewrite unix() function 2019-12-31 17:11:47 +01:00
Alexander Medvednikov
da5fb5dcbd Revert "x64, v2 backends"
This reverts commit 81ae54d9bd.
2019-12-31 13:23:12 +01:00
Alexander Medvednikov
81ae54d9bd x64, v2 backends 2019-12-31 13:21:22 +01:00
yatsen1
137a473bb7 add time.parse_iso 2019-12-23 13:36:51 +03:00
yatsen1
d03f0ec294 fix time.parse() 2019-12-23 13:25:44 +03:00
Alexey
dacc129fd8 time: improve tests 2019-12-22 22:58:41 +03:00
Alexander Medvednikov
6210984c97 run vfmt 2019-12-20 02:09:56 +03:00
Alexander Medvednikov
f51784ee01 remove unnecessary casts everywhere 2019-12-07 15:51:00 +03:00
Alexander Medvednikov
b2b34e18e4 use the new &C.Foo(0) cast 2019-12-04 12:19:32 +03:00
Alexander Medvednikov
81d4f66fbb string: make index() return ?int instead of int/-1 2019-11-30 13:21:21 +03:00
Alexander Medvednikov
b38283dcf1 string: make left/right private 2019-11-30 12:06:17 +03:00
kevin70g
5536eb581c time: C.timeval struct member definitions fix 2019-11-19 18:28:29 +03:00
Nicolas Sauzede
1dadf9d966 fix Windows warnings 2019-11-16 02:30:50 +03:00
Alexander Medvednikov
ffa6bcfff5 vfmt: handle comments 2019-11-13 11:54:22 +03:00
Alexander Medvednikov
f30d0ce667 parser: fix a bug with complex ref fn args 2019-11-11 04:56:13 +03:00
Enrico Lefass
a691cc857e time: add new public functions for formatting 2019-11-01 02:13:03 +03:00
joe-conigliaro
59378dce46 compiler/vlib: replace substr/left/right with [start..end] everywhere 2019-10-27 10:03:15 +03:00
Mihael Dimoski
b6fa252fc9 time: make Time struct public 2019-10-25 22:04:25 +03:00
Enrico Lefass
fcead2f79e time: squash three occasions of const(...) into one 2019-10-23 08:41:16 +03:00