builtin: real/imag/complex; c/math/cmplx; patch: math/cmplx
This commit is contained in:
10
ssa/type.go
10
ssa/type.go
@@ -214,6 +214,14 @@ func (p Program) Field(typ Type, i int) Type {
|
||||
switch t := typ.raw.Type.(type) {
|
||||
case *types.Tuple:
|
||||
fld = t.At(i)
|
||||
case *types.Basic:
|
||||
switch t.Kind() {
|
||||
case types.Complex128:
|
||||
return p.Float64()
|
||||
case types.Complex64:
|
||||
return p.Float32()
|
||||
}
|
||||
panic("Field: basic type doesn't have fields")
|
||||
default:
|
||||
fld = t.Underlying().(*types.Struct).Field(i)
|
||||
}
|
||||
@@ -330,7 +338,9 @@ func (p Program) toType(raw types.Type) Type {
|
||||
case types.Float64:
|
||||
return &aType{p.ctx.DoubleType(), typ, vkFloat}
|
||||
case types.Complex64:
|
||||
return &aType{p.tyComplex64(), typ, vkComplex}
|
||||
case types.Complex128:
|
||||
return &aType{p.tyComplex128(), typ, vkComplex}
|
||||
case types.String:
|
||||
return &aType{p.rtString(), typ, vkString}
|
||||
case types.UnsafePointer:
|
||||
|
||||
Reference in New Issue
Block a user