// will cause a crash.
CanSet() bool;
+ // SetValue assigns v to the value; v must have the same type as the value.
+ SetValue(v Value);
+
// Addr returns a pointer to the underlying data.
// It is for advanced clients that also
// import the "unsafe" package.
*(*bool)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *BoolValue) SetValue(x Value) {
+ v.Set(x.(*BoolValue).Get());
+}
+
// FloatValue represents a float value.
type FloatValue struct {
value;
*(*float)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *FloatValue) SetValue(x Value) {
+ v.Set(x.(*FloatValue).Get());
+}
+
// Float32Value represents a float32 value.
type Float32Value struct {
value;
*(*float32)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Float32Value) SetValue(x Value) {
+ v.Set(x.(*Float32Value).Get());
+}
+
// Float64Value represents a float64 value.
type Float64Value struct {
value;
*(*float64)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Float64Value) SetValue(x Value) {
+ v.Set(x.(*Float64Value).Get());
+}
+
// IntValue represents an int value.
type IntValue struct {
value;
*(*int)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *IntValue) SetValue(x Value) {
+ v.Set(x.(*IntValue).Get());
+}
+
// Int8Value represents an int8 value.
type Int8Value struct {
value;
*(*int8)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Int8Value) SetValue(x Value) {
+ v.Set(x.(*Int8Value).Get());
+}
+
// Int16Value represents an int16 value.
type Int16Value struct {
value;
*(*int16)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Int16Value) SetValue(x Value) {
+ v.Set(x.(*Int16Value).Get());
+}
+
// Int32Value represents an int32 value.
type Int32Value struct {
value;
*(*int32)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Int32Value) SetValue(x Value) {
+ v.Set(x.(*Int32Value).Get());
+}
+
// Int64Value represents an int64 value.
type Int64Value struct {
value;
*(*int64)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Int64Value) SetValue(x Value) {
+ v.Set(x.(*Int64Value).Get());
+}
+
// StringValue represents a string value.
type StringValue struct {
value;
*(*string)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *StringValue) SetValue(x Value) {
+ v.Set(x.(*StringValue).Get());
+}
+
// UintValue represents a uint value.
type UintValue struct {
value;
*(*uint)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *UintValue) SetValue(x Value) {
+ v.Set(x.(*UintValue).Get());
+}
+
// Uint8Value represents a uint8 value.
type Uint8Value struct {
value;
*(*uint8)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Uint8Value) SetValue(x Value) {
+ v.Set(x.(*Uint8Value).Get());
+}
+
// Uint16Value represents a uint16 value.
type Uint16Value struct {
value;
*(*uint16)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Uint16Value) SetValue(x Value) {
+ v.Set(x.(*Uint16Value).Get());
+}
+
// Uint32Value represents a uint32 value.
type Uint32Value struct {
value;
*(*uint32)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Uint32Value) SetValue(x Value) {
+ v.Set(x.(*Uint32Value).Get());
+}
+
// Uint64Value represents a uint64 value.
type Uint64Value struct {
value;
*(*uint64)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *Uint64Value) SetValue(x Value) {
+ v.Set(x.(*Uint64Value).Get());
+}
+
// UintptrValue represents a uintptr value.
type UintptrValue struct {
value;
*(*uintptr)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *UintptrValue) SetValue(x Value) {
+ v.Set(x.(*UintptrValue).Get());
+}
+
// UnsafePointerValue represents an unsafe.Pointer value.
type UnsafePointerValue struct {
value;
*(*unsafe.Pointer)(v.addr) = x;
}
+// Set sets v to the value x.
+func (v *UnsafePointerValue) SetValue(x Value) {
+ v.Set(unsafe.Pointer(x.(*UnsafePointerValue).Get()));
+}
+
func typesMustMatch(t1, t2 Type) {
if t1 != t2 {
panicln("type mismatch:", t1.String(), "!=", t2.String());
ArrayCopy(v, x);
}
+// Set sets v to the value x.
+func (v *ArrayValue) SetValue(x Value) {
+ v.Set(x.(*ArrayValue));
+}
+
// Elem returns the i'th element of v.
func (v *ArrayValue) Elem(i int) Value {
typ := v.typ.(*ArrayType).Elem();
*v.slice() = *x.slice();
}
+// Set sets v to the value x.
+func (v *SliceValue) SetValue(x Value) {
+ v.Set(x.(*SliceValue));
+}
+
// Slice returns a sub-slice of the slice v.
func (v *SliceValue) Slice(beg, end int) *SliceValue {
cap := v.Cap();
*(*uintptr)(v.addr) = *(*uintptr)(x.addr);
}
+// Set sets v to the value x.
+func (v *ChanValue) SetValue(x Value) {
+ v.Set(x.(*ChanValue));
+}
+
// Get returns the uintptr value of v.
// It is mainly useful for printing.
func (v *ChanValue) Get() uintptr {
// A FuncValue represents a function value.
type FuncValue struct {
value;
- first Value;
+ first *value;
isInterface bool;
}
*(*uintptr)(v.addr) = *(*uintptr)(x.addr);
}
+// Set sets v to the value x.
+func (v *FuncValue) SetValue(x Value) {
+ v.Set(x.(*FuncValue));
+}
+
// Method returns a FuncValue corresponding to v's i'th method.
// The arguments to a Call on the returned FuncValue
// should not include a receiver; the FuncValue will use v
setiface(t, &i, v.addr);
}
+// Set sets v to the value x.
+func (v *InterfaceValue) SetValue(x Value) {
+ v.Set(x);
+}
+
// Method returns a FuncValue corresponding to v's i'th method.
// The arguments to a Call on the returned FuncValue
// should not include a receiver; the FuncValue will use v
*(*uintptr)(v.addr) = *(*uintptr)(x.addr);
}
+// Set sets v to the value x.
+func (v *MapValue) SetValue(x Value) {
+ v.Set(x.(*MapValue));
+}
+
// implemented in ../pkg/runtime/reflect.cgo
func mapaccess(m, key, val *byte) bool
func mapassign(m, key, val *byte)
*(*uintptr)(v.addr) = *(*uintptr)(x.addr);
}
+// Set sets v to the value x.
+func (v *PtrValue) SetValue(x Value) {
+ v.Set(x.(*PtrValue));
+}
+
// PointTo changes v to point to x.
func (v *PtrValue) PointTo(x Value) {
if !x.CanSet() {
memmove(v.addr, x.addr, v.typ.Size());
}
+// Set sets v to the value x.
+func (v *StructValue) SetValue(x Value) {
+ v.Set(x.(*StructValue));
+}
+
// Field returns the i'th field of the struct.
func (v *StructValue) Field(i int) Value {
t := v.typ.(*StructType);