diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-12 20:33:22 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-12 20:33:22 +0000 |
commit | b3e2a6c9a7ee815324c4902eb65f75152989ad61 (patch) | |
tree | 33b14dcd566e3f484c612221423ad78d80bfe383 /libgo/go/reflect | |
parent | c0521a10c50156c94b2e80b7e5ce40763dde66e8 (diff) | |
download | gcc-b3e2a6c9a7ee815324c4902eb65f75152989ad61.tar.gz |
compiler, reflect: Handle package path like gc compiler.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188482 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/reflect')
-rw-r--r-- | libgo/go/reflect/type.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go index 4999824c919..a264ef1e082 100644 --- a/libgo/go/reflect/type.go +++ b/libgo/go/reflect/type.go @@ -83,6 +83,9 @@ type Type interface { // compare the Types directly. String() string + // Used internally by gccgo--the string retaining quoting. + rawString() string + // Kind returns the specific kind of this type. Kind() Kind @@ -432,7 +435,24 @@ func (t *commonType) toType() Type { return canonicalize(t) } -func (t *commonType) String() string { return *t.string } +func (t *commonType) rawString() string { return *t.string } + +func (t *commonType) String() string { + // For gccgo, strip out quoted strings. + s := *t.string + var q bool + r := make([]byte, len(s)) + j := 0 + for i := 0; i < len(s); i++ { + if s[i] == '"' { + q = !q + } else if !q { + r[j] = s[i] + j++ + } + } + return string(r[:j]) +} func (t *commonType) Size() uintptr { return t.size } @@ -942,7 +962,7 @@ func canonicalize(t Type) Type { u := t.uncommon() var s string if u == nil || u.PkgPath() == "" { - s = t.String() + s = t.rawString() } else { s = u.PkgPath() + "." + u.Name() } |