(typ Expr)
| 1338 | } |
| 1339 | |
| 1340 | func (p *parser) typeInstance(typ Expr) Expr { |
| 1341 | if trace { |
| 1342 | defer p.trace("typeInstance")() |
| 1343 | } |
| 1344 | |
| 1345 | pos := p.pos() |
| 1346 | p.want(_Lbrack) |
| 1347 | x := new(IndexExpr) |
| 1348 | x.pos = pos |
| 1349 | x.X = typ |
| 1350 | if p.tok == _Rbrack { |
| 1351 | p.syntaxError("expecting type") |
| 1352 | x.Index = p.badExpr() |
| 1353 | } else { |
| 1354 | x.Index, _ = p.typeList() |
| 1355 | } |
| 1356 | p.want(_Rbrack) |
| 1357 | return x |
| 1358 | } |
| 1359 | |
| 1360 | // If context != "", type parameters are not permitted. |
| 1361 | func (p *parser) funcType(context string, tparamList *[]*Field) *FuncType { |
no test coverage detected