// Value:
-// ConcreteValue | InterfaceValue
-func (deb *debugger) value(indent tab, id typeId, n int) int {
- if id == tInterface {
- return deb.interfaceValue(indent, n)
- }
- return deb.concreteValue(indent, id, n)
-}
-
-
-// ConcreteValue:
// SingletonValue | StructValue
-func (deb *debugger) concreteValue(indent tab, id typeId, n int) int {
+func (deb *debugger) value(indent tab, id typeId, n int) int {
wire, ok := deb.wireType[id]
if ok && wire.StructT != nil {
return deb.structValue(indent, id, n)
}
// SingletonValue:
-// int(0) FieldValue
+// uint(0) FieldValue
func (deb *debugger) singletonValue(indent tab, id typeId, n int) int {
deb.dump(n, "Singleton value")
// is it a builtin type?
if !ok && wire == nil {
errorf("type id %d not defined", id)
}
- m, w := deb.readInt()
+ m, w := deb.readUint()
if m != 0 {
errorf("expected zero; got %d", n)
}
}
// fieldValue prints a value of any type, such as a struct field.
+// FieldValue:
+// builtinValue | ArrayValue | MapValue | SliceValue | StructValue | InterfaceValue
func (deb *debugger) fieldValue(indent tab, id typeId, n int) int {
_, ok := builtinIdToType[id]
if ok {
+ if id == tInterface {
+ return deb.interfaceValue(indent, n)
+ }
return deb.printBuiltin(indent, id, n)
}
wire, ok := deb.wireType[id]
// printBuiltin prints a value not of a fundamental type, that is,
// one whose type is known to gobs at bootstrap time.
-// That includes interfaces, although they may require
-// more unpacking down the line.
func (deb *debugger) printBuiltin(indent tab, id typeId, n int) int {
switch id {
case tBool:
deb.r.Read(b)
fmt.Fprintf(os.Stderr, "%s%q\n", indent, b)
return w + int(x)
- case tInterface:
- return deb.interfaceValue(indent, n)
default:
fmt.Print("unknown\n")
}
// ArrayValue:
-// uint(n) Value*n
+// uint(n) FieldValue*n
func (deb *debugger) arrayValue(indent tab, wire *wireType, n int) int {
elemId := wire.ArrayT.Elem
u, w := deb.readUint()
}
// MapValue:
-// uint(n) (Value Value)*n [n (key, value) pairs]
+// uint(n) (FieldValue FieldValue)*n [n (key, value) pairs]
func (deb *debugger) mapValue(indent tab, wire *wireType, n int) int {
keyId := wire.MapT.Key
elemId := wire.MapT.Elem
}
// SliceValue:
-// uint(n) (n Values)
+// uint(n) (n FieldValue)
func (deb *debugger) sliceValue(indent tab, wire *wireType, n int) int {
elemId := wire.SliceT.Elem
u, w := deb.readUint()
}
// StructValue:
-// (int(fieldDelta) FieldValue)*
+// (uint(fieldDelta) FieldValue)*
func (deb *debugger) structValue(indent tab, id typeId, n int) int {
deb.dump(n, "Start of struct value of %q id=%d\n<<\n", id.name(), id)
fmt.Fprintf(os.Stderr, "%s%s struct {\n", indent, id.name())
TypeDefinition:
int(-typeId) encodingOfWireType
Value:
- ConcreteValue | InterfaceValue
-ConcreteValue:
SingletonValue | StructValue
SingletonValue:
- int(0) FieldValue
+ uint(0) FieldValue
+FieldValue:
+ builtinValue | ArrayValue | MapValue | SliceValue | StructValue | InterfaceValue
InterfaceValue:
NilInterfaceValue | NonNilInterfaceValue
NilInterfaceValue:
DelimitedValue:
uint(length) Value
ArrayValue:
- uint(n) Value*n [n elements]
+ uint(n) FieldValue*n [n elements]
MapValue:
- uint(n) (Value Value)*n [n (key, value) pairs]
+ uint(n) (FieldValue FieldValue)*n [n (key, value) pairs]
SliceValue:
- uint(n) Value*n [n elements]
+ uint(n) FieldValue*n [n elements]
StructValue:
(uint(fieldDelta) FieldValue)*
*/
tBool = bootstrapType("bool", false, 1)
tInt = bootstrapType("int", int(0), 2)
tUint = bootstrapType("uint", uint(0), 3)
- tFloat = bootstrapType("float", 0.0, 4)
+ tFloat = bootstrapType("float", float64(0), 4)
tBytes = bootstrapType("bytes", make([]byte, 0), 5)
tString = bootstrapType("string", "", 6)
tComplex = bootstrapType("complex", 0+0i, 7)
Register(uint32(0))
Register(uint64(0))
Register(float32(0))
- Register(0.0)
+ Register(float64(0))
Register(complex64(0i))
Register(complex128(0i))
Register(false)