1
0
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:
Alexander Medvednikov 2019-12-07 23:09:48 +03:00
parent b79588dc69
commit 8ebc2fe601

View File

@ -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