p.xnest--
case _Lparen:
- x = p.call(x)
+ t := new(CallExpr)
+ t.pos = pos
+ t.Fun = x
+ t.ArgList, t.HasDots = p.argList()
+ x = t
case _Lbrace:
// operand may have returned a parenthesized complit
}
// Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ "," ] ] ")" .
-func (p *parser) call(fun Expr) *CallExpr {
+func (p *parser) argList() (list []Expr, hasDots bool) {
if trace {
- defer p.trace("call")()
+ defer p.trace("argList")()
}
- // call or conversion
- // convtype '(' expr ocomma ')'
- c := new(CallExpr)
- c.pos = p.pos()
- c.Fun = fun
-
p.want(_Lparen)
p.xnest++
for p.tok != _EOF && p.tok != _Rparen {
- c.ArgList = append(c.ArgList, p.expr())
- c.HasDots = p.got(_DotDotDot)
- if !p.ocomma(_Rparen) || c.HasDots {
+ list = append(list, p.expr())
+ hasDots = p.got(_DotDotDot)
+ if !p.ocomma(_Rparen) || hasDots {
break
}
}
p.xnest--
p.want(_Rparen)
- return c
+ return
}
// ----------------------------------------------------------------------------