cmd/compile/internal/syntax: more tolerant handling of missing function invocation in go/defer

Assume that an expression that is not a function call in a defer/go
statement is indeed a function that is just missing its invocation.
Report the error but continue with a sane syntax tree.

Fixes #23586.

Change-Id: Ib45ebac57c83b3e39ae4a1b137ffa291dec5b50d
Reviewed-on: https://go-review.googlesource.com/94156
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2018-02-14 16:57:28 -08:00
parent d3f6d11d84
commit 1a22738749
2 changed files with 25 additions and 1 deletions

View file

@ -758,7 +758,7 @@ func (p *parser) callStmt() *CallStmt {
// already progressed, no need to advance
cx = new(CallExpr)
cx.pos = x.Pos()
cx.Fun = p.bad()
cx.Fun = x // assume common error of missing parentheses (function invocation)
}
s.Call = cx