1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:07:56 -07:00

- fix parse heuristic: make(x) must accept a type for x

R=r
OCL=22171
CL=22171
This commit is contained in:
Robert Griesemer 2009-01-06 15:30:26 -08:00
parent 344b16512c
commit e286260686

View 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 {