make the unchanged mutable variable error a warning in non-prod builds

This commit is contained in:
Alexander Medvednikov 2020-01-06 00:28:29 +01:00
parent 4c3df963fa
commit 126289c19b
2 changed files with 9 additions and 1 deletions

View file

@ -23,6 +23,14 @@ fn (p mut Parser) error(s string) {
p.error_with_token_index(s, p.token_idx - 1)
}
fn (p mut Parser) warn_or_error(s string) {
if p.pref.is_prod {
p.error(s)
} else {
p.warn(s)
}
}
fn (p mut Parser) warn(s string) {
p.warn_with_token_index(s, p.token_idx - 1)
}