diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-01-28 16:45:45 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-01-28 16:45:45 -0800 |
| commit | 0e1305abc2e1e7dad8af5a319779b393114931de (patch) | |
| tree | f77c48f526fdab2b36eb5cdbc056692e91c85f05 /src/cmd/api/goapi.go | |
| parent | 91e99c13457109e3571767cae3fc56c472bdd7dc (diff) | |
| download | go-git-0e1305abc2e1e7dad8af5a319779b393114931de.tar.gz | |
cmd/api: normalize byte to uint8 and rune to int32
R=golang-dev, adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7195049
Diffstat (limited to 'src/cmd/api/goapi.go')
| -rw-r--r-- | src/cmd/api/goapi.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 1ee852ea79..906cd3a68d 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -1140,10 +1140,21 @@ func (w *Walker) namelessField(f *ast.Field) *ast.Field { } } +var ( + byteRx = regexp.MustCompile(`\bbyte\b`) + runeRx = regexp.MustCompile(`\brune\b`) +) + func (w *Walker) emitFeature(feature string) { if !w.wantedPkg[w.curPackageName] { return } + if strings.Contains(feature, "byte") { + feature = byteRx.ReplaceAllString(feature, "uint8") + } + if strings.Contains(feature, "rune") { + feature = runeRx.ReplaceAllString(feature, "int32") + } f := strings.Join(w.scope, ", ") + ", " + feature if _, dup := w.features[f]; dup { panic("duplicate feature inserted: " + f) @@ -1159,6 +1170,7 @@ func (w *Walker) emitFeature(feature string) { } panic("feature contains newlines: " + f) } + w.features[f] = true if *verbose { log.Printf("feature: %s", f) |
