From 06a0f39f7b19b8b89fbd4c91114180ebc0a7baf0 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 8 Dec 2019 00:30:06 +0300 Subject: [PATCH] a separate scope for --- vlib/compiler/cflags.v | 6 +++--- vlib/compiler/if_match.v | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vlib/compiler/cflags.v b/vlib/compiler/cflags.v index fe1fa9ba2e..cc0dae78c7 100644 --- a/vlib/compiler/cflags.v +++ b/vlib/compiler/cflags.v @@ -106,9 +106,9 @@ fn (table mut Table) parse_cflag(cflag string, mod string) ?bool { index = i } } - if i2 := flag.index(',') { - if index == -1 || i2 < index { - index = i2 + if i := flag.index(',') { + if index == -1 || i < index { + index = i } } if index != -1 && flag[index] == ` ` && flag[index+1] == `-` { diff --git a/vlib/compiler/if_match.v b/vlib/compiler/if_match.v index 89377a9cdf..a45e736e81 100644 --- a/vlib/compiler/if_match.v +++ b/vlib/compiler/if_match.v @@ -234,6 +234,7 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string { if p.known_var(var_name) { p.error('redefinition of `$var_name`') } + p.open_scope() p.next() p.check(.decl_assign) p.is_var_decl = true @@ -262,6 +263,7 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string { //token_idx: var_token_idx }) p.statements() + p.close_scope() p.returns = false return 'void' } else {