1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:34:41 -07:00

internal/lsp: small change to helper.go to use ast.IsExported

Use ast.IsExported instead of explicit code.

Change-Id: I1bfabb3c575debb699a51e38f502fcb99a081203
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216297
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Peter Weinberger 2020-01-24 09:47:02 -05:00
parent 628e9aa307
commit 3f4d10fc73

View File

@ -128,7 +128,7 @@ func doUses() {
continue
}
nm := fd.Name.String()
if isExported(nm) {
if ast.IsExported(nm) {
// we're looking for things like didChange
continue
}
@ -224,7 +224,7 @@ func whatis(x ast.Expr) string {
case *ast.StarExpr:
return "*" + whatis(n.X)
case *ast.Ident:
if isExported(n.Name) {
if ast.IsExported(n.Name) {
// these are from package protocol
return "protocol." + n.Name
}
@ -238,7 +238,3 @@ func whatis(x ast.Expr) string {
return fmt.Sprintf("%T", x)
}
}
func isExported(n string) bool {
return n[0] >= 'A' && n[0] <= 'Z'
}