parser: fix v_panic due to -pos in unused var warning (with tcc)
parent
c4ca6a9113
commit
5d0cc0944e
|
@ -66,14 +66,14 @@ fn (mut p Parser) for_stmt() ast.Stmt {
|
||||||
}
|
}
|
||||||
} else if p.peek_tok.kind in [.key_in, .comma] {
|
} else if p.peek_tok.kind in [.key_in, .comma] {
|
||||||
// `for i in vals`, `for i in start .. end`
|
// `for i in vals`, `for i in start .. end`
|
||||||
|
key_var_pos := p.tok.position()
|
||||||
mut val_var_pos := p.tok.position()
|
mut val_var_pos := p.tok.position()
|
||||||
mut key_var_name := ''
|
mut key_var_name := ''
|
||||||
mut val_var_name := p.check_name()
|
mut val_var_name := p.check_name()
|
||||||
if p.tok.kind == .comma {
|
if p.tok.kind == .comma {
|
||||||
p.next()
|
p.next()
|
||||||
key_var_pos := val_var_pos
|
|
||||||
val_var_pos = p.tok.position()
|
|
||||||
key_var_name = val_var_name
|
key_var_name = val_var_name
|
||||||
|
val_var_pos = p.tok.position()
|
||||||
val_var_name = p.check_name()
|
val_var_name = p.check_name()
|
||||||
if p.scope.known_var(key_var_name) {
|
if p.scope.known_var(key_var_name) {
|
||||||
p.error('redefinition of key iteration variable `$key_var_name`')
|
p.error('redefinition of key iteration variable `$key_var_name`')
|
||||||
|
|
Loading…
Reference in New Issue