nuva forma de creacion de cvalue

master
dev 1 year ago
parent 346622b757
commit 53d28a0f13

@ -47,9 +47,6 @@ type (
)
func CreateCVal (value any) CVal {
var f cValTypeCreateFunc
@ -58,7 +55,7 @@ func CreateCVal (value any) CVal {
// case *any : f = G.cValTypeCreators[ 1/* CValTypeAny.Index() */].pointerCreator
// case []any : f = G.cValTypeCreators[ 1/* CValTypeAny.Index() */].listCreator
// case func()any : f = G.cValTypeCreators[ 1/* CValTypeAny.Index() */].deferCreator
case bool : f = G.cValTypeCreators[ 2/* CValTypeBool.Index() */].valueCreator
// case *bool : f = G.cValTypeCreators[ 2/* CValTypeBool.Index() */].pointerCreator
// case []bool : f = G.cValTypeCreators[ 2/* CValTypeBool.Index() */].listCreator
@ -211,60 +208,61 @@ func CreateCVal (value any) CVal {
}
func getCreatorForCValPointer(value reflect.Value) cValTypeCreateFunc {
func getCreatorForCValPointer(value any) cValTypeCreateFunc {
buildType := CValTypeAny
switch value.Interface().(type) {
case *any : buildType = CValTypeAny
case *bool : buildType = CValTypeBool
case *int :
switch value.(type) {
case *any : buildType = CValTypeAny
case *bool : buildType = CValTypeBool
case *int :
buildType = CValTypeInt
case *int8 :
case *int8 :
buildType = CValTypeInt8
case *int16 :
case *int16 :
buildType = CValTypeInt16
case *int32 :
case *int32 :
buildType = CValTypeInt32
case *int64 :
case *int64 :
buildType = CValTypeInt64
case *uint :
case *uint :
buildType = CValTypeUint
case *uint8 : buildType = CValTypeUint8
case *uint16: buildType = CValTypeUint16
case *uint32: buildType = CValTypeUint32
case *uint64: buildType = CValTypeUint64
case *uintptr:
buildType = CValTypeUint64
case *float32:
buildType = CValTypeUint64
case *float64:
buildType = CValTypeUint64
case *uint8 : buildType = CValTypeUint8
case *uint16 : buildType = CValTypeUint16
case *uint32 : buildType = CValTypeUint32
case *uint64 : buildType = CValTypeUint64
case *uintptr :
buildType = CValTypeUintptr
case *float32 :
buildType = CValTypeFloat32
case *float64 :
buildType = CValTypeFloat64
case *complex64 :
buildType = CValTypeUint64
buildType = CValTypeComplex64
case *complex128:
buildType = CValTypeUint64
buildType = CValTypeComplex128
case *time.Duration :
buildType = CValTypeUint64
case *time.Time : buildType = CValTypeUint64
buildType = CValTypeDuration
case *time.Time : buildType = CValTypeDate
case *string :
buildType = CValTypeUint64
buildType = CValTypeString
case *[]uint8 :
buildType = CValTypeUint64
buildType = CValTypeBytes
case *excs.Stack:
buildType = CValTypeUint64
buildType = CValTypeStack
case *blrs.Baleable:
buildType = CValTypeUint64
case *error :
buildType = CValTypeUint64
case *CVal :
buildType = CValTypeUint64
case *[]CVal:
buildType = CValTypeUint64
buildType = CValTypeBaleable
case *error :
buildType = CValTypeError
case *CVal :
buildType = CValTypeCVal
case *map[string]CVal :
buildType = CValTypeFields
default:
buildType = CValTypeAny
}
return f
return G.cValTypeCreators[buildType.Index()].pointerCreator
}
func createCValByList (value reflect.Value) CVal {
return CVal{}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.