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

parser: fix a more complicated "in" usage

This commit is contained in:
Danil-Lapirow 2019-09-18 16:13:22 +03:00 committed by Alexander Medvednikov
parent b9cc6535f6
commit b0092235fc

View File

@ -2081,7 +2081,7 @@ fn (p mut Parser) expression() string {
p.fgen(' ')
p.check(.key_in)
p.fgen(' ')
p.gen(', ')
p.gen('), ')
arr_typ := p.expression()
is_map := arr_typ.starts_with('map_')
if !arr_typ.starts_with('array_') && !is_map {
@ -2093,10 +2093,10 @@ fn (p mut Parser) expression() string {
}
// `typ` is element's type
if is_map {
p.cgen.set_placeholder(ph, '_IN_MAP( ')
p.cgen.set_placeholder(ph, '_IN_MAP( (')
}
else {
p.cgen.set_placeholder(ph, '_IN($typ, ')
p.cgen.set_placeholder(ph, '_IN($typ, (')
}
p.gen(')')
return 'bool'