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

parser: minor optimization in parse_multi_expr()

This commit is contained in:
yuyi 2020-06-18 07:15:17 +08:00 committed by GitHub
parent 3f01e2b796
commit b806fff90a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -753,10 +753,10 @@ fn (mut p Parser) parse_multi_expr(is_top_level bool) ast.Stmt {
if p.tok.kind in [.assign, .decl_assign] || p.tok.kind.is_assign() {
return p.partial_assign_stmt(left)
}
else if is_top_level && left.len > 0 &&
else if is_top_level && tok.kind !in [.key_if, .key_match] &&
left0 !is ast.CallExpr && left0 !is ast.PostfixExpr &&
!(left0 is ast.InfixExpr && (left0 as ast.InfixExpr).op == .left_shift) &&
left0 !is ast.ComptimeCall && tok.kind !in [.key_if, .key_match] {
left0 !is ast.ComptimeCall {
p.error_with_pos('expression evaluated but not used', left0.position())
}
if left.len == 1 {