a separate scope for
parent
dc2da1de98
commit
06a0f39f7b
|
@ -106,9 +106,9 @@ fn (table mut Table) parse_cflag(cflag string, mod string) ?bool {
|
||||||
index = i
|
index = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if i2 := flag.index(',') {
|
if i := flag.index(',') {
|
||||||
if index == -1 || i2 < index {
|
if index == -1 || i < index {
|
||||||
index = i2
|
index = i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if index != -1 && flag[index] == ` ` && flag[index+1] == `-` {
|
if index != -1 && flag[index] == ` ` && flag[index+1] == `-` {
|
||||||
|
|
|
@ -234,6 +234,7 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string {
|
||||||
if p.known_var(var_name) {
|
if p.known_var(var_name) {
|
||||||
p.error('redefinition of `$var_name`')
|
p.error('redefinition of `$var_name`')
|
||||||
}
|
}
|
||||||
|
p.open_scope()
|
||||||
p.next()
|
p.next()
|
||||||
p.check(.decl_assign)
|
p.check(.decl_assign)
|
||||||
p.is_var_decl = true
|
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
|
//token_idx: var_token_idx
|
||||||
})
|
})
|
||||||
p.statements()
|
p.statements()
|
||||||
|
p.close_scope()
|
||||||
p.returns = false
|
p.returns = false
|
||||||
return 'void'
|
return 'void'
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue