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

347 Commits

Author SHA1 Message Date
Alexander Medvednikov
b237ffcf09 Revert "move compiler/main.v to v.v"
This reverts commit 3748de8736.
2019-10-14 03:48:36 +03:00
Alexander Medvednikov
3748de8736 move compiler/main.v to v.v 2019-10-14 03:38:06 +03:00
Delyan Angelov
47115fd579 compiler: remove setting of v.pref.building_v flag in compiler/main.v . It is not needed anymore. (#2330) 2019-10-14 09:19:49 +11:00
Delyan Angelov
53c64abdeb compiler: make compiler an ordinary vlib/compiler module
* Move compiler/ under vlib/compiler/ .

* Add a minimal compiler/main.v driver program.

* Cleanup compiler/main.v .

* Make most compiler tests pass again.

* Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too.

* Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore.

* Reapply @joe-conigliaro fix for vgen.
2019-10-13 16:37:43 +03:00
joe-conigliaro
8e90724684
compiler: optimize parse_lib_imports (#2319)
* optimize parse_lib_imports
* comment unused import
2019-10-13 15:11:40 +11:00
joe-conigliaro
efe03a39cc parser: p.mod clean up 2019-10-13 03:05:11 +03:00
Alexander Medvednikov
a76165828b snake_case consts 2019-10-12 22:36:14 +03:00
Alexander Medvednikov
9850193348 modules cache: reduce verbosity 2019-10-12 22:14:16 +03:00
Delyan Angelov
065ce39577 compiler: -g and -debug should always add -g at least in the C compiler by default
* compiler: -g and -debug should always add -g at least in the C compiler by default.

* Set first the C backend debug_options, so that the optimization_options can override them later.

* Implement cleaner named is_debug, is_vlines, is_keep_c and is_cache options (i.e. -g/-cg, -keep_c, -cache v flags).

* Check and reset file/line numbers in the generated main program, only if v.pref.is_vlines is true.
2019-10-12 13:54:01 +03:00
joe-conigliaro
342e6a14a2
compiler: better detection of module path supplied to build module command (#2305)
compiler: better detection of module path supplied to `build module` command (#2305)
2019-10-12 20:48:57 +11:00
joe-conigliaro
1e121d36a4
compiler: module cache. const init - fix implicit declaration of function warning (#2303)
compiler: module cache. const init - fix implicit declaration of function warning (#2303)
2019-10-12 17:53:42 +11:00
joe-conigliaro
40156392f8
compiler: cached modules - windows fixes & organise cached module path (#2302)
compiler: cached modules - windows fixes & organise cached module path (#2302)
2019-10-12 16:41:41 +11:00
Alexander Medvednikov
b107b4f1e5 modules: create the modules directory if it's missing, use cache/ 2019-10-12 05:04:59 +03:00
joe-conigliaro
baeb2e3c0e
compiler: module init, add init fn definition (#2298)
* test

* only call existing module init

* add back comment

* add def
2019-10-12 12:35:33 +11:00
Alexander Medvednikov
6db7518189 make $if work with includes: skip the body if the target is different 2019-10-12 03:48:32 +03:00
joe-conigliaro
9faefe85e1
compiler: cached module - cleanup, remove unneeded code (#2297)
* test

* only call existing module init

* add back comment
2019-10-12 11:38:56 +11:00
Toby Webb
f461a21a50 compiler: fix v command to accept '.v' as valid file 2019-10-12 03:03:37 +03:00
joe-conigliaro
51388fea75 compiler: module init function & init consts for cached modules 2019-10-12 01:17:37 +03:00
Delyan Angelov
2b087dbf95 backtraces: add source line numbers too on linux
* Add source line numbers to backtraces on linux.

* Fix -g (broken after token caching).

* reset the #line directives after all the v code is compiled

* cleanup p.cgen.line setting inside p.next() .

* Support windows filepaths like "C:\Users\travis\build\vlang\v\v.exe.tmp.c" inside generated #line directives.

* Try to diagnose better windows-gcc failing.

* Revert "Try to diagnose better windows-gcc failing."

* implement and use cescaped_path/1 .

* Use cescaped_path/1 consistently throughout compiler/ .
2019-10-12 00:04:42 +03:00
Alexander Medvednikov
e7e0514379 no longer download vlib if it's missing 2019-10-10 23:20:41 +03:00
vitalyster
e64609387d term: colors on Windows console
* isConsole moved to builtin is_atty function
* Windows console initialization moved to builtin.init
2019-10-10 20:08:36 +03:00
Alexander Medvednikov
2411b8d1e7 module cache fixes; do not allow function names starting with _ 2019-10-10 00:44:26 +03:00
Alexander Medvednikov
a9a73d9315 caching modules: almost there 2019-10-09 06:35:58 +03:00
Delyan Angelov
dbd72ee828 v test: add ability to test a folder or a set of _test.v files
* v test: support for running 'v test folder/' .

* Support passing multiple folders and also single _test.v files to 'v test' .

* Update vhelp too, with descriptions of v test folder/ and v -stats .

* Fix running `v test v` from outside the root of the v tree.
2019-10-09 06:01:43 +03:00
vitalyster
0963328aed windows: make redirected console detection available to other modules 2019-10-08 03:11:26 +03:00
Delyan Angelov
60d4f47f7a improve crash diagnosis/detection when a test segfaults 2019-10-08 02:34:55 +03:00
joe-conigliaro
9defbf989d compiler: improve module import error messages 2019-10-08 02:32:12 +03:00
Delyan Angelov
ac5241b5bd compiler: implement -stats option for running a _test.v file
* Draft implementation of `v -stats file_test.v` .

* compiler: call stuff in vlib/benchmark/tests/always_imported.v, when doing `v -stats file_test.v`

* Nicer looking output from 'v -stats file_test.v' .

* Tweak colors and layout of -stats file_test.v .

* Fix a hardcoded path in compiler/main.v .

* Show colorized OK/FAIL for the examples in 'v test v' too.

* Add some comments about the purpose of the methods inside vlib/benchmark/tests/always_imported.v .

* when fails are 0, do not colorize their number at all.
2019-10-07 08:51:26 +03:00
joe-conigliaro
72ae12877e
remvoe dupe in main & fix js string.builder (#2233) 2019-10-05 18:07:10 +10:00
joe-conigliaro
a62dec2053
compiler: remove unneeded field & manually add parser to v.parsers (#2232)
compiler: remove unneeded field & manually add parser to v.parsers (#2232)
2019-10-05 16:52:50 +10:00
joe-conigliaro
24136ab88b compiler: get existing parser using path 2019-10-05 07:10:28 +03:00
Alexander Medvednikov
52f4f4026b
compiler: cache modules 2019-10-04 15:48:09 +03:00
Alexander Medvednikov
f45d3f07ed fix 3 last C warnings and make sure no new warnings are introduced 2019-10-04 05:49:41 +03:00
Alexander Medvednikov
841d824216 builtin: a very early version of the hashmap 2019-10-01 06:20:50 +03:00
Alexander Medvednikov
aaba7fdb29 download vlib if it is missing 2019-09-30 23:56:53 +03:00
Alexander Medvednikov
223032f0ce V 0.1.21 2019-09-30 22:39:52 +03:00
Alexander Medvednikov
fa7e0ce58a make v test v work in any directory 2019-09-30 21:58:02 +03:00
joe-conigliaro
a5b4ed2909 compiler: typo in module name erroneously reports "import cycle" 2019-09-30 13:40:19 +03:00
Alexander Medvednikov
ee8ff39454 rename ModPath to v_modules_path; do not allow long variable names without _ 2019-09-29 05:34:17 +03:00
Alexander Medvednikov
d482b1f824 struct capitalization: fix the rest of tests 2019-09-28 22:26:44 +03:00
Alexander Medvednikov
9eac16b976 parser: struct names must be capitalized 2019-09-28 22:20:34 +03:00
Delyan Angelov
a4cbe78d97 compiler: streamline main function handling
* compiler: streamline C main function generation

* fix most tests

* compiler: fix for 'go update()' in graph.v . More precise parser error messages.

* Fix temporarily examples/hot_reload/message.v by using os inside it (os.clear).

* Make graph.v easier to quickly modify by defining y outside the loop.

* Fix failure of /v/nv/compiler/tests/defer_test.v when run with 'v -g' (#line directive was not on its own line, but right after } ).

* Do not pass the os.args to tests, even if the tests import os (they are more stable when run in a controlled environment).

* fix declared and not used in the js backend.

* fix js main => main__main too.
2019-09-28 20:42:29 +03:00
Delyan Angelov
0160c7a89d compiler: change s.line_nr in just one place in tandem with s.last_nl_pos
* compiler: change s.line_nr in just one place, so that s.last_nl_pos will be updated in tandem too.

* v test v: run repl tests again

* Show gcc version in both windows gcc cases in a) github actions, and b) travis .

* adding inline to is_name_char is_nl and contains_capital does not help actually, just increases slightly binary size.

* Cleanup spurious spaces.
2019-09-28 20:41:11 +03:00
Alexander Medvednikov
d59d921e84 disable the vget test for now 2019-09-28 15:18:48 +03:00
Alexander Medvednikov
e19b630ab1 disable the vget test for now 2019-09-28 15:00:51 +03:00
Alexander Medvednikov
0bfb88e2e6 fix the vget test 2019-09-28 14:58:24 +03:00
Alexander Medvednikov
dc28c787d1 travis: re-write the vget test in V 2019-09-28 14:40:09 +03:00
joe-conigliaro
802da8f31d compiler: clean up. remove new_parser_string_id (#2140)
* clean up

* fix comment

* fix comment
2019-09-28 04:56:05 +03:00
Alexander Medvednikov
1821dac795 compiler: remove old generics hack; disable generics and repl tests for
now
2019-09-28 02:29:04 +03:00
joe-conigliaro
ad99b82930 compiler: make vgen use strings.Builder & allow parser creation from string 2019-09-27 14:02:01 +03:00