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

checker: comp. if branch logic fix (#6473)

This commit is contained in:
spaceface777 2020-09-25 11:48:27 +02:00 committed by GitHub
parent 90d1a689db
commit 0b95d72354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3423,12 +3423,12 @@ fn (mut c Checker) comp_if_branch(cond ast.Expr, pos token.Position) bool {
.and {
l := c.comp_if_branch(cond.left, cond.pos)
r := c.comp_if_branch(cond.right, cond.pos)
return l && r
return l || r // skip (return true) if at least one should be skipped
}
.logical_or {
l := c.comp_if_branch(cond.left, cond.pos)
r := c.comp_if_branch(cond.right, cond.pos)
return l || r
return l && r // skip (return true) only if both should be skipped
}
.key_is, .not_is {
// $if method.@type is string