Skip to content

Commit

Permalink
Merge pull request #42 from seborama/ReservedKeywords
Browse files Browse the repository at this point in the history
More exhaustive list of blacklisted identifiers
  • Loading branch information
zimmski committed Sep 12, 2016
2 parents 5e9cc5f + 2b727ce commit f1fdf12
Showing 1 changed file with 69 additions and 7 deletions.
76 changes: 69 additions & 7 deletions astutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,75 @@ type identifierWalker struct {
}

var blacklistedIdentifiers = map[string]bool{
"_": true,
"append": true,
"close": true,
"go": true,
"func": true,
"len": true,
"nil": true,
// blank identifier
"_": true,
// builtin - can be used as identifier but are unlikely to be in practice
// (except perhaps with panic, defer, recover, print, prinln?)
"bool": true,
"true": true,
"false": true,
"uint8": true,
"uint16": true,
"uint32": true,
"uint64": true,
"int8": true,
"int16": true,
"int32": true,
"int64": true,
"float32": true,
"float64": true,
"complex64": true,
"complex128": true,
"string": true,
"int": true,
"uint": true,
"uintptr": true,
"byte": true,
"rune": true,
"iota": true,
"nil": true,
"append": true,
"copy": true,
"delete": true,
"len": true,
"cap": true,
"make": true,
"new": true,
"complex": true,
"real": true,
"imag": true,
"close": true,
"panic": true,
"recover": true,
"print": true,
"println": true,
"error": true,
// reserved keywords - cannot be used as identifier.
"break": true,
"default": true,
"func": true,
"interface": true,
"select": true,
"case": true,
"defer": true,
"go": true,
"map": true,
"struct": true,
"chan": true,
"else": true,
"goto": true,
"package": true,
"switch": true,
"const": true,
"fallthrough": true,
"if": true,
"range": true,
"type": true,
"continue": true,
"for": true,
"import": true,
"return": true,
"var": true,
}

func checkForSelectorExpr(node ast.Expr) bool {
Expand Down

0 comments on commit f1fdf12

Please sign in to comment.