]> Cypherpunks repositories - gostls13.git/commitdiff
- fix parse heuristic: make(x) must accept a type for x
authorRobert Griesemer <gri@golang.org>
Tue, 6 Jan 2009 23:30:26 +0000 (15:30 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 6 Jan 2009 23:30:26 +0000 (15:30 -0800)
R=r
OCL=22171
CL=22171

usr/gri/pretty/parser.go

index b773d8e2338f3e15092f2f8be3f962176d933acf..1e7821505868fb6daa1ae75af7c052d26e970fc1 100644 (file)
@@ -785,8 +785,8 @@ func (P *Parser) ParseCall(x0 *AST.Expr) *AST.Expr {
        if P.tok != Scanner.RPAREN {
                P.expr_lev++;
                var t *AST.Type;
-               if x0.tok == Scanner.IDENT && x0.s == "new" {
-                       // heuristic: assume it's a new(*T, ...) call, try to parse a type
+               if x0.tok == Scanner.IDENT && (x0.s == "new" || x0.s == "make") {
+                       // heuristic: assume it's a new(T) or make(T, ...) call, try to parse a type
                        t = P.TryType();
                }
                if t != nil {