fmt: process assignment statement correctly
parent
2eb4f663d6
commit
26fa833984
|
@ -106,10 +106,11 @@ fn (f mut Fmt) stmt(node ast.Stmt) {
|
||||||
f.write(', ')
|
f.write(', ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f.write(' = ')
|
f.write(' $it.op.str() ')
|
||||||
for right in it.right {
|
for right in it.right {
|
||||||
f.expr(right)
|
f.expr(right)
|
||||||
}
|
}
|
||||||
|
f.writeln('')
|
||||||
}
|
}
|
||||||
ast.BranchStmt {
|
ast.BranchStmt {
|
||||||
match it.tok.kind {
|
match it.tok.kind {
|
||||||
|
|
|
@ -1450,11 +1450,13 @@ pub fn (p mut Parser) assign_stmt() ast.AssignStmt {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
op := p.tok.kind
|
||||||
p.next() // :=, =
|
p.next() // :=, =
|
||||||
expr,_ := p.expr(0)
|
expr,_ := p.expr(0)
|
||||||
return ast.AssignStmt{
|
return ast.AssignStmt{
|
||||||
left: idents
|
left: idents
|
||||||
right: [expr]
|
right: [expr]
|
||||||
|
op: op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue