mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-12 03:19:45 +02:00
Fix increment-decrement errors
This commit is contained in:
parent
a7f8443d7d
commit
31cb7c2762
@ -128,7 +128,7 @@ func (iterator *SliceIterator) Next() (core.Value, core.Value, error) {
|
||||
if len(iterator.values) > iterator.pos {
|
||||
idx := iterator.pos
|
||||
val := iterator.values[idx]
|
||||
iterator.pos += 1
|
||||
iterator.pos++
|
||||
|
||||
return val, values.NewInt(idx), nil
|
||||
}
|
||||
@ -148,7 +148,7 @@ func (iterator *MapIterator) HasNext() bool {
|
||||
i := 0
|
||||
for k := range iterator.values {
|
||||
keys[i] = k
|
||||
i += 1
|
||||
i++
|
||||
}
|
||||
|
||||
iterator.keys = keys
|
||||
@ -161,7 +161,7 @@ func (iterator *MapIterator) Next() (core.Value, core.Value, error) {
|
||||
if len(iterator.keys) > iterator.pos {
|
||||
key := iterator.keys[iterator.pos]
|
||||
val := iterator.values[key]
|
||||
iterator.pos += 1
|
||||
iterator.pos++
|
||||
|
||||
return val, values.NewString(key), nil
|
||||
}
|
||||
@ -181,7 +181,7 @@ func (iterator *ArrayIterator) Next() (core.Value, core.Value, error) {
|
||||
if int(iterator.values.Length()) > iterator.pos {
|
||||
idx := iterator.pos
|
||||
val := iterator.values.Get(values.NewInt(idx))
|
||||
iterator.pos += 1
|
||||
iterator.pos++
|
||||
|
||||
return val, values.NewInt(idx), nil
|
||||
}
|
||||
@ -206,7 +206,7 @@ func (iterator *ObjectIterator) Next() (core.Value, core.Value, error) {
|
||||
if len(iterator.keys) > iterator.pos {
|
||||
key := iterator.keys[iterator.pos]
|
||||
val, _ := iterator.values.Get(values.NewString(key))
|
||||
iterator.pos += 1
|
||||
iterator.pos++
|
||||
|
||||
return val, values.NewString(key), nil
|
||||
}
|
||||
@ -227,7 +227,7 @@ func (iterator *HTMLNodeIterator) Next() (core.Value, core.Value, error) {
|
||||
idx := iterator.pos
|
||||
val := iterator.values.GetChildNode(values.NewInt(idx))
|
||||
|
||||
iterator.pos += 1
|
||||
iterator.pos++
|
||||
|
||||
return val, values.NewInt(idx), nil
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func (i *LimitIterator) HasNext() bool {
|
||||
|
||||
func (i *LimitIterator) Next() (core.Value, core.Value, error) {
|
||||
if i.counter() <= i.count {
|
||||
i.currCount += 1
|
||||
i.currCount++
|
||||
|
||||
return i.src.Next()
|
||||
}
|
||||
@ -54,7 +54,7 @@ func (i *LimitIterator) verifyOffset() {
|
||||
}
|
||||
|
||||
for (i.offset > i.currCount) && i.src.HasNext() {
|
||||
i.currCount += 1
|
||||
i.currCount++
|
||||
i.src.Next()
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ func Parse(input interface{}) core.Value {
|
||||
size := v.Len()
|
||||
arr := NewArray(size)
|
||||
|
||||
for i := 0; i < size; i += 1 {
|
||||
for i := 0; i < size; i++ {
|
||||
value := v.Index(i)
|
||||
arr.Push(Parse(value.Interface()))
|
||||
}
|
||||
@ -252,7 +252,7 @@ func Parse(input interface{}) core.Value {
|
||||
obj := NewObject()
|
||||
size := t.NumField()
|
||||
|
||||
for i := 0; i < size; i += 1 {
|
||||
for i := 0; i < size; i++ {
|
||||
field := t.Field(i)
|
||||
value := v.Field(i)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user