1
0
mirror of https://github.com/golang/go synced 2024-11-19 01:54:39 -07:00
go/internal/lsp/testdata/badstmt/badstmt_4.go.in
Muir Manders 3cd124fa3e internal/lsp: fix completion for nested *ast.BadStmt
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>
2019-09-10 16:55:22 +00:00

12 lines
153 B
Go

package badstmt
import (
"golang.org/x/tools/internal/lsp/foo"
)
func _() {
go func() {
defer foo. //@complete(" //", Foo, IntFoo, StructFoo)
}
}