Commit Graph

961 Commits (870ed86afc4023d46ca2433285de20b4c2e5d088)

Author SHA1 Message Date
yuyi c0dcd1a9a5
ast: fix reference of alias char type (#12951) 2021-12-24 11:11:20 +02:00
Delyan Angelov e256f1b2aa
checker,cgen: stabilise generic method handling (fix a source code ordering issue) 2021-12-22 18:03:46 +02:00
penguindark 278c08704c
all: support slices with negative indexes `#[start..end]` (gated arrays) (#12914) 2021-12-22 16:34:02 +03:00
yuyi cd0b581445
ast: rename 'table.get_type_symbol()' to 'table.sym()' and more related calls (#12898) 2021-12-19 18:25:18 +02:00
Delyan Angelov 6ff953d936
preludes,builder,cgen: add support for VTEST_RUNNER=tap and -test-runner tap (#12523) 2021-12-16 15:59:46 +02:00
Delyan Angelov 2b981b011e
ast: fix bug in parsing `-Isomething -Danother` from #flag and #pkgconfig directives 2021-12-15 17:55:52 +02:00
Delyan Angelov df7f2aa8a3
all: support `[markused]` tags for fns/consts/globals 2021-12-15 14:34:49 +02:00
Delyan Angelov 3afbb9e90a
all: split all backends into cmd/tools/builders (#12811) 2021-12-12 22:10:43 +03:00
yuyi f407d6de02
ast, checker, cgen: fix generics multiple type comptime call (fix #12777) (#12806) 2021-12-12 19:42:40 +02:00
Delyan Angelov 79de408ef0
parser,checker: support `[generated] module xyz` (turns off notices). Use it for `infix.v`. 2021-12-12 00:58:38 +02:00
Thomas Mangin 0d0d7323bb
transformer: provide direct_memory_access to arrays when safe (#12724) 2021-12-11 21:55:46 +02:00
yuyi 9b4329d2f6
ast, checker, cgen: fix interface method with struct embed (#12783) 2021-12-10 14:56:13 +02:00
yuyi 7fc9e614a3
ast, parser, checker: fix generic fn in builtin module (#12769) 2021-12-09 21:37:43 +02:00
zakuro 7379488cee
fmt: fix bug that adds unnecessary module name to generic types (#12758) 2021-12-08 22:33:58 +02:00
crthpl 2fbf7fea75
all: initial interpreter code (#12605) 2021-12-08 11:09:10 +03:00
playX 1cb06a2de4
js: ast.GoExpr support using promises on JS backend (#12749) 2021-12-07 12:11:54 +03:00
Tim Basel c23ebec944
parser: support bool values in attributes (#12750) 2021-12-07 12:11:29 +03:00
yuyi 36fbd3c4fa
checker: check sumtype as mismatched type (#12743) 2021-12-07 01:31:47 +03:00
playX 105d7fcf75
js: support JS.await (#12726) 2021-12-05 13:33:53 +02:00
yuyi 2754368873
ast: correct comments of the find_field_from_embeds (#12723) 2021-12-05 06:21:39 +02:00
Leo Developer ace63594bf
all: support `$embed_file('embed.vv', .zlib)` (#12654) 2021-12-04 19:43:19 +02:00
yuyi 0f50ac3260
ast: cleanup struct embeds related methods (#12719) 2021-12-04 18:46:41 +02:00
yuyi 0cb4557a8d
ast, checker, cgen: fix nested struct embed method call (#12714) 2021-12-04 14:51:42 +02:00
yuyi 2d43fdb42a
ast, checker, cgen: fix nested struct embed error (fix #12659) (#12712) 2021-12-04 11:19:19 +03:00
Alexander Medvednikov eca78a2906 checker: allow infix expressions in enum declarations 2021-12-03 07:45:37 +03:00
Delyan Angelov 47aa2b1f93
all: fix casting of `string(MyString('abc'))` and `byte(MyByte(123))`; improve TypeSymbol handling (#12617) 2021-12-01 09:50:53 +02:00
yuyi 9825c7e06c
ast: fix generic sumtype of alias generic struct (#12611) 2021-11-29 15:12:00 +02:00
Delyan Angelov 6d97b0a407
checker: improve checking of a << b, when a and b are numbers (#12589) 2021-11-29 03:48:49 +03:00
yuyi 43a1d2cfea
ast: cleanup table.v (#12561) 2021-11-24 09:56:56 +02:00
yuyi e42db5bee2
ast: fix vtl compile error of generic array type cname (#12555) 2021-11-23 20:11:51 +02:00
playX 243e66a106
js,jsdom: Canvas & context API; Added TypeSymbol.is_js_compatible & temporary hacks for JS ifaces (#12526) 2021-11-20 21:28:11 +02:00
Delyan Angelov 3caeadfa0d
cgen,vfmt: support `[weak]` tags for functions and globals 2021-11-18 18:32:39 +02:00
playX 2eb02ff5a7
jsdom, js: start refactoring jsdom; improve JS interfaces; add two attributes for them (#12488) 2021-11-17 11:41:33 +02:00
yuyi 5a89c0a480
ast: change CompFor to ComptimeFor (#12482) 2021-11-17 08:29:43 +02:00
Delyan Angelov 3fab0a5d05
cgen: fix codegen for `for k,v in map_of_pointers {` 2021-11-16 17:03:58 +02:00
Delyan Angelov bc98da9111
ast: speed up the frequently called methods .find_field, .find_method etc 2021-11-07 18:07:04 +02:00
yuyi 9ec1262734
ast: fix generic nested struct init (#12405) 2021-11-07 17:06:37 +02:00
Delyan Angelov 1c12186701
v.token,ast,scanner,parser: use a KeywordsMatcher lookup for builtin_type_names searches too 2021-11-07 16:39:40 +02:00
Delyan Angelov 80242c8041
builtin,ast: apply small performance improvements, suggested by `hotspot` 2021-11-07 13:30:44 +02:00
Delyan Angelov a27833ed0d
all: support `volatile field Type` in struct declarations 2021-11-04 09:45:50 +02:00
Lucas Jenß 51f5841b6e
checker: do not deref non-pointer types in `fn_signature_using_aliases` (#12340) 2021-11-01 02:26:15 +03:00
yuyi 0e95e4d7b4
ast, cgen: fix generic method str() overload (#12330) 2021-10-28 19:03:17 +03:00
yuyi f62b2dcfa7
table: fix generic method with multi generic types (#12297) 2021-10-26 11:00:27 +03:00
yuyi ac99007cab
table: fix generic sumtype instantiations (#12288) 2021-10-25 15:22:41 +03:00
yuyi ff02c19827
table, builder, checker: cleanup unwrap_generic (#12241) 2021-10-21 05:48:02 +03:00
playX c1aa782a6c
js,checker: fix some modules build for `v -b js self`, fix `or block` check in ast.CallExpr (#12231) 2021-10-19 12:11:54 +03:00
yuyi a006090b08
ast: minor cleanup of register_type_symbol (#12213) 2021-10-17 15:50:42 +03:00
ChAoS_UnItY 4d1307f29b
all: index accessor in array init expression (#12181) 2021-10-15 03:57:49 +03:00
ChAoS_UnItY 6f629d1a6a
transformer: eliminate unreachable branches & redundant branch expressions in MatchExpr (#12174) 2021-10-14 02:15:52 +03:00
Alexander Ivanov 0386f2bbea
checker: add an interface check for mutability, fixes #1081, fixes #7038 (#11963) 2021-10-11 15:41:31 +03:00
yuyi 83bc9b35b1
ast: fix checking generic fn call with fntype arg mismatch (#12132) 2021-10-10 11:14:19 +03:00
yuyi 963233687e
v.fmt: fix fmt of 'fn(mut a &int)' (#12075) 2021-10-06 20:51:38 +03:00
yuyi f1742a6f62
v.ast: change 'type.to_ptr()' to 'type.ref()' (#12086) 2021-10-06 20:49:39 +03:00
crthpl 7cf9c198fe
asm: add segment addressing and fix [10] (#12068) 2021-10-05 18:57:15 +03:00
yuyi 8789cc422c
v.ast: fix fmt of 'bytestr' to '&byte' (#12014) 2021-09-29 13:53:46 +03:00
crthpl 85b58b03a3
cgen: parallelize (#10844) 2021-09-28 10:28:04 +03:00
Ekopalypse 400ab7876b
ast: fix fixed array typedef generation issue (#11962) 2021-09-24 17:01:42 +03:00
Delyan Angelov bf2569a9a8
all: support `mut volatile x := 123` declarations (#11940) 2021-09-22 13:06:30 +03:00
yuyi 108a01d65f
fmt: fix unnecessary line break in array init (fix #11448) (#11562) 2021-09-21 16:20:09 +03:00
Enzo b2ecca3966
all: remove `size_t` (#11478) 2021-09-21 02:12:38 +03:00
Daniel Däschle b63ec8fbcf
checker: require `params` attribute to use struct as keyword arguments in function (#11135) 2021-09-14 00:05:30 +03:00
Enzo 012da10517
ast, fmt: cleanup (#11477) 2021-09-13 04:08:58 +03:00
zakuro fb20a92b1e
fmt: fix a bug that break generics call in string inter (#11468) 2021-09-11 04:47:22 +03:00
Enzo c8471528ce
fmt: format long sum-types with a line for each type (#11461) 2021-09-10 20:56:55 +03:00
Daniel Däschle be0c54caf9
checker: require or block for sumtype map (#11089) 2021-09-10 16:07:39 +03:00
Alexander Medvednikov ab3adf3346 checker: no longer allow automatic dereferncing in `a = b` 2021-09-09 20:21:01 +03:00
Enzo e3b65092d6
parser: deprecate `size_t` (#11443) 2021-09-08 13:09:32 +03:00
Enzo cc8ee5fb84
all: introduce `isize` and `usize` (#11437) 2021-09-08 05:53:39 +03:00
yuyi b80777df4b
table: fix alias of sumtype method_call (#11268) 2021-08-22 17:20:10 +03:00
Delyan Angelov ec196cfcd1
all: support overriding individual function from .v files in .c.v or .js.v files. 2021-08-22 15:51:26 +03:00
yuyi 0d81d0c0c6
table, checker: fix sumtype array appending aggregate type values (fix #11197) (#11258) 2021-08-21 17:18:01 +03:00
yuyi 3d22dc1608
all: fix formating Foo<A,B> to Foo<A, B> (#11225) 2021-08-18 17:17:21 +03:00
spaceface d2ce1f74d6
ast.table: fix aggregate field type equality check (#11210) 2021-08-18 14:09:54 +03:00
spaceface 7d9969ac17
all: support runtime interface conversions (#11212) 2021-08-17 21:00:27 +03:00
Delyan Angelov 900c37aa65
v.gen.c: support `T.typ` - an int for the type index of the generic type `T` (#11175) 2021-08-14 08:48:25 +03:00
Delyan Angelov 34d39ccb64
builtin: fix leak in rune.str(), fix leaks in most assert x == y statements in tests (#11091) 2021-08-13 18:37:34 +03:00
Enzo da53f818df
all: initial support for closures (x64 / linux-only) (#11114) 2021-08-10 21:27:15 +03:00
yuyi aceaaa681d
ast: fix formatting fn variadic of reference param (#11130) 2021-08-10 21:14:37 +03:00
pancake e7b8cf17e5
v.gen.native: add support for assert statements for amd64 (#11117) 2021-08-10 10:29:44 +03:00
Alexander Medvednikov 03ed32f805 ast: bring back Table.free() for now 2021-08-08 07:07:06 +03:00
Alexander Medvednikov eaf8b63dd2 cgen: fix a c2v bug with variadics 2021-08-08 06:23:22 +03:00
Daniel Däschle 3b116d2455
cgen: support embedded struct fields on sumtype common fields (#11084) 2021-08-06 21:26:19 +03:00
Daniel Däschle 800c0e5092
vlib: remove deprecated map{} usages as well as deprecated functions (#11035) 2021-08-04 12:44:41 +03:00
Daniel Däschle 815c4b7420
all: rename generic_struct_inst to generic_inst (#11044) 2021-08-04 03:37:27 +03:00
Leo Developer 6dcf72fe9b
cgen: dont generate function if its flag is false (#11021) 2021-08-03 03:17:22 +03:00
Florian Blasius 69f31d8d5c
checker: check int literal to enum cast (fix #10125) (#10348) 2021-08-02 07:12:29 +03:00
Uwe Krüger 6068777e03
parser/checker: deduce type of global from initialization expression (#11005) 2021-07-31 16:35:19 +03:00
Uwe Krüger a7c2aaf35b
cgen: initialize globals directly for simple cases (#11002) 2021-07-30 19:20:45 +03:00
Delyan Angelov 06d1422a05
ast,checker,cgen: support simple `const x = u16(0x53)` without using _vinit() 2021-07-30 17:22:27 +03:00
Uwe Krüger 08aa6c08f6
all: more improvements for global variables (#10986) 2021-07-29 10:57:31 +03:00
Delyan Angelov 7547882c11
ci: fix failing fn_args.vv (use `zu8` as a temporary name of the unaliased `u8` type, since `uu8` is already used in fn_args.vv as a function name) 2021-07-29 10:14:55 +03:00
Alexander Medvednikov 1343ec7444 builtin: fix temporary u8 alias 2021-07-29 06:42:22 +03:00
Alexander Medvednikov 628498e0dc table: register u8 type 2021-07-29 05:00:03 +03:00
Uwe Krüger 45ad48d76a
cgen: properly handle initialization expression for globals (#10981) 2021-07-28 08:11:55 +03:00
Delyan Angelov ef0161c233
v.markused: handle compiling vweb, `-live` and orm example programs 2021-07-27 15:50:42 +03:00
Delyan Angelov 45a15755b8
v.builder: implement -show-callgraph 2021-07-24 13:32:56 +03:00
Delyan Angelov a4c9aeab14
v.ast.walker: pass nodes by reference 2021-07-24 13:32:56 +03:00
Delyan Angelov 6313ed6a79
checker,cgen: fix `-os cross` support for `$if !solaris { #include <sys/ptrace.h> }` 2021-07-23 16:24:42 +03:00
Louis Schmieder 26db3b0995
orm: redesign orm (re-write it in V) (#10353) 2021-07-23 12:33:55 +03:00
Daniel Däschle 2c0c211c79
all: implement accessing embedded field and method of aggregate (#10907) 2021-07-23 01:14:39 +03:00
yuyi ec87f4ee99
table: fix error of generics interface declaration (#10883) 2021-07-21 15:24:52 +03:00
yuyi 850a715c79
table: minor cleanup in does_type_implement_interface() (#10870) 2021-07-20 15:19:02 +03:00
Daniel Däschle 60b705b4c4
checker, gen: implement basic struct embed direct field init support (#10871) 2021-07-20 15:06:06 +03:00
Daniel Däschle ad3835b598
parser: deprecate short struct init (#10842) 2021-07-20 11:17:08 +03:00
Delyan Angelov 83b0a80ff4
ci: fix MSVC build (delay const string initialiastion to _vinit) 2021-07-19 08:20:09 +03:00
Delyan Angelov 241a7b760d
strconv,checker,cgen: fix -cstrict compilation of hello_world.v 2021-07-19 01:08:48 +03:00
Delyan Angelov 48546d0f45
all: do compile time const evaluation for `const x = "abc" + "xyz"` and `const x = 16 * 1024 + 5` (fix const prealloc_block_size) 2021-07-18 22:59:18 +03:00
yuyi a5c784830b
all: simplify global_scope processing (#10848) 2021-07-18 15:29:34 +03:00
shadowninja55 eb65ad078d
checker: prohibit passing non-lvalue as `voidptr` (#10838) 2021-07-18 15:04:16 +03:00
playX d5e0fa6d1b
v.gen.js: port string methods and fix booleans (#10824) 2021-07-18 09:00:20 +03:00
Delyan Angelov 6edfb2c7fe
v.parser: eliminate PrefixExpr from `&Type(x).name` and `&Type(x)[idx]` too (fix vinix build) 2021-07-17 20:20:20 +03:00
Delyan Angelov 568aa742b2
v.parser: improve conditions for debugging ast.CastExpr parsing 2021-07-17 17:49:29 +03:00
spaceface 6e942bf4c2
v: initial support for generic interfaces and sumtypes (#10795) 2021-07-15 08:29:13 +03:00
crthpl 5089eb4a84
parser: fix pointer cast expressions hack (#10777) 2021-07-13 12:01:24 +03:00
shadowninja55 d1f1c5ae51
v doc: add attribute tags to `v doc -f html` (#10778) 2021-07-13 08:27:20 +03:00
Delyan Angelov b5f1cf80a6
ci: fix regression bug in formatting of go_array_wait_test.v (caused by 974737f) 2021-07-12 10:55:30 +03:00
Delyan Angelov 974737f26b
vfmt: keep `module mymodule ... x := []thread MyStruct{}` as it is 2021-07-12 10:46:36 +03:00
zakuro ba9b53cc4d
cgen: fix error when using anon generics fn that have generics struct arg (#10751) 2021-07-11 19:30:41 +03:00
Louis Schmieder eb96ad11d9
checker: add pkgconfig to comptime if (#10692) 2021-07-09 18:17:04 +03:00
crthpl d14de5fdaf
all: fix generic functions with pointer args (#10686) 2021-07-07 11:51:05 +03:00
Delyan Angelov 6aecda3be8
all: support `[noreturn] fn abc() { for{} }`, mark panic/1 and exit/1with it too. (#10654) 2021-07-04 20:24:19 +03:00
yuyi 665279938e
checker: fix nested generic struct init (fix #10652) (#10659) 2021-07-04 18:37:31 +03:00
Daniel Däschle 0f9537ece5
all: remove ustring (#10630) 2021-07-03 20:14:09 +03:00
yuyi c0f855ace7
cgen: fix anon optional fn (fix #10640) (#10644) 2021-07-02 17:07:05 +03:00
yuyi 8628b19a3a
ast.table: optimize get_final_type_symbol() (#10646) 2021-07-02 16:59:41 +03:00
yuyi abbf71c794
ast.table: cleanup type_implements_interface() (#10643) 2021-07-02 10:18:04 +03:00
yuyi 8b901df366
table: optimize generated code for an empty interface (#10624) 2021-07-01 12:25:40 +03:00
Alexander Medvednikov 41e88423aa Revert "builtin: use == 0 instead of isnil()"
This reverts commit 8650ec6916.
2021-07-01 06:21:03 +03:00
shadowninja55 06a6a8e199
checker: check for empty branches in match expressions (#10593) 2021-06-28 19:32:28 +03:00
Delyan Angelov 8650ec6916
builtin: use == 0 instead of isnil()
Do not rely on C inlining that may not happen for a *very* frequently
called fn in lower level code.
2021-06-28 10:59:14 +03:00
Delyan Angelov c3b9eaf146
v.c.gen: fix codegen of auto str methods for structs having &voidptr fields 2021-06-28 10:05:42 +03:00
Alexander Medvednikov 7458927593 checker: fix global fn calls 2021-06-25 20:26:24 +03:00
shadowninja55 be8be3d319
v.parser: prohibit redeclaration of builtin types (#10563) 2021-06-25 13:08:56 +03:00
yuyi e9de30373f
table: fix interface embedding with interface parameter (#10567) 2021-06-25 12:52:25 +03:00
yuyi e3ea5c1e17
v.ast: cleanup Table.resolve_generic_to_concrete/3 (#10559) 2021-06-24 18:21:18 +03:00
yuyi 4bfe76123a
generics: fix generic fn type mismatch of returning a generic struct (#10553) 2021-06-24 12:47:36 +03:00
crthpl 500b48788e
parser, cgen: fix basic asm registers, fix numbered labels in addressing, support indirect branching (#10545) 2021-06-23 14:20:07 +03:00
Delyan Angelov 79df7f51c3
v: deprecate `[if ident]` in favour of `[if ident ?]` 2021-06-22 10:30:14 +03:00
Uwe Krüger 8f2f377cb1
v.checker,v.gen.c: extend auto heap mechanism to objects used as interfaces (#10529) 2021-06-21 07:10:10 +03:00
Enzo 44d0305ca9
checker,gen: remove automatic string to C string conversion (#10144) 2021-06-20 09:30:08 +03:00
crthpl 71b41d1042
ast.table: fix anonymous function declaration uniqueness for non-tcc c compilers (#10509) 2021-06-19 19:02:26 +03:00
yuyi 7ec55e4c51
v.ast: add comments for ast.AsCast (#10516) 2021-06-19 17:07:07 +03:00
Delyan Angelov 9f6ddb4c21
v.fmt: add an independent Comment.is_inline flag. Use it for fixing `[ .. //x ]` => `[ .. //x, ]` 2021-06-18 15:52:31 +03:00
yuyi 2298063129
checker: fix nested if smartcast selector exprs (fix #10372 #10379) (#10502) 2021-06-18 14:49:15 +03:00
Enzo 05f0f3e180
v.gen.c: refactor infix expression (#10485) 2021-06-18 14:27:52 +03:00
Delyan Angelov 39e7290416
v: support for `[if expr]`, part 2 (old `[if ident]` is not yet deprecated) 2021-06-17 18:55:20 +03:00
Delyan Angelov 69ce8baefd
v.ast: allow for `fn f()&IAbc{return voidptr(0)}` with no additional voidptr implicit conversions to compile 2021-06-16 11:07:04 +03:00
Emily Hudson 535dcac8fa
net: ipv6 support, merge unix+ip;[pack:x] attribute (#9904) 2021-06-13 23:53:38 +03:00
Uwe Krüger 2ac39d9112
all: new function `isreftype(T)` to know if `T` contains pointers (#10438) 2021-06-13 06:26:13 +03:00
Delyan Angelov 5870751769
v.gen.c: use the __V_architecture macro in v.pref.get_host_arch() 2021-06-13 00:49:30 +03:00