Commit e31fa68a authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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
parent 764880e2
...@@ -579,7 +579,14 @@ func (w *Walker) varValueType(vi interface{}) (string, error) { ...@@ -579,7 +579,14 @@ func (w *Walker) varValueType(vi interface{}) (string, error) {
} }
} }
// maybe a function call; maybe a conversion. Need to lookup type. // 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: default:
return "", fmt.Errorf("unknown const value type %T", vi) return "", fmt.Errorf("unknown const value type %T", vi)
} }
......
...@@ -58,14 +58,16 @@ pkg p1, type T struct ...@@ -58,14 +58,16 @@ pkg p1, type T struct
pkg p1, type TPtrExported struct pkg p1, type TPtrExported struct
pkg p1, type TPtrExported struct, embedded *Embedded pkg p1, type TPtrExported struct, embedded *Embedded
pkg p1, type TPtrUnexported struct pkg p1, type TPtrUnexported struct
pkg p1, var ByteConv []byte
pkg p1, var ChecksumError error pkg p1, var ChecksumError error
pkg p1, var SIPtr *SI pkg p1, var SIPtr *SI
pkg p1, var SIPtr2 *SI pkg p1, var SIPtr2 *SI
pkg p1, var SIVal SI pkg p1, var SIVal SI
pkg p1, var StrConv string
pkg p1, var V string pkg p1, var V string
pkg p1, var VError Error
pkg p1, var V1 uint64 pkg p1, var V1 uint64
pkg p1, var V2 p2.Twoer pkg p1, var V2 p2.Twoer
pkg p1, var VError Error
pkg p1, var X I pkg p1, var X I
pkg p1, var X int64 pkg p1, var X int64
pkg p1, var Y int pkg p1, var Y int
...@@ -27,6 +27,12 @@ var ( ...@@ -27,6 +27,12 @@ var (
V2 = ptwo.G() V2 = ptwo.G()
) )
// Variables with conversions:
var (
StrConv = string("foo")
ByteConv = []byte("foo")
)
var ChecksumError = ptwo.NewError("gzip checksum error") var ChecksumError = ptwo.NewError("gzip checksum error")
const B = 2 const B = 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment