replay CL 19916 and CL 19913 now that the build can handle them

TBR=r
OCL=19924
CL=19934
This commit is contained in:
Russ Cox 2008-11-24 14:51:33 -08:00
parent 0a20746cac
commit 387df5e176
15 changed files with 667 additions and 160 deletions

View file

@ -36,14 +36,13 @@ func AddrToPtrString(Addr) *string
func AddrToPtrBool(Addr) *bool
func AddrToPtrRuntimeArray(Addr) *RuntimeArray
func PtrRuntimeArrayToAddr(*RuntimeArray) Addr
export type Empty interface {} // TODO(r): Delete when no longer needed?
func AddrToPtrInterface(Addr) *interface{}
export type Value interface {
Kind() int;
Type() Type;
Addr() Addr;
Interface() Empty;
Interface() interface {};
}
// Common fields and functionality for all values
@ -66,7 +65,7 @@ func (c *Common) Addr() Addr {
return c.addr
}
func (c *Common) Interface() Empty {
func (c *Common) Interface() interface {} {
return sys.unreflect(*AddrToPtrAddr(c.addr), c.typ.String());
}
@ -714,12 +713,17 @@ func StructCreator(typ Type, addr Addr) Value {
export type InterfaceValue interface {
Kind() int;
Type() Type;
Get() interface {};
}
type InterfaceValueStruct struct {
Common
}
func (v *InterfaceValueStruct) Get() interface{} {
return *AddrToPtrInterface(v.addr);
}
func InterfaceCreator(typ Type, addr Addr) Value {
return &InterfaceValueStruct{ Common{InterfaceKind, typ, addr} }
}
@ -824,7 +828,7 @@ export func NewOpenArrayValue(typ ArrayType, len, cap int) ArrayValue {
return NewValueAddr(typ, PtrRuntimeArrayToAddr(array));
}
export func NewValue(e Empty) Value {
export func NewValue(e interface {}) Value {
value, typestring := sys.reflect(e);
p, ok := typecache[typestring];
if !ok {