Commit 54a72d90 authored by Luigi Riefolo's avatar Luigi Riefolo Committed by Robert Griesemer

go/doc: add IsPredeclared function

IsPredeclared allows simplifying src/golang.org/x/tools/godoc/linkify.go

Change-Id: I56b3223896f844630bc2e940255572d1682f0d06
Reviewed-on: https://go-review.googlesource.com/29870Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
parent 097a581d
......@@ -809,6 +809,11 @@ func noteBodies(notes []*Note) []string {
// ----------------------------------------------------------------------------
// Predeclared identifiers
// IsPredeclared reports whether s is a predeclared identifier.
func IsPredeclared(s string) bool {
return predeclaredTypes[s] || predeclaredFuncs[s] || predeclaredConstants[s]
}
var predeclaredTypes = map[string]bool{
"bool": true,
"byte": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment