Commit Graph

961 Commits (870ed86afc4023d46ca2433285de20b4c2e5d088)

Author SHA1 Message Date
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
Delyan Angelov dc654b0121
Revert "v.gen.c: use the __V_architecture macro in v.pref.get_host_arch()"
This reverts commit 5452ba4653.
2021-06-12 23:15:48 +03:00
Delyan Angelov 5452ba4653
v.gen.c: use the __V_architecture macro in v.pref.get_host_arch() 2021-06-12 22:15:08 +03:00
Delyan Angelov e70bde54dc
ast: improve Expr.str() for `sizeof(Type)` and `__offsetof(StructName, fieldname)`, for more informative asserts/dumps 2021-06-12 16:49:14 +03:00
Alexander Medvednikov 635f045b14 ast: make is_int() work with aliases 2021-06-12 14:35:38 +03:00
Uwe Krüger daeeaef030
vfmt: hot fix to allow separate `array_d_gcboehm_opt.v` (#10413) 2021-06-11 12:00:18 +03:00
yuyi 329a6c974e
table, checker, cgen: implement generic fn infering fixed array (#10352) 2021-06-06 01:11:08 +03:00
Delyan Angelov 55ef849cd2
v.markused: trim unused map fns for programs that do not use them 2021-06-05 17:30:25 +03:00
crthpl 9553c5a4e6
parser: fix multiple output modifiers in asm (#10347) 2021-06-04 23:18:11 +03:00
yuyi cb19079d53
all: move cur_concrete_types to Table (#10269) 2021-05-31 17:14:45 +03:00
Louis Schmieder 38796521fa
all: allow defer use from other scope (#10284) 2021-05-31 14:43:44 +03:00
Delyan Angelov 2b62dca000
v: support for `$if threads {}, depending on whether `go ` was used at all (#10227) 2021-05-27 18:36:07 +03:00
Lukas Neubert d5cacd1e5f
ast: use string builder for StringInterLiteral.str() (#10207) 2021-05-27 10:17:51 +03:00
Ryan Roden-Corrent 306c16f0fa
fmt: don't break indexing in string interpolation. (#10195) 2021-05-25 07:45:32 +03:00
penguindark d8d05e0106
all: new string interpolation in pure V (#10181) 2021-05-24 05:20:45 +03:00
Delyan Angelov bf3af40f13
v.markused: support `./v -skip-unused -freestanding run vlib/os/bare/bare_example_linux.v` too 2021-05-23 16:25:34 +03:00
Delyan Angelov a08cbd364a
v.checker: improve C.printf(abc) deprecation precision 2021-05-23 12:18:21 +03:00
Lukas Neubert 79b97fa361
fmt: keep names of parameters in anonymus function (#10173) 2021-05-23 05:54:39 +03:00
Delyan Angelov bc01de2181
ast: mark ast.File{} with `[heap]`, and use []&ast.File consistently 2021-05-22 19:06:55 +03:00
Lukas Neubert 788520eb52
fmt, ast: fix usage of import aliases (#10151) 2021-05-21 20:33:04 +03:00
zakuro be92f81b2e
checker: fix type error in `f<T>(fn (v T))` with multiple different Ts (#10154) 2021-05-21 06:13:04 +03:00
Delyan Angelov da090f91d8
cgen: fix using and auto printing `x := [16]&Type{}` 2021-05-20 15:59:02 +03:00
Alexander Medvednikov f09a5135e9 checker: handle builtin enum init correctly 2021-05-20 03:14:32 +03:00
Lukas Neubert be189e0059
fmt: keep generics for selective import as fn param (#10138) 2021-05-19 21:25:02 +03:00
crthpl 0d44c8857e
checker: fix position of unknown type errors (#10110) 2021-05-16 04:51:23 +03:00
Uwe Krüger 7bfd89567b
shared: support `lock` on SelectorExpression (#10105) 2021-05-15 04:34:27 +03:00
crthpl 4273a9697e
parser: add support for flags in asm output constraints (#10103) 2021-05-14 12:01:15 +03:00
yuyi 14b7ce0f04
checker: fix generics fn return generics fn type (fix #10085) (#10088) 2021-05-13 12:26:13 +03:00
yuyi ebe58dcafa
checker: cleanup generic structs (#10086) 2021-05-12 19:57:14 +03:00
crthpl 8361f714dd
cgen: fix deadlock when returning/breaking in `lock` (#10079) 2021-05-12 11:44:47 +03:00
Delyan Angelov 6f2c18f1c7
ci: fix `v build-tools` 2021-05-11 11:08:46 +03:00
Delyan Angelov 263e1ee4a4
ci: fix compilation of cmd/tools/vtest-cleancode.v 2021-05-11 11:02:28 +03:00
Alexander Medvednikov dc034d9b16 vweb: make thread safe; checker: `$if T is Interface {` 2021-05-11 09:30:18 +03:00
yuyi 74defc4b82
checker: minor cleanup of FnDecl (#10000) 2021-05-09 15:27:45 +03:00
yuyi a9eb8931ed
table: minor cleanup of resolve_generic_to_concrete() (#10046) 2021-05-08 22:27:58 +03:00
Delyan Angelov 8a380f4699
tools: make `v test-cleancode` test everything by default (#10050) 2021-05-08 13:32:29 +03:00
Uwe Krüger d26ac5692e
all: various fixes for [heap]/auto-heap handling (#10033) 2021-05-07 15:58:48 +03:00
yuyi a6764e3cc3
table: fix generics struct with anon fn fields (#10024) 2021-05-06 20:24:08 +03:00
Delyan Angelov 3aa85bb5d7
v.ast: ensure interface->types info is complete 2021-05-06 19:48:11 +03:00
Delyan Angelov 2eafea6308
v: reduce the memory usage of the compiler (analysed with heaptrack) 2021-05-06 11:44:48 +03:00
zakuro 92a22e9ec5
ast: fix bug where fn_signature return wrong str for variadic arg (#9993) 2021-05-04 12:33:24 +03:00
Delyan Angelov ae898e77c5
v.markused: handle interface implementation methods, and vweb programs 2021-05-03 18:40:39 +03:00
yuyi 581fe375cc
checker: fix generics with cascaded multi nested generic fn (fix #3815) (#9965) 2021-05-02 19:30:57 +03:00
Delyan Angelov 4b818fa2be
v: implement interface embedding (#9935) 2021-05-02 03:00:47 +03:00
yuyi fec947c7e1
ast: minor cleanup in ast.FnDecl (#9950) 2021-05-01 12:50:49 +03:00
Alexander Medvednikov c16bb7f3e4 ast: a minor format of ast.v 2021-04-30 15:36:34 +03:00
Alexander Medvednikov e949d4b26c tools/fast: add "V lines" and "V lines/s" 2021-04-30 15:31:50 +03:00
yuyi 25d9272c84
all: rename `table.register_fn_generic_types` to `table.register_fn_concrete_types` (#9914) 2021-04-29 09:06:50 +03:00
crthpl 6945f987cf
checker: fix sumtype comparison and sumtype in itself (#9917) 2021-04-29 09:04:02 +03:00
Lukas Neubert dee733aae4
fmt: reset const field align after multi line exprs (#9916) 2021-04-29 02:17:37 +03:00
Lukas Neubert a065d014a2
fmt: keep constant sizes in struct field fixed array types (#9910) 2021-04-28 22:11:15 +03:00
Louis Schmieder faf2656335
orm: support multiline statements (#9888) 2021-04-27 15:28:57 +03:00
pancake 9a3869c521 v.ast: rename aarch64 to arm64 and aarch32 to arm32 2021-04-27 12:24:58 +03:00
Don Park aebb551e93
cgen: do full struct initialisation for V structs, fixes invalid data from `map[string]Struct{}['unknown']` (#9878) 2021-04-27 08:18:48 +03:00
yuyi 3877522ee3
table,checker,cgen: fix generics with recursive generics struct (#9862) 2021-04-26 20:05:10 +03:00
yuyi 212b4fa089
parser: implement infering generic type parameters from receiver types (fix #5862) (#9870) 2021-04-26 10:56:08 +03:00
spaceface 7acb48df83
parser: parse `JS.` interfaces properly (#9876) 2021-04-26 09:58:05 +03:00
Uwe Krüger 3c0a368af3
all: automatically move (some) referenced objects to heap (#9873) 2021-04-25 21:40:38 +03:00
Louis Schmieder fc3b628440
v: support `$for attr in Test.attributes` (#9836) 2021-04-25 18:29:26 +03:00
yuyi 8ccdae6188
all: cleanup generics call_expr (#9856) 2021-04-24 09:44:15 +03:00
yuyi b2dc444dd2
ast: minor cleanup in generic_struct_insts_to_concrete() (#9855) 2021-04-23 17:21:16 +03:00
Enzo af8ef12990
ast: use `AttrKind` (#9845) 2021-04-23 15:51:52 +03:00
Enzo b4e4d48bbd
checker: make sure negation is only used with numeric types (#9854) 2021-04-23 15:18:56 +03:00
yuyi dd2002cc57
cgen: fix generics with multi generics struct receiver (#9853) 2021-04-23 15:17:57 +03:00
Lukas Neubert aa40dfc1de
checker: check __global type (#9804) 2021-04-23 12:28:08 +03:00
Louis Schmieder c026d8b6f3
parser: number attributes (#9835) 2021-04-22 18:21:55 +03:00
yuyi 431d806dcf
ast, parser: cleanup of generic structs (#9839) 2021-04-22 18:21:01 +03:00
yuyi c85eefa5b2
ast: remove obsolete comment in types.v (#9841) 2021-04-22 07:03:29 +03:00
yuyi d02822f456
ast.table: simplify resolve_generic_by_names/types() (#9834) 2021-04-21 12:22:42 +03:00
yuyi 51258923d7
checker: fix generics call with reference arg (fix #9817 #9818) (#9830) 2021-04-21 06:40:11 +03:00
Delyan Angelov 9d8bda9eaf
v.ast, v.checker: fix absent 'missing return' warning, when a function ended with a t.panic() call 2021-04-20 11:49:06 +03:00
Enzo c174bfa52f
tools: add a `v bug file.v` tool to automatically report bugs on GitHub (#9746) 2021-04-19 21:40:54 +03:00
Lukas Neubert 70c651ff17
all: make __global behave consistent with const (#9711) 2021-04-19 17:07:47 +03:00
Delyan Angelov aa3a8c5245
v.ast: add a customizable ast.Table .panic() method 2021-04-19 15:39:57 +03:00
Delyan Angelov cfcecf898b
v.ast: add .free() methods, so vls can be more decoupled 2021-04-18 10:24:51 +03:00
yuyi cb70ffef59
table: minor simplification and cleanup of resolve_generic (#9772) 2021-04-17 02:38:07 +03:00
yuyi 8cb44ed9db
checker: fix generics with nested generics fn (#9757) 2021-04-16 11:53:20 +03:00
yuyi 466dc4540b
all: minor cleanup of generics (#9744) 2021-04-15 11:00:23 +03:00
Delyan Angelov b8e9f085eb
vfmt: cleanup StringInterLiteral.get_fspec_braces/1 2021-04-15 09:46:05 +03:00
Delyan Angelov f1549b3ee7
vfmt: make ${} more robust; require it for every interpolation that uses '...' or "..." 2021-04-15 09:28:40 +03:00
crthpl 0099458c0a
all: small asm fixes and number labels (#9730) 2021-04-15 01:30:23 +02:00
Delyan Angelov 68c3eccec5
v: skip asserts in -prod mode inside non _test.v files 2021-04-13 13:07:57 +03:00
Delyan Angelov 84fe2d8c6e
v.ast: implement Expr.str() for ast.ConcatExpr and ast.IfExpr too 2021-04-13 12:23:30 +03:00
yuyi c3ccb58450
checker: check generics variadic arg mismatch (#9700) 2021-04-13 02:06:24 +02:00
Louis Schmieder 67d8639917
orm: add unique fields & add drop table stmt (#9684) 2021-04-11 23:57:25 +02:00
Enzo 5a1a1b7c12
all: merge GoExpr and GoStmt (#9685) 2021-04-11 23:56:25 +02:00
Delyan Angelov 79fa15ec3a
cgen: allow printing of C.Structs containing &char/charptr fields 2021-04-12 00:14:58 +03:00
yuyi 3241611871
v.ast table: minor simplification of generic_struct_insts_to_concrete() (#9667) 2021-04-11 10:29:31 +03:00
yuyi a2a18ef92c
v: simplify handling of function generic parameters (#9673) 2021-04-11 09:02:57 +03:00
Uwe Krüger 78c6e35bde
checker/cgen: fix `v := rlock m { m[key] or { default_val } }` (#9666) 2021-04-10 16:57:18 +02:00
yuyi bf6a2f80ef
checker: fix generics with generic struct receiver (#9658) 2021-04-10 04:00:53 +02:00
Ned Palacios 50f59674ce
ast, checker: make SelectorExpr.root_ident return ?Ident (#9647) 2021-04-09 18:06:40 +02:00
Ned Palacios a706215e52
ast, parser: add type_pos to TypeDecl nodes (#9571) 2021-04-09 14:51:25 +03:00
Uwe Krüger 84fa1ae444
boehm-gc: support a `[keep_args_alive]` tag for C functions (#9641) 2021-04-09 13:13:49 +03:00
spaceface 4feb09fa5b
checker, cgen: add sumtype-like smartcasting capabilites to interfaces (#9256) 2021-04-09 11:00:05 +03:00
yuyi 690c0309ad
vfmt: fix fn/method that return generic struct (#9638) 2021-04-08 08:24:34 +03:00
Delyan Angelov de5cf4ac5e
v: show the number of processed bytes and lines for V source code with -stats 2021-04-07 18:12:27 +03:00
Louis Schmieder ab03357a6e
orm: add table creation (#9621) 2021-04-07 15:27:02 +02:00
Lukas Neubert 3a07fbc653
fmt: improve match branch wrapping (#9619) 2021-04-07 15:26:10 +02:00
Lukas Neubert a0648a3ec2
all: fixes related to Node.pos (#9613) 2021-04-06 15:16:19 +02:00
Delyan Angelov fec89c7efb
ci: fix some of `v test-cleancode` 1 2021-04-05 20:47:32 +03:00
Delyan Angelov 5bc29492fd
ci: fix vlib/v/tests/str_gen_test.v (all of `v test-self` is ok now) 2021-04-05 19:31:28 +03:00
Delyan Angelov abbb08b28c
ast,checker: fix `v test-self` by relaxing the is_number checks 2021-04-05 18:45:03 +03:00
Ned Palacios 07b1dc66dd
ast, parser: add additional pos info for FnDecl and InterfaceDecl nodes (#9603) 2021-04-05 18:14:21 +03:00
Delyan Angelov 4cde74f120
checker: make the compiler stricter when checking pointers 2021-04-05 10:02:47 +03:00
Alexander Medvednikov ed37512ea9 ci: run wkhtmltopdf only on linux again 2021-04-05 07:55:32 +03:00
Alexander Medvednikov 57e6138a61 all: remove byteptr and charptr; replace them with &byte and &char 2021-04-04 17:43:32 +03:00
Daniel Däschle 6a5f49afb1
all: support `?Type(none)` (#9567) 2021-04-02 16:34:48 +02:00
Ned Palacios 1bb48c3577
ast, parser: patches for VLS (#9562) 2021-04-02 16:26:37 +02:00
Delyan Angelov 69ba93f954
ast: remove redundant `import v.ast` 2021-04-02 08:31:29 +03:00
Alexander Medvednikov 7385f8e56b all: a massive merge of ast and table modules 2021-04-02 01:57:09 +03:00
crthpl 8d5e310189
asm: make fixed labels possible as displacement (#9549) 2021-04-01 09:58:33 +03:00
Ned Palacios 0b39de2fd3
ast, parser: add syms_pos to import ast (#9541) 2021-03-31 12:17:06 +02:00
Delyan Angelov 23a6ce00e2
ci: fix for `-cflags -Werror` jobs 2021-03-31 12:28:42 +03:00
Alexander Medvednikov 6f318be96c checker: do not allow nil sum types init 2021-03-31 11:13:52 +03:00
Ned Palacios 3ced970b17
ast, parser: add additional info for CallExpr, StructInit nodes (#9526) 2021-03-30 09:43:17 +02:00
Ned Palacios b319068151
ast, parser: implement simple AST poisoning (#9525) 2021-03-30 09:33:29 +02:00
Ned Palacios aa4e22c287
scanner, token: add column information to tokens (#9407) 2021-03-23 06:23:46 +01:00
Delyan Angelov a00c80b98f
v: support compiler notices. Use them for `[deprecated_after: '2021-05-01']` tags
Compiler notices are like warnings, with these differences:
   a) notices use a different color.
   b) notices use a different label.
   c) notices do not prevent compilation with -prod.
   (warnings are converted to errors with -prod)
2021-03-22 19:59:00 +02:00
Delyan Angelov c5884a5f4d
v.ast: improve Expr.str() for `sizeof(Type)` 2021-03-19 20:56:49 +02:00
crthpl fafb035fb5
all: reimplement inline assembly (#8645) 2021-03-17 01:43:17 +01:00
Enzo 4b6244c9c1
gen: fix generic variadic (#9333) 2021-03-17 00:18:43 +02:00
Delyan Angelov 25c07c2f43
v.ast: handle more expressions in Expr.str() 2021-03-15 06:27:56 +02:00
yuyi 945769a4f6
all: implement reference receiver optimization for big structs (#9268) 2021-03-14 18:11:21 +01:00
Delyan Angelov 69f1e7c9c3
v: fixes for `v -autofree -o v2 cmd/v` 2021-03-14 09:37:38 +02:00
Alexander Medvednikov 2f1810634e checker: do not allow direct initialization of builtin types (s := string{}) 2021-03-13 18:20:46 +03:00
Nick Treleaven 9db8a61b92
checker: disallow array append in an expression (#9265) 2021-03-12 16:09:01 +01:00
Miccah f26d2f02b7
ast, cgen, checker, parser: support method arguments in comptime $for (#9208) 2021-03-11 15:04:34 +02:00
spaceface 7d0cba5e96
v.ast: remove the `stmt.position()` method (#9233) 2021-03-11 14:50:02 +02:00
spaceface f1469a8761
checker: allow accessing fields common to all sumtype members (#9201) 2021-03-09 19:16:18 +02:00
Delyan Angelov 64bc2fb40a
v: fix `[if debug] fn abc(){} ... abc()` 2021-03-07 12:05:07 +02:00
Lukas Neubert 043c29cf95
fmt: fix string interpolation with CastExpr (#9137) 2021-03-06 20:47:19 +02:00
Delyan Angelov 849cde245c
v: support dump(expr) (#9160) 2021-03-06 18:09:28 +01:00
Delyan Angelov 0f042124cb
tests: support `fn test_fn() ? { opt()? }` 2021-03-05 14:18:21 +02:00
Delyan Angelov 6da66226e5
vfmt: keep `mut:` in interface declarations (#9053) 2021-03-04 15:30:30 +02:00
Lukas Neubert 460e06b9ff
fmt: do not insert a newline before returned $vweb.html() (#9063) 2021-03-03 10:14:05 +02:00
Uwe Krüger dd475f4e37
checker/cgen: enable `IfGuardExpr` for `a[k]` and `<-ch` (#9065) 2021-03-03 10:10:38 +02:00
Uwe Krüger e937d6249c
cgen: fix various issues concerning optionals (#9021) 2021-02-28 23:21:03 +01:00
Nick Treleaven 59d4d0ef1d
checker: detect unknown type to iterate with $for (#8971) 2021-02-26 08:28:19 +02:00
yuyi c762d150c6
cgen: fix anon_fn redefinition (#8961) 2021-02-25 12:16:35 +01:00
Lukas Neubert 7e27920cf7
fmt: fix inserted empty line before go stmt with anonymus function (#8951) 2021-02-25 01:30:04 +01:00
yuyi 05a08530ff
cgen: implement for_stmt of multi_init_vars or multi_assign_vars (#8917) 2021-02-24 14:58:45 +02:00
Lukas Neubert 7f6c4caa01
fmt: fix missing space after single line array pre comments (#8904) 2021-02-22 17:53:55 +02:00
zakuro f54c1a5cc2
all: add strings.Builder.write_string and use write_string instead of write (#8892) 2021-02-22 13:18:11 +02:00
Lukas Neubert 9dc770e29c
fmt: do not struggle with comments inside maps (#8897) 2021-02-22 13:04:48 +02:00
Lukas Neubert f18adf7759
parser,fmt: handle array pre-comments separately from exprs (#8884) 2021-02-21 20:18:19 +02:00
yuyi 6e46f3850c
ast: change `expr.is_mut_ident()` to `expr.is_auto_deref_var()` (#8869) 2021-02-21 12:15:36 +02:00
yuyi 8f486cb8cf
ast: minor cleanup of ast.v (#8859) 2021-02-20 20:50:43 +02:00
yuyi 4fa315edc2
checker: fix for _, mut j in array (#8785) 2021-02-17 20:44:28 +01:00
Delyan Angelov 843de10442
parser,gen: fix `arr << map[key] using map_get_and_set_1, leading to double free 2021-02-16 16:39:31 +02:00
glebbash aa548f45ea
docs: fix functions in array/map example (#8695) 2021-02-12 21:10:54 +02:00
yuyi 3164e29651
all: fix fn_or_for_in mut value (part 1) (#8671) 2021-02-12 02:03:11 +02:00
Lukas Neubert 8cb01ba8db
fmt: keep comments between and after imports (#8637) 2021-02-08 19:48:48 +02:00
Nick Treleaven e2ff2a5405
parser: deprecate `{var |` struct update (#8618) 2021-02-08 17:03:05 +02:00
Uwe Krüger cf230644b6
fmt: enable shared return types (#8614) 2021-02-06 21:25:06 +01:00
zakuro fe9d062b41
gen: fix bug where unreached defer is executed (#8594) 2021-02-06 18:40:39 +02:00
Lukas Neubert 9ab1d17cbc
fmt: keep __global in struct declarations (#8584) 2021-02-05 16:46:43 +01:00
Alexander Medvednikov 1084b43ffb all: ast walker for marking unused fns 2021-02-05 08:05:35 +01:00
Louis Schmieder 97c0ef3505
orm: struct field support (#8517) 2021-02-04 20:28:33 +01:00
BigBlack 162c42dbe9
ast: fix `new_struct := MyStruct{...(*old_struct)}` (#8544) 2021-02-04 09:14:43 +02:00
Nick Treleaven de37b52d4b
checker: check goto label exists (#8523) 2021-02-03 15:20:10 +01:00
Uwe Krüger 9dcf673216
all: make `lock` and `rlock` dead lock free :-) (#8534) 2021-02-03 15:16:52 +01:00
zakuro 4b99d6af95
cgen: fix bug with duplicate defer generation (#8503) 2021-02-03 11:40:21 +02:00
Daniel Däschle d477e525bb
checker/gen: fix generic struct init (#8322) 2021-02-03 00:42:00 +11:00
Lukas Neubert 8755f40430
fmt: keep comments after imports (#8483) 2021-02-01 14:45:08 +01:00
Lukas Neubert 43676330ba
fmt: keep braces around @ escaped fields in string interpolation (#8488) 2021-02-01 11:04:57 +02:00
spaceface effa3188dd
cgen: fix type casts to interfaces (#8476) 2021-01-31 19:24:33 +02:00
Larpon d25825df57
all: support compile time `$env('ENV_VAR')` (#8456) 2021-01-31 19:22:42 +02:00
Nick Treleaven 43c3a3b080
checker: fix compile-time call with string identifier expression (#8415) 2021-01-30 15:24:16 +01:00
div72 8c70920695
all: add offsetof (#8380) 2021-01-30 12:57:09 +01:00
Lukas Neubert a044441224
fmt: keep {} in string interpolation for chained CallExprs (#8422) 2021-01-30 11:58:19 +01:00
Lukas Neubert 2774db077d
fmt: keep user choice for newlines in match branches (#8418) 2021-01-30 11:57:57 +01:00
yuyi 77b3d40f46
checker: fix `map = {}` (#8435) 2021-01-30 11:55:10 +01:00
Swastik Baranwal e03ece2a4b
checker: check the fn decl for anon fns too (#7529) 2021-01-29 23:11:05 +02:00
Lukas Neubert 3790bd67e3
fmt: minor cleanup of sql_expr (#8340) 2021-01-26 10:36:46 +01:00
Daniel Däschle 006a11454f
cgen: fix generic type $else $if (#8339) 2021-01-25 17:08:02 +01:00
Delyan Angelov d4f6f5eec4
sokol,fontstash: move f_d_use_freetype.v to vlib/fontstash/a_d_use_freetype.v 2021-01-23 11:39:17 +02:00
Lukas Neubert 8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
spaceface c2d501e8a9
all: implement interface fields (#8259) 2021-01-23 08:57:17 +02:00
Louis Schmieder e06e8b10cd
orm: fix empty struct and simplify (#8246) 2021-01-22 23:28:26 +01:00
Daniel Däschle 500ebf77e4
all: implement multiple generics (#8231) 2021-01-22 13:49:56 +01:00
zakuro 522d875489
checker: make it an error, to use ident outside of anon fn (#8232) 2021-01-22 09:24:49 +02:00
Daniel Däschle 3ee7bc960f
checker/gen: fix smartcast pointer sumtype (#8260) 2021-01-21 22:31:25 +02:00
joe-conigliaro 97ebecc5f4
usecache: get all tests running with -usecache enabled by default (p.1) (#7699) 2021-01-20 06:04:59 +01:00
Tim Basel 129eee346b
fmt: keep single empty lines (#8189) 2021-01-19 14:49:40 +01:00
Lukas Neubert b44c08aff0
fmt: wrap match branch expressions (#8190) 2021-01-19 06:16:42 +01:00
Lukas Neubert ac2c3847af
all: update copyright to 2019-2021 (#8029) 2021-01-18 13:20:06 +01:00
Lukas Neubert 16c9cbce7c
fmt: correctly increase f.line_len for write_indent (#8174) 2021-01-18 06:02:29 +01:00
Nick Treleaven df39e7001c
parser: support `module:` for immutable private struct fields (#8140) 2021-01-17 05:39:44 +01:00
Delyan Angelov c4c4b9c7b1
gen,checker: implement g.trace/2 and c.trace/2, similar to p.trace/2 2021-01-15 20:28:53 +02:00
Uwe Krüger 8d014d4646
sync: allow `go` routine join with return value (#8125) 2021-01-15 13:45:26 +01:00
zakuro c39f0a7cb7
ast: add str for AssertStmt (#8021) 2021-01-15 00:17:26 +01:00
Larpon f73500f2fe
all: add support for the `x := $embed_file('v.png')` compile time call (#8048) 2021-01-14 16:20:11 +02:00
yuyi a2efb5319d
all: change `[1,2,3]!!` to `[1,2,3]!` (#8101) 2021-01-14 03:51:13 +01:00
zakuro c8bcee9639
ast: add str for comment (#8019) 2021-01-14 02:21:27 +01:00
zakuro fdf5f5003b
ast: add str for ArrayInit (#8022) 2021-01-14 02:21:19 +01:00
zakuro 204cc5fb01
ast: add case for Import in `fn (node Stmt) str()` 2021-01-13 15:56:48 +02:00
zakuro 4923048d95
ast: add case for ConstDecl in `fn (node Stmt) str()` (#8073) 2021-01-13 15:54:41 +02:00
Nick Treleaven ac85257ea0
parser: fix sizeof(mod.Type), fix checking sizeof expression (#8065) 2021-01-13 06:13:39 +01:00
zakuro e8ab79205f
ast: add str for Module (#8072) 2021-01-13 06:00:53 +01:00
zakuro 33694665f0
fmt: align each contiguous field of struct. not the whole. (#7981) 2021-01-12 04:38:43 +01:00