parser: handle `a,b += 1,1` (fix #5735) (#5783)

pull/5786/head
Swastik Baranwal 2020-07-10 17:29:17 +05:30 committed by GitHub
parent 1a9690cc62
commit 9839b0eb7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,9 @@ fn (mut p Parser) partial_assign_stmt(left []ast.Expr) ast.Stmt {
// a, b = b, a // a, b = b, a
for r in right { for r in right {
has_cross_var = p.check_cross_variables(left, r) has_cross_var = p.check_cross_variables(left, r)
if op !in [.assign, .decl_assign] {
p.error('unexpected $op.str(), expecting := or = or comma')
}
if has_cross_var { if has_cross_var {
break break
} }