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

compiler: tmp variables on scripts inside generated main function

This commit is contained in:
Henrixounez 2019-07-01 19:55:47 +02:00 committed by Alexander Medvednikov
parent 01d5f4d744
commit dc8c84a2a8

View File

@ -259,8 +259,11 @@ fn (p mut Parser) parse() {
p.cur_fn.clear_vars() p.cur_fn.clear_vars()
} }
} }
start := p.cgen.lines.len mut start := p.cgen.lines.len
p.statement(true) p.statement(true)
if p.cgen.lines[start - 1] != '' && p.cgen.fn_main != '' {
start--
}
p.genln('') p.genln('')
end := p.cgen.lines.len end := p.cgen.lines.len
lines := p.cgen.lines.slice(start, end) lines := p.cgen.lines.slice(start, end)