mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: clears MainFn when recompile on repl
This commit is contained in:
parent
748c45203d
commit
b6b313d246
@ -88,6 +88,11 @@ fn (f mut Fn) register_var(v Var) {
|
|||||||
f.var_idx++
|
f.var_idx++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn (f mut Fn) clear_vars() {
|
||||||
|
f.var_idx = 0
|
||||||
|
f.local_vars = []Var
|
||||||
|
}
|
||||||
|
|
||||||
// vlib header file?
|
// vlib header file?
|
||||||
fn (p mut Parser) is_sig() bool {
|
fn (p mut Parser) is_sig() bool {
|
||||||
return (p.build_mode == DEFAULT_MODE || p.build_mode == BUILD) &&
|
return (p.build_mode == DEFAULT_MODE || p.build_mode == BUILD) &&
|
||||||
|
@ -249,6 +249,9 @@ fn (p mut Parser) parse() {
|
|||||||
}
|
}
|
||||||
if p.cur_fn.name == '' {
|
if p.cur_fn.name == '' {
|
||||||
p.cur_fn = MainFn
|
p.cur_fn = MainFn
|
||||||
|
if p.is_repl {
|
||||||
|
p.cur_fn.clear_vars()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
start := p.cgen.lines.len
|
start := p.cgen.lines.len
|
||||||
p.statement(true)
|
p.statement(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user