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

parser: report unused expression error in if and or blocks (#6953)

This commit is contained in:
Takahiro Yaota
2020-11-26 08:28:41 +09:00
committed by GitHub
parent 2957541e48
commit 258f8f6af9
7 changed files with 40 additions and 8 deletions

View File

@@ -128,7 +128,7 @@ fn (p Parser) is_singlequote() bool {
fn (mut p Parser) detect_parse_mode() {
src := p.scanner.text
if src.len > 1 && src[0].is_digit() && !src[1].is_digit() {
p.mode == .invalid
p.mode = .invalid
return
}
@@ -136,7 +136,7 @@ fn (mut p Parser) detect_parse_mode() {
p.n_tok = p.scanner.scan()
if src.len == 1 && p.tok.kind == .string && p.n_tok.kind == .eof {
p.mode == .invalid
p.mode = .invalid
return
}