aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-06-12 20:33:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-06-12 20:33:22 +0000
commit9690ac05c92a154b5d2ca7078d3bf6f4c7eb6c57 (patch)
tree33b14dcd566e3f484c612221423ad78d80bfe383 /libgo
parentb29e01b77bcbe5041f82007d423f2da9396d1e3b (diff)
downloadgcc-9690ac05c92a154b5d2ca7078d3bf6f4c7eb6c57.zip
gcc-9690ac05c92a154b5d2ca7078d3bf6f4c7eb6c57.tar.gz
gcc-9690ac05c92a154b5d2ca7078d3bf6f4c7eb6c57.tar.bz2
compiler, reflect: Handle package path like gc compiler.
From-SVN: r188482
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/encoding/xml/marshal_test.go2
-rw-r--r--libgo/go/html/template/escape_test.go2
-rw-r--r--libgo/go/reflect/type.go24
3 files changed, 24 insertions, 4 deletions
diff --git a/libgo/go/encoding/xml/marshal_test.go b/libgo/go/encoding/xml/marshal_test.go
index 6f0ecfc..b6978a1 100644
--- a/libgo/go/encoding/xml/marshal_test.go
+++ b/libgo/go/encoding/xml/marshal_test.go
@@ -726,7 +726,7 @@ var marshalErrorTests = []struct {
},
{
Value: map[*Ship]bool{nil: false},
- Err: "xml: unsupported type: map[*encoding/xml.Ship]bool",
+ Err: "xml: unsupported type: map[*xml.Ship]bool",
Kind: reflect.Map,
},
{
diff --git a/libgo/go/html/template/escape_test.go b/libgo/go/html/template/escape_test.go
index 6670be9..ce12c17 100644
--- a/libgo/go/html/template/escape_test.go
+++ b/libgo/go/html/template/escape_test.go
@@ -226,7 +226,7 @@ func TestEscape(t *testing.T) {
{
"badMarshaler",
`<button onclick='alert(1/{{.B}}in numbers)'>`,
- `<button onclick='alert(1/ /* json: error calling MarshalJSON for type *html/template.badMarshaler: invalid character &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
+ `<button onclick='alert(1/ /* json: error calling MarshalJSON for type *template.badMarshaler: invalid character &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
},
{
"jsMarshaler",
diff --git a/libgo/go/reflect/type.go b/libgo/go/reflect/type.go
index 4999824..a264ef1 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()
}