1
0
mirror of https://github.com/golang/go synced 2024-11-24 21:00:09 -07:00

Correct expression level for argument lists.

Fixes #352.

R=rsc
https://golang.org/cl/161073
This commit is contained in:
Robert Griesemer 2009-11-29 14:11:52 -08:00
parent b5358e0630
commit f3e0f214f8
2 changed files with 3 additions and 0 deletions

View File

@ -992,10 +992,12 @@ func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
}
lparen := p.expect(token.LPAREN);
p.exprLev++;
var args []ast.Expr;
if p.tok != token.RPAREN {
args = p.parseExprList()
}
p.exprLev--;
rparen := p.expect(token.RPAREN);
return &ast.CallExpr{fun, lparen, args, rparen};

View File

@ -31,6 +31,7 @@ func TestParseIllegalInputs(t *testing.T) {
var validPrograms = []interface{}{
`package main`,
`package main import "fmt" func main() { fmt.Println("Hello, World!") }`,
`package main func main() { if f(T{}) {} }`,
}