diff options
Diffstat (limited to 'src/pkg/reflect/value.go')
| -rw-r--r-- | src/pkg/reflect/value.go | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go index 2543499f5..32accddf5 100644 --- a/src/pkg/reflect/value.go +++ b/src/pkg/reflect/value.go @@ -186,62 +186,62 @@ func (v *Float64Value) Set(x float64) { // Set sets v to the value x. func (v *Float64Value) SetValue(x Value) { v.Set(x.(*Float64Value).Get()) } -//// ComplexValue represents a complex value. -//type ComplexValue struct { -// value -//} -// -//// Get returns the underlying complex value. -//func (v *ComplexValue) Get() complex { return *(*complex)(v.addr) } -// -//// Set sets v to the value x. -//func (v *ComplexValue) Set(x complex) { -// if !v.canSet { -// panic(cannotSet) -// } -// *(*complex)(v.addr) = x -//} -// -//// Set sets v to the value x. -//func (v *ComplexValue) SetValue(x Value) { v.Set(x.(*ComplexValue).Get()) } -// -//// Complex64Value represents a complex64 value. -//type Complex64Value struct { -// value -//} -// -//// Get returns the underlying complex64 value. -//func (v *Complex64Value) Get() complex64 { return *(*complex64)(v.addr) } -// -//// Set sets v to the value x. -//func (v *Complex64Value) Set(x complex64) { -// if !v.canSet { -// panic(cannotSet) -// } -// *(*complex64)(v.addr) = x -//} -// -//// Set sets v to the value x. -//func (v *Complex64Value) SetValue(x Value) { v.Set(x.(*Complex64Value).Get()) } -// -//// Complex128Value represents a complex128 value. -//type Complex128Value struct { -// value -//} -// -//// Get returns the underlying complex128 value. -//func (v *Complex128Value) Get() complex128 { return *(*complex128)(v.addr) } -// -//// Set sets v to the value x. -//func (v *Complex128Value) Set(x complex128) { -// if !v.canSet { -// panic(cannotSet) -// } -// *(*complex128)(v.addr) = x -//} -// -//// Set sets v to the value x. -//func (v *Complex128Value) SetValue(x Value) { v.Set(x.(*Complex128Value).Get()) } +// ComplexValue represents a complex value. +type ComplexValue struct { + value +} + +// Get returns the underlying complex value. +func (v *ComplexValue) Get() complex { return *(*complex)(v.addr) } + +// Set sets v to the value x. +func (v *ComplexValue) Set(x complex) { + if !v.canSet { + panic(cannotSet) + } + *(*complex)(v.addr) = x +} + +// Set sets v to the value x. +func (v *ComplexValue) SetValue(x Value) { v.Set(x.(*ComplexValue).Get()) } + +// Complex64Value represents a complex64 value. +type Complex64Value struct { + value +} + +// Get returns the underlying complex64 value. +func (v *Complex64Value) Get() complex64 { return *(*complex64)(v.addr) } + +// Set sets v to the value x. +func (v *Complex64Value) Set(x complex64) { + if !v.canSet { + panic(cannotSet) + } + *(*complex64)(v.addr) = x +} + +// Set sets v to the value x. +func (v *Complex64Value) SetValue(x Value) { v.Set(x.(*Complex64Value).Get()) } + +// Complex128Value represents a complex128 value. +type Complex128Value struct { + value +} + +// Get returns the underlying complex128 value. +func (v *Complex128Value) Get() complex128 { return *(*complex128)(v.addr) } + +// Set sets v to the value x. +func (v *Complex128Value) Set(x complex128) { + if !v.canSet { + panic(cannotSet) + } + *(*complex128)(v.addr) = x +} + +// Set sets v to the value x. +func (v *Complex128Value) SetValue(x Value) { v.Set(x.(*Complex128Value).Get()) } // IntValue represents an int value. type IntValue struct { @@ -1303,12 +1303,12 @@ func newValue(typ Type, addr addr, canSet bool) Value { return (*Float32Value)(v) case *Float64Type: return (*Float64Value)(v) - // case *ComplexType: - // return (*ComplexValue)(v) - // case *Complex64Type: - // return (*Complex64Value)(v) - // case *Complex128Type: - // return (*Complex128Value)(v) + case *ComplexType: + return (*ComplexValue)(v) + case *Complex64Type: + return (*Complex64Value)(v) + case *Complex128Type: + return (*Complex128Value)(v) case *IntType: return (*IntValue)(v) case *Int8Type: |
