]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: address TODO (better comment)
authorRobert Griesemer <gri@golang.org>
Wed, 18 Nov 2015 21:09:14 +0000 (13:09 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 18 Nov 2015 22:26:24 +0000 (22:26 +0000)
For #13243.

Change-Id: I544a8c44971fad126103157575e983ab528309bf
Reviewed-on: https://go-review.googlesource.com/17044
Reviewed-by: Chris Manghane <cmang@golang.org>
src/cmd/compile/internal/gc/parser.go

index f2f84eed4cc516455e3019f5569bb204e94bbd31..94814cb5398abc274a17d2683e56909471f88e8c 100644 (file)
@@ -1482,6 +1482,11 @@ func (p *parser) operand(keep_parens bool) *Node {
                p.advance()
                return nil
        }
+
+       // Syntactically, composite literals are operands. Because a complit
+       // type may be a qualified identifier which is handled by pexpr
+       // (together with selector expressions), complits are parsed there
+       // as well (operand is only called from pexpr).
 }
 
 // go.y:pexpr, pexpr_no_paren
@@ -1581,13 +1586,9 @@ loop:
                        x.Isddd = ddd
 
                case '{':
-                       // TODO(gri) should this (complit acceptance) be in operand?
-                       // accept ()'s around the complit type but complain if we have a complit
-                       // (issue 13243)
-                       t := x
-                       for t.Op == OPAREN {
-                               t = t.Left
-                       }
+                       // operand may have returned a parenthesized complit
+                       // type; accept it but complain if we have a complit
+                       t := unparen(x)
                        // determine if '{' belongs to a complit or a compound_stmt
                        complit_ok := false
                        switch t.Op {