mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
more on type complex.
getting close. R=rsc CC=golang-dev https://golang.org/cl/224105
This commit is contained in:
parent
305f5433f3
commit
7d4b1e4c0d
11 changed files with 442 additions and 10 deletions
|
|
@ -186,6 +186,63 @@ 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()) }
|
||||
|
||||
// IntValue represents an int value.
|
||||
type IntValue struct {
|
||||
value
|
||||
|
|
@ -1246,6 +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 *IntType:
|
||||
return (*IntValue)(v)
|
||||
case *Int8Type:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue