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

parser: x in [] is always false

This commit is contained in:
Alexander Medvednikov 2019-12-07 03:05:19 +03:00
parent 5a8c07dcf5
commit cc834dd7a7

View File

@ -6,6 +6,9 @@ module compiler
// `ph` is for string_eq() // `ph` is for string_eq()
fn (p mut Parser) in_optimization(typ string, ph int) { fn (p mut Parser) in_optimization(typ string, ph int) {
p.check(.lsbr) p.check(.lsbr)
if p.tok == .rsbr {
p.error('`x in []` is always false')
}
mut i := 0 mut i := 0
// Get `a` expr value (can be a string literal, not a variable) // Get `a` expr value (can be a string literal, not a variable)
expr := p.cgen.cur_line[ph..] expr := p.cgen.cur_line[ph..]