mirror of
https://github.com/golang/go.git
synced 2025-05-07 08:32:59 +00:00
Now when trying to fix *ast.BadStmt, we parse the manually extracted expression using parser.ParseFile instead of parser.ParseExpr. ParseFile will yield *ast.BadStmt nodes for any bad statements nested in our first bad statement, allowing us to fix them recursively. To turn our expression into a "valid" file we can pass to parser.ParseFile, I wrapped it thusly: package fake func _() { <our expression> } Change-Id: I0d4fd4ebce6450021da8e03caa11d0ae5152ea8d Reviewed-on: https://go-review.googlesource.com/c/tools/+/194342 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>