master
dev 8 months ago
parent 8e056e6aab
commit 81c3c84733

@ -0,0 +1,8 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>cmplx</w>
<w>hashalg</w>
</words>
</dictionary>
</component>

@ -85,8 +85,12 @@ type (
uints interface {
uint | uint8 | uint16 | uint32 | uint64 | uintptr | HashAlg
}
cmplx interface{ complex64 | complex128 }
lists interface{ Bytes | Stack }
cmplx interface{
complex64 | complex128
}
lists interface{
Bytes | Stack
}
)
var (
@ -96,7 +100,6 @@ var (
ErrInvalidCValueForType = Module.MustCode("invalid_value_for_type")
uuidZero = UUID{}
bigZero = big.NewInt(0)
specs = newSpecInfos()
@ -130,7 +133,6 @@ var (
"uuid",
"date",
"bigInt",
"reflect",
"object",

@ -118,10 +118,6 @@ func MakeCFieldDuration(name string, val Duration, attr CFieldAttr) CField {
return CField{name: name, CValue: MakeCValueDuration(val), CFieldAttr: attr}
}
func MakeCFieldBigInt(name string, val *BigInt, attr CFieldAttr) CField {
return CField{name: name, CValue: MakeCValueBigInt(val), CFieldAttr: attr}
}
func MakeCFieldBytes(name string, val Bytes, attr CFieldAttr) CField {
return CField{name: name, CValue: MakeCValueBytes(val), CFieldAttr: attr}
}

@ -70,8 +70,12 @@ const (
// NoFieldAttr es el atributo por defecto — Public + Plain + NoBehavior.
const NoFieldAttr CFieldAttr = 0
type CFieldAttr uint16
// Visibility devuelve el grupo de visibilidad del atributo.
func (a CFieldAttr) Visibility() CFieldVisibility {
return CFieldVisibility(a & maskVisibility)

@ -52,7 +52,6 @@ package cvls
import (
"core/errs"
"math"
"math/big"
"time"
"unsafe"
)
@ -125,23 +124,6 @@ func MakeCValueComplex128(val complex128) CValue {
return makeCComplex[complex128](val, KindComplex128)
}
func MakeCValueBigInt(val *BigInt) CValue {
if val == nil {
return CValue{Spec: makeSpecScalar(KindBigInt), State: StateNil}
}
if val.Cmp(bigZero) == 0 {
return CValue{Spec: makeSpecScalar(KindBigInt), State: StateZero}
}
if val.IsInt64() {
return CValue{
Spec: makeSpecScalar(KindBigInt),
State: StateVersion,
intVal: val.Int64(),
}
}
return CValue{Spec: makeSpecScalar(KindBigInt), anyVal: val}
}
func MakeCValueBytes(val Bytes) CValue {
if val == nil {
@ -265,8 +247,6 @@ func (v CValue) Value() any {
val, _ = v.AsUUID()
case KindDate:
val, _ = v.AsDate()
case KindBigInt:
val, _ = v.AsBigInt()
case KindReflect:
val, _ = v.AsReflect()
case KindPackable:
@ -436,21 +416,6 @@ func (v CValue) AsDate() (Date, bool) {
return time.Unix(0, v.intVal).UTC(), true
}
func (v CValue) AsBigInt() (*BigInt, bool) {
if v.ValueKind() != KindBigInt {
return nil, false
}
if v.HasZero() {
return big.NewInt(0), true
}
if v.IsDefer() {
return v.anyVal.(func() *BigInt)(), true
}
if v.HasVersion() {
return big.NewInt(v.intVal), true
}
return v.anyVal.(*BigInt), true
}
func (v CValue) AsReflect() (Reflect, bool) { return asCValueFromAny[Reflect](v, KindReflect) }

@ -85,7 +85,6 @@ const (
/* Structs */
KindDate
KindBigInt
KindReflect
KindObject

@ -93,7 +93,6 @@ func newSpecInfos() *specInfos {
ti.specs[KindUUID] = makeSpecInfo[UUID](KindUUID, true, MakeCValueUUID)
ti.specs[KindDate] = makeSpecInfo[Date](KindDate, true, MakeCValueDate)
ti.specs[KindBigInt] = makeSpecInfo[BigInt](KindBigInt, true, MakeCValueBigInt)
ti.specs[KindObject] = makeSpecInfo[any](KindObject, true, makeCValueCObject)
ti.specs[KindReflect] = makeSpecInfo[Reflect](KindReflect, true, MakeCValueReflect)
@ -164,8 +163,6 @@ func (i *specInfos) createCValue(value any) CValue {
case Date:
return i.specs[KindDate].valMaker(value)
case BigInt:
return i.specs[KindBigInt].valMaker(value)
case Reflect:
return i.specs[KindReflect].valMaker(value)
@ -394,14 +391,10 @@ func reflectKindToKind(kind reflect.Kind, val any) Kind {
default:
// todo debe de contemplar los tipos base
switch val.(type) {
case Duration:
return KindDuration
case BigInt:
return KindBigInt
case Duration : return KindDuration
case HashAlg :
return KindHashAlg
case UUID:
return KindUUID
case UUID : return KindUUID
case Bytes :
return KindBytes
case Stack :

Loading…
Cancel
Save

Powered by TurnKey Linux.