parser: check assign_stmt of undefined variable (#8366)
parent
1f4e8254b9
commit
7a5722c885
|
@ -0,0 +1,5 @@
|
|||
vlib/v/checker/tests/assign_expr_undefined_err_g.vv:2:14: error: undefined variable: `file`
|
||||
1 | fn main() {
|
||||
2 | mut file := file.open_file('bees.pdf', 'rw', 0o666)
|
||||
| ~~~~
|
||||
3 | }
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
mut file := file.open_file('bees.pdf', 'rw', 0o666)
|
||||
}
|
|
@ -23,6 +23,9 @@ fn (mut p Parser) check_undefined_variables(exprs []ast.Expr, val ast.Expr) ? {
|
|||
}
|
||||
}
|
||||
}
|
||||
ast.CallExpr {
|
||||
p.check_undefined_variables(exprs, val.left) ?
|
||||
}
|
||||
ast.InfixExpr {
|
||||
p.check_undefined_variables(exprs, val.left) ?
|
||||
p.check_undefined_variables(exprs, val.right) ?
|
||||
|
|
Loading…
Reference in New Issue