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

scanner: fix false &&!ok1 (fix #7524) (#15458)

This commit is contained in:
yuyi 2022-08-18 16:55:38 +08:00 committed by GitHub
parent af8bd10761
commit 7227c1d508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -849,7 +849,7 @@ fn (mut s Scanner) text_scan() token.Token {
return s.new_token(.and_assign, '', 2)
}
afternextc := s.look_ahead(2)
if nextc == `&` && afternextc.is_space() {
if nextc == `&` && (afternextc.is_space() || afternextc == `!`) {
s.pos++
return s.new_token(.and, '', 2)
}

View File

@ -0,0 +1,5 @@
fn test_and_and_not_parses() {
ok1 := true
ok2 := false && !ok1
assert ok2 == false
}