1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: blank identifier for loops. dont declare any variables

This commit is contained in:
joe-conigliaro
2019-09-29 02:53:56 +10:00
committed by Alexander Medvednikov
parent 7952d591b9
commit ed3a4961d0
4 changed files with 35 additions and 38 deletions

View File

@@ -543,11 +543,10 @@ fn (p mut Parser) check_unused_variables() {
if var.name == '' {
break
}
if !var.is_used && !p.pref.is_repl && !var.is_arg && !p.pref.translated && var.name != '_' {
if !var.is_used && !p.pref.is_repl && !var.is_arg && !p.pref.translated {
p.production_error('`$var.name` declared and not used', var.scanner_pos )
}
if !var.is_changed && var.is_mut && !p.pref.is_repl &&
!p.pref.translated && var.name != '_' {
if !var.is_changed && var.is_mut && !p.pref.is_repl && !p.pref.translated {
p.error_with_position( '`$var.name` is declared as mutable, but it was never changed', var.scanner_pos )
}
}