summaryrefslogtreecommitdiff
path: root/usr/gri/pretty/parser.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-10-20 10:01:34 -0700
committerRobert Griesemer <gri@golang.org>2008-10-20 10:01:34 -0700
commite58cb05d12a9df5e670b87d66e7b9c71a3acbe54 (patch)
treeca593089965ca7075a9dffd9aecc2af6c8170505 /usr/gri/pretty/parser.go
parent30a3a97df13bd7b65d66431d5e3220e5b2b6948f (diff)
downloadgolang-e58cb05d12a9df5e670b87d66e7b9c71a3acbe54.tar.gz
- removed need for lhs field in stat node
- as a result deleted some more code R=r OCL=17449 CL=17449
Diffstat (limited to 'usr/gri/pretty/parser.go')
-rw-r--r--usr/gri/pretty/parser.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr/gri/pretty/parser.go b/usr/gri/pretty/parser.go
index 47f4630f4..db3856d86 100644
--- a/usr/gri/pretty/parser.go
+++ b/usr/gri/pretty/parser.go
@@ -904,13 +904,15 @@ func (P *Parser) ParseSimpleStat() *Node.Stat {
Scanner.SUB_ASSIGN, Scanner.MUL_ASSIGN, Scanner.QUO_ASSIGN,
Scanner.REM_ASSIGN, Scanner.AND_ASSIGN, Scanner.OR_ASSIGN,
Scanner.XOR_ASSIGN, Scanner.SHL_ASSIGN, Scanner.SHR_ASSIGN:
- s = Node.NewStat(P.pos, P.tok);
+ // assignment
+ pos, tok := P.pos, P.tok;
P.Next();
- s.lhs = x;
- s.expr = P.ParseExpressionList();
- if l, r := x.len(), s.expr.len(); l > 1 && r > 1 && l != r {
+ y := P.ParseExpressionList();
+ if xl, yl := x.len(), y.len(); xl > 1 && yl > 1 && xl != yl {
P.Error(x.pos, "arity of lhs doesn't match rhs");
}
+ s = Node.NewStat(x.pos, Scanner.EXPRSTAT);
+ s.expr = Node.NewExpr(pos, tok, x, y);
default:
var pos, tok int;