mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: cleaning lex.go
Cleaning along the way:
-convert variable types from int to bool
-remove unnecessary functions
-remove unnecessary type conversion
-remove unnecessary variable declarations
-transform struct{string,string} with lookup to map[string]string
This change passes go build -toolexec 'toolstash -cmp' -a std.
Change-Id: I259728fe4afd7f23b67f08fab856ce0abee57b21
Reviewed-on: https://go-review.googlesource.com/14435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
19d262ffdf
commit
211cdf1e00
6 changed files with 120 additions and 153 deletions
|
|
@ -18,15 +18,19 @@ func atoi(s string) int {
|
|||
return int(n)
|
||||
}
|
||||
|
||||
func isalnum(c int) bool {
|
||||
return isalpha(c) || isdigit(c)
|
||||
func isSpace(c int) bool {
|
||||
return c == ' ' || c == '\t' || c == '\n' || c == '\r'
|
||||
}
|
||||
|
||||
func isalpha(c int) bool {
|
||||
func isAlnum(c int) bool {
|
||||
return isAlpha(c) || isDigit(c)
|
||||
}
|
||||
|
||||
func isAlpha(c int) bool {
|
||||
return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'
|
||||
}
|
||||
|
||||
func isdigit(c int) bool {
|
||||
func isDigit(c int) bool {
|
||||
return '0' <= c && c <= '9'
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue