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)
}