iterator interface chenged index and count members from int to tint 64

This commit is contained in:
2026-05-01 17:15:18 +02:00
parent 75ed88915d
commit dacbec677a
13 changed files with 65 additions and 44 deletions
+9 -9
View File
@@ -23,8 +23,8 @@ const (
type DictIterator struct {
a *kern.DictType
count int
index int
count int64
index int64
keys []any
iterMode dictIterMode
}
@@ -127,9 +127,9 @@ func NewMapIterator(m map[any]any) (it *DictIterator) {
}
func (it *DictIterator) String() string {
var l = 0
var l = int64(0)
if it.a != nil {
l = len(*it.a)
l = int64(len(*it.a))
}
return fmt.Sprintf("$({#%d})", l)
}
@@ -159,13 +159,13 @@ func (it *DictIterator) CallOperation(name string, args map[string]any) (v any,
case kern.CountName:
v = it.count
case kern.KeyName:
if it.index >= 0 && it.index < len(it.keys) {
if it.index >= 0 && it.index < int64(len(it.keys)) {
v = it.keys[it.index]
} else {
err = io.EOF
}
case kern.ValueName:
if it.index >= 0 && it.index < len(it.keys) {
if it.index >= 0 && it.index < int64(len(it.keys)) {
a := *(it.a)
v = a[it.keys[it.index]]
} else {
@@ -178,7 +178,7 @@ func (it *DictIterator) CallOperation(name string, args map[string]any) (v any,
}
func (it *DictIterator) Current() (item any, err error) {
if it.index >= 0 && it.index < len(it.keys) {
if it.index >= 0 && it.index < int64(len(it.keys)) {
switch it.iterMode {
case dictIterModeKeys:
item = it.keys[it.index]
@@ -204,11 +204,11 @@ func (it *DictIterator) Next() (item any, err error) {
return
}
func (it *DictIterator) Index() int {
func (it *DictIterator) Index() int64 {
return it.index
}
func (it *DictIterator) Count() int {
func (it *DictIterator) Count() int64 {
return it.count
}