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.
This commit is contained in:
Delyan Angelov 2019-09-28 20:42:29 +03:00 committed by Alexander Medvednikov
parent 0160c7a89d
commit a4cbe78d97
10 changed files with 141 additions and 92 deletions

View file

@ -698,7 +698,7 @@ fn (table &Table) is_interface(name string) bool {
// Do we have fn main()?
fn (t &Table) main_exists() bool {
for _, f in t.fns {
if f.name == 'main' {
if f.name == 'main__main' {
return true
}
}
@ -707,7 +707,7 @@ fn (t &Table) main_exists() bool {
fn (t &Table) has_at_least_one_test_fn() bool {
for _, f in t.fns {
if f.name.starts_with('test_') {
if f.name.starts_with('main__test_') {
return true
}
}