Fold Expr statements into Assign statements

This commit is contained in:
Nigel Tao committed 2018-12-27 17:36:08 +11:00
1 parent 796c8ccc30
commit c9e6ee6fb3
6 files changed
+34 -38

No files matched your search

+2 -3
View File
@@ -701,6 +701,8 @@ func (p *parser) parseAssignNode() (*a.Node, error) {
rhs.Str(p.tm), p.filename, p.line())
}
}
} else {
op = t.IDEq
}
if p.funcEffect.WeakerThan(rhs.Effect()) {
@@ -708,9 +710,6 @@ func (p *parser) parseAssignNode() (*a.Node, error) {
rhs.Str(p.tm), rhs.Effect(), p.funcEffect, p.filename, p.line())
}
if lhs == nil {
return rhs.AsNode(), nil
}
return a.NewAssign(op, lhs, rhs).AsNode(), nil
}