Commit 96cfd154 authored by Russ Cox's avatar Russ Cox

direct all interface extraction to InterfaceValue.Get.

delete unnecessary reflect. throughout

R=r
DELTA=124  (18 added, 0 deleted, 106 changed)
OCL=29173
CL=29175
parent fb5aa46e
This diff is collapsed.
......@@ -60,7 +60,7 @@ func (c *commonValue) Interface() interface {} {
var i interface {};
switch {
case c.typ.Kind() == InterfaceKind:
i = *(*interface{})(c.addr);
panic("not reached"); // InterfaceValue overrides this method
case c.typ.Size() > 8: // TODO(rsc): how do we know it is 8?
i = unsafe.Unreflect(uint64(uintptr(c.addr)), c.typ.String(), true);
default:
......@@ -794,6 +794,10 @@ func (v *interfaceValueStruct) Get() interface{} {
return *(*interface{ m() })(v.addr)
}
func (v *interfaceValueStruct) Interface() interface{} {
return v.Get();
}
func (v *interfaceValueStruct) Value() Value {
i := v.Get();
if i == nil {
......
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