1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:04:39 -07:00

cmd/api: work on Windows again, and make gccgo files work a bit more

handle string and []byte conversions.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5754082
This commit is contained in:
Brad Fitzpatrick 2012-03-11 17:55:15 -07:00
parent 764880e2b2
commit e31fa68a43
3 changed files with 17 additions and 2 deletions

View File

@ -579,7 +579,14 @@ func (w *Walker) varValueType(vi interface{}) (string, error) {
}
}
// maybe a function call; maybe a conversion. Need to lookup type.
return "", fmt.Errorf("not a known function %q", w.nodeString(v.Fun))
// TODO(bradfitz): this is a hack, but arguably most of this tool is,
// until the Go AST has type information.
nodeStr := w.nodeString(v.Fun)
switch nodeStr {
case "string", "[]byte":
return nodeStr, nil
}
return "", fmt.Errorf("not a known function %q", nodeStr)
default:
return "", fmt.Errorf("unknown const value type %T", vi)
}

View File

@ -58,14 +58,16 @@ pkg p1, type T struct
pkg p1, type TPtrExported struct
pkg p1, type TPtrExported struct, embedded *Embedded
pkg p1, type TPtrUnexported struct
pkg p1, var ByteConv []byte
pkg p1, var ChecksumError error
pkg p1, var SIPtr *SI
pkg p1, var SIPtr2 *SI
pkg p1, var SIVal SI
pkg p1, var StrConv string
pkg p1, var V string
pkg p1, var VError Error
pkg p1, var V1 uint64
pkg p1, var V2 p2.Twoer
pkg p1, var VError Error
pkg p1, var X I
pkg p1, var X int64
pkg p1, var Y int

View File

@ -27,6 +27,12 @@ var (
V2 = ptwo.G()
)
// Variables with conversions:
var (
StrConv = string("foo")
ByteConv = []byte("foo")
)
var ChecksumError = ptwo.NewError("gzip checksum error")
const B = 2