mirror of
https://github.com/golang/go
synced 2024-11-19 04:54:41 -07:00
3cd124fa3e
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>
12 lines
153 B
Go
12 lines
153 B
Go
package badstmt
|
|
|
|
import (
|
|
"golang.org/x/tools/internal/lsp/foo"
|
|
)
|
|
|
|
func _() {
|
|
go func() {
|
|
defer foo. //@complete(" //", Foo, IntFoo, StructFoo)
|
|
}
|
|
}
|