mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix unreachable code error in if a := opt()
This commit is contained in:
parent
81d4f66fbb
commit
2651b8957a
@ -2663,6 +2663,7 @@ fn (p mut Parser) if_st(is_expr bool, elif_depth int) string {
|
|||||||
//token_idx: var_token_idx
|
//token_idx: var_token_idx
|
||||||
})
|
})
|
||||||
p.statements()
|
p.statements()
|
||||||
|
p.returns = false
|
||||||
return 'void'
|
return 'void'
|
||||||
} else {
|
} else {
|
||||||
p.check_types(p.bool_expression(), 'bool')
|
p.check_types(p.bool_expression(), 'bool')
|
||||||
|
@ -626,17 +626,15 @@ fn parse_host(host string) ?string {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return host1 + host2 + host3
|
return host1 + host2 + host3
|
||||||
} else {
|
}
|
||||||
i = host.last_index(':')
|
i = host.last_index(':')
|
||||||
if i != -1 {
|
if i != -1 {
|
||||||
colon_port = host[i..]
|
colon_port = host[i..]
|
||||||
if !valid_optional_port(colon_port) {
|
if !valid_optional_port(colon_port) {
|
||||||
return error(error_msg('parse_host: invalid port $colon_port after host ', ''))
|
return error(error_msg('parse_host: invalid port $colon_port after host ', ''))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h := unescape(host, .encode_host) or {
|
h := unescape(host, .encode_host) or {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -852,8 +850,8 @@ fn parse_query_values(m mut Values, query string) ?bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
mut value := ''
|
mut value := ''
|
||||||
i = key.index('=')
|
if idx := key.index('=') {
|
||||||
if i >= 0 {
|
i = idx
|
||||||
value = key[i+1..]
|
value = key[i+1..]
|
||||||
key = key[..i]
|
key = key[..i]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user