parser: `x in []` is always false
parent
5a8c07dcf5
commit
cc834dd7a7
|
@ -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..]
|
||||||
|
|
Loading…
Reference in New Issue