mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
do not allow redefinition in x := opt() {
This commit is contained in:
parent
b79588dc69
commit
8ebc2fe601
@ -231,6 +231,9 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string {
|
||||
p.check_not_reserved()
|
||||
option_tmp := p.get_tmp()
|
||||
var_name := p.lit
|
||||
if p.known_var(var_name) {
|
||||
p.error('redefinition of `$var_name`')
|
||||
}
|
||||
p.next()
|
||||
p.check(.decl_assign)
|
||||
p.is_var_decl = true
|
||||
|
Loading…
Reference in New Issue
Block a user