type strings through the reflection library.
R=rsc
DELTA=187 (107 added, 28 deleted, 52 changed)
OCL=18510
CL=18510
diff --git a/src/lib/reflect/value.go b/src/lib/reflect/value.go
index 5c9c727..527f1ff 100644
--- a/src/lib/reflect/value.go
+++ b/src/lib/reflect/value.go
@@ -11,34 +11,8 @@
"reflect";
)
-
type Addr uint64 // TODO: where are ptrint/intptr etc?
-export type Value interface {
- Kind() int;
- Type() Type;
-}
-
-// Common fields and functionality for all values
-
-type Common struct {
- kind int;
- typ Type;
- addr Addr;
-}
-
-func (c *Common) Kind() int {
- return c.kind
-}
-
-func (c *Common) Type() Type {
- return c.typ
-}
-
-func NewValueAddr(typ Type, addr Addr) Value
-
-type Creator *(typ Type, addr Addr) Value
-
// Conversion functions, implemented in assembler
func AddrToPtrAddr(Addr) *Addr
func AddrToPtrInt(Addr) *int
@@ -60,6 +34,39 @@
func AddrToPtrString(Addr) *string
func AddrToPtrBool(Addr) *bool
+export type Empty interface {} // TODO(r): Delete when no longer needed?
+
+export type Value interface {
+ Kind() int;
+ Type() Type;
+ Unreflect() Empty;
+}
+
+// Common fields and functionality for all values
+
+type Common struct {
+ kind int;
+ typ Type;
+ addr Addr;
+}
+
+func (c *Common) Kind() int {
+ return c.kind
+}
+
+func (c *Common) Type() Type {
+ return c.typ
+}
+
+func (c *Common) Unreflect() Empty {
+ return sys.unreflect(*AddrToPtrAddr(c.addr), c.typ.String());
+}
+
+func NewValueAddr(typ Type, addr Addr) Value
+
+type Creator *(typ Type, addr Addr) Value
+
+
// -- Missing
export type MissingValue interface {
@@ -743,8 +750,6 @@
return NewValueAddr(typ, PtrUint8ToAddr(&data[0]));
}
-export type Empty interface {}
-
export func NewValue(e Empty) Value {
value, typestring := sys.reflect(e);
typ := ParseTypeString("", typestring);