diff options
| author | Russ Cox <rsc@golang.org> | 2012-02-12 23:26:20 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-02-12 23:26:20 -0500 |
| commit | 6a75ece01c99164d04752f26d58fdfec268d9139 (patch) | |
| tree | 5270774c299f6a8b9a13e23ae0afb6b517100440 /src/pkg/runtime/error.go | |
| parent | cbe7d8db24d5d0484971f121e9b3f446e39cd3b5 (diff) | |
| download | go-6a75ece01c99164d04752f26d58fdfec268d9139.tar.xz | |
runtime: delete Type and implementations (use reflect instead)
unsafe: delete Typeof, Reflect, Unreflect, New, NewArray
Part of issue 2955 and issue 2968.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5650069
Diffstat (limited to 'src/pkg/runtime/error.go')
| -rw-r--r-- | src/pkg/runtime/error.go | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/src/pkg/runtime/error.go b/src/pkg/runtime/error.go index 4b0ee4931e..b6b520cf27 100644 --- a/src/pkg/runtime/error.go +++ b/src/pkg/runtime/error.go @@ -17,9 +17,6 @@ type Error interface { // A TypeAssertionError explains a failed type assertion. type TypeAssertionError struct { - interfaceType Type // interface had this type - concreteType Type // concrete value had this type - assertedType Type // asserted type interfaceString string concreteString string assertedString string @@ -33,7 +30,7 @@ func (e *TypeAssertionError) Error() string { if inter == "" { inter = "interface" } - if e.concreteType == nil { + if e.concreteString == "" { return "interface conversion: " + inter + " is nil, not " + e.assertedString } if e.missingMethod == "" { @@ -44,40 +41,10 @@ func (e *TypeAssertionError) Error() string { ": missing method " + e.missingMethod } -// Concrete returns the type of the concrete value in the failed type assertion. -// If the interface value was nil, Concrete returns nil. -func (e *TypeAssertionError) Concrete() Type { - return e.concreteType -} - -// Asserted returns the type incorrectly asserted by the type assertion. -func (e *TypeAssertionError) Asserted() Type { - return e.assertedType -} - -// If the type assertion is to an interface type, MissingMethod returns the -// name of a method needed to satisfy that interface type but not implemented -// by Concrete. If there are multiple such methods, -// MissingMethod returns one; which one is unspecified. -// If the type assertion is not to an interface type, MissingMethod returns an empty string. -func (e *TypeAssertionError) MissingMethod() string { - return e.missingMethod -} - // For calling from C. -func newTypeAssertionError(pt1, pt2, pt3 *Type, ps1, ps2, ps3 *string, pmeth *string, ret *interface{}) { - var t1, t2, t3 Type +func newTypeAssertionError(ps1, ps2, ps3 *string, pmeth *string, ret *interface{}) { var s1, s2, s3, meth string - if pt1 != nil { - t1 = *pt1 - } - if pt2 != nil { - t2 = *pt2 - } - if pt3 != nil { - t3 = *pt3 - } if ps1 != nil { s1 = *ps1 } @@ -90,7 +57,7 @@ func newTypeAssertionError(pt1, pt2, pt3 *Type, ps1, ps2, ps3 *string, pmeth *st if pmeth != nil { meth = *pmeth } - *ret = &TypeAssertionError{t1, t2, t3, s1, s2, s3, meth} + *ret = &TypeAssertionError{s1, s2, s3, meth} } // An errorString represents a runtime error described by a single string. |
