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:
parent
b5358e0630
commit
f3e0f214f8
@ -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};
|
||||
|
@ -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{}) {} }`,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user