mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: fix mark_var_used()
This commit is contained in:
parent
f7d8fb0cf4
commit
a44a03f9a5
@ -69,7 +69,7 @@ fn (p mut Parser) open_scope() {
|
||||
}
|
||||
|
||||
fn (p mut Parser) mark_var_used(v Var) {
|
||||
if v.idx == -1 {
|
||||
if v.idx == -1 || v.idx >= p.local_vars.len {
|
||||
return
|
||||
}
|
||||
p.local_vars[v.idx].is_used = true
|
||||
|
@ -276,10 +276,10 @@ fn (p mut Parser) parse(pass Pass) {
|
||||
p.cgen.consts << g
|
||||
case Token.eof:
|
||||
//p.log('end of parse()')
|
||||
if p.is_script && !p.pref.is_test {
|
||||
p.set_current_fn( MainFn )
|
||||
p.check_unused_variables()
|
||||
}
|
||||
// if p.is_script && !p.pref.is_test {
|
||||
// p.set_current_fn( MainFn )
|
||||
// p.check_unused_variables()
|
||||
// }
|
||||
if !p.first_pass() && !p.pref.is_repl {
|
||||
p.check_unused_imports()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user