vweb: make app_test.v compile

pull/1597/head
Alexander Medvednikov 2019-08-12 17:21:56 +03:00
parent 6002511052
commit cba4d59712
2 changed files with 5 additions and 3 deletions

View File

@ -114,7 +114,7 @@ fn new_fn(mod string, is_public bool) *Fn {
// Function signatures are added to the top of the .c file in the first run. // Function signatures are added to the top of the .c file in the first run.
fn (p mut Parser) fn_decl() { fn (p mut Parser) fn_decl() {
p.fgen('fn ') p.fgen('fn ')
defer { p.fgenln('\n') } //defer { p.fgenln('\n') }
is_pub := p.tok == .key_pub is_pub := p.tok == .key_pub
is_live := p.attr == 'live' && !p.pref.is_so && p.pref.is_live is_live := p.attr == 'live' && !p.pref.is_so && p.pref.is_live
if p.attr == 'live' && p.first_pass() && !p.pref.is_live && !p.pref.is_so { if p.attr == 'live' && p.first_pass() && !p.pref.is_live && !p.pref.is_so {
@ -462,7 +462,9 @@ _thread_so = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&reload_so, 0, 0, 0);
p.genln(p.print_prof_counters()) p.genln(p.print_prof_counters())
} }
// Counting or not, always need to add defer before the end // Counting or not, always need to add defer before the end
p.genln(f.defer_text[f.scope_level]) if !p.is_vweb {
p.genln(f.defer_text[f.scope_level])
}
if typ != 'void' && !p.returns && f.name != 'main' && f.name != 'WinMain' { if typ != 'void' && !p.returns && f.name != 'main' && f.name != 'WinMain' {
p.error('$f.name must return "$typ"') p.error('$f.name must return "$typ"')
} }

View File

@ -1102,7 +1102,7 @@ fn (p mut Parser) vh_genln(s string) {
} }
fn (p mut Parser) statement(add_semi bool) string { fn (p mut Parser) statement(add_semi bool) string {
if p.returns { //&& !p.is_vweb { if p.returns && !p.is_vweb {
p.error('unreachable code') p.error('unreachable code')
} }
p.cgen.is_tmp = false p.cgen.is_tmp = false