Unified IR used to visit RHS/X before LHS in assign/for statements for
satisfying toolstash in quirksmode.
After CL 385998, unified IR quirks mode was gone, the constraint to
visit RHS/X first is no longer necessary.
Change-Id: I1c3825168b67fb094928f5aa21748a3c81b118ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/410343
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
case stmtAssign:
pos := r.pos()
- // TODO(mdempsky): After quirks mode is gone, swap these
- // statements so we visit LHS before RHS again.
- rhs := r.exprList()
names, lhs := r.assignList()
+ rhs := r.exprList()
if len(rhs) == 0 {
for _, name := range names {
if r.Bool() {
pos := r.pos()
- // TODO(mdempsky): After quirks mode is gone, swap these
- // statements so we read LHS before X again.
- x := r.expr()
names, lhs := r.assignList()
+ x := r.expr()
body := r.blockStmt()
r.closeAnotherScope()
default:
w.Code(stmtAssign)
w.pos(stmt)
- w.exprList(stmt.Rhs)
w.assignList(stmt.Lhs)
+ w.exprList(stmt.Rhs)
}
case *syntax.BlockStmt:
case *syntax.VarDecl:
w.Code(stmtAssign)
w.pos(decl)
- w.exprList(decl.Values)
w.assignList(namesAsExpr(decl.NameList))
+ w.exprList(decl.Values)
}
}
if rang, ok := stmt.Init.(*syntax.RangeClause); w.Bool(ok) {
w.pos(rang)
- w.expr(rang.X)
w.assignList(rang.Lhs)
+ w.expr(rang.X)
} else {
w.pos(stmt)
w.stmt(stmt.Init)