Commit f3e0f214 authored by Robert Griesemer's avatar Robert Griesemer

Correct expression level for argument lists.

Fixes #352.

R=rsc
https://golang.org/cl/161073
parent b5358e06
...@@ -992,10 +992,12 @@ func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr { ...@@ -992,10 +992,12 @@ func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
} }
lparen := p.expect(token.LPAREN); lparen := p.expect(token.LPAREN);
p.exprLev++;
var args []ast.Expr; var args []ast.Expr;
if p.tok != token.RPAREN { if p.tok != token.RPAREN {
args = p.parseExprList() args = p.parseExprList()
} }
p.exprLev--;
rparen := p.expect(token.RPAREN); rparen := p.expect(token.RPAREN);
return &ast.CallExpr{fun, lparen, args, rparen}; return &ast.CallExpr{fun, lparen, args, rparen};
......
...@@ -31,6 +31,7 @@ func TestParseIllegalInputs(t *testing.T) { ...@@ -31,6 +31,7 @@ func TestParseIllegalInputs(t *testing.T) {
var validPrograms = []interface{}{ var validPrograms = []interface{}{
`package main`, `package main`,
`package main import "fmt" func main() { fmt.Println("Hello, World!") }`, `package main import "fmt" func main() { fmt.Println("Hello, World!") }`,
`package main func main() { if f(T{}) {} }`,
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment