@@ -43,7 +43,7 @@ func builtinArrayToLocaleString(call FunctionCall) Value {
43
43
return stringValue ("" )
44
44
}
45
45
stringList := make ([]string , 0 , length )
46
- for index := int64 ( 0 ); index < length ; index ++ {
46
+ for index := range length {
47
47
value := thisObject .get (arrayIndexToString (index ))
48
48
stringValue := ""
49
49
switch value .kind {
@@ -71,7 +71,7 @@ func builtinArrayConcat(call FunctionCall) Value {
71
71
obj := item .object ()
72
72
if isArray (obj ) {
73
73
length := obj .get (propertyLength ).number ().int64
74
- for index := int64 ( 0 ); index < length ; index ++ {
74
+ for index := range length {
75
75
name := strconv .FormatInt (index , 10 )
76
76
if obj .hasProperty (name ) {
77
77
valueArray = append (valueArray , obj .get (name ))
@@ -151,7 +151,7 @@ func builtinArrayJoin(call FunctionCall) Value {
151
151
return stringValue ("" )
152
152
}
153
153
stringList := make ([]string , 0 , length )
154
- for index := int64 ( 0 ); index < length ; index ++ {
154
+ for index := range length {
155
155
value := thisObject .get (arrayIndexToString (index ))
156
156
stringValue := ""
157
157
switch value .kind {
@@ -175,7 +175,7 @@ func builtinArraySplice(call FunctionCall) Value {
175
175
}
176
176
valueArray := make ([]Value , deleteCount )
177
177
178
- for index := int64 ( 0 ); index < deleteCount ; index ++ {
178
+ for index := range deleteCount {
179
179
indexString := arrayIndexToString (start + index )
180
180
if thisObject .hasProperty (indexString ) {
181
181
valueArray [index ] = thisObject .get (indexString )
@@ -236,7 +236,7 @@ func builtinArraySplice(call FunctionCall) Value {
236
236
}
237
237
}
238
238
239
- for index := int64 ( 0 ); index < itemCount ; index ++ {
239
+ for index := range itemCount {
240
240
thisObject .put (arrayIndexToString (index + start ), itemList [index ], true )
241
241
}
242
242
thisObject .put (propertyLength , int64Value (length + itemCount - deleteCount ), true )
@@ -257,7 +257,7 @@ func builtinArraySlice(call FunctionCall) Value {
257
257
sliceLength := end - start
258
258
sliceValueArray := make ([]Value , sliceLength )
259
259
260
- for index := int64 ( 0 ); index < sliceLength ; index ++ {
260
+ for index := range sliceLength {
261
261
from := arrayIndexToString (index + start )
262
262
if thisObject .hasProperty (from ) {
263
263
sliceValueArray [index ] = thisObject .get (from )
@@ -283,7 +283,7 @@ func builtinArrayUnshift(call FunctionCall) Value {
283
283
}
284
284
}
285
285
286
- for index := int64 ( 0 ); index < itemCount ; index ++ {
286
+ for index := range itemCount {
287
287
thisObject .put (arrayIndexToString (index ), itemList [index ], true )
288
288
}
289
289
@@ -531,7 +531,7 @@ func builtinArrayEvery(call FunctionCall) Value {
531
531
if iterator := call .Argument (0 ); iterator .isCallable () {
532
532
length := int64 (toUint32 (thisObject .get (propertyLength )))
533
533
callThis := call .Argument (1 )
534
- for index := int64 ( 0 ); index < length ; index ++ {
534
+ for index := range length {
535
535
if key := arrayIndexToString (index ); thisObject .hasProperty (key ) {
536
536
if value := thisObject .get (key ); iterator .call (call .runtime , callThis , value , int64Value (index ), this ).bool () {
537
537
continue
@@ -550,7 +550,7 @@ func builtinArraySome(call FunctionCall) Value {
550
550
if iterator := call .Argument (0 ); iterator .isCallable () {
551
551
length := int64 (toUint32 (thisObject .get (propertyLength )))
552
552
callThis := call .Argument (1 )
553
- for index := int64 ( 0 ); index < length ; index ++ {
553
+ for index := range length {
554
554
if key := arrayIndexToString (index ); thisObject .hasProperty (key ) {
555
555
if value := thisObject .get (key ); iterator .call (call .runtime , callThis , value , int64Value (index ), this ).bool () {
556
556
return trueValue
@@ -568,7 +568,7 @@ func builtinArrayForEach(call FunctionCall) Value {
568
568
if iterator := call .Argument (0 ); iterator .isCallable () {
569
569
length := int64 (toUint32 (thisObject .get (propertyLength )))
570
570
callThis := call .Argument (1 )
571
- for index := int64 ( 0 ); index < length ; index ++ {
571
+ for index := range length {
572
572
if key := arrayIndexToString (index ); thisObject .hasProperty (key ) {
573
573
iterator .call (call .runtime , callThis , thisObject .get (key ), int64Value (index ), this )
574
574
}
@@ -585,7 +585,7 @@ func builtinArrayMap(call FunctionCall) Value {
585
585
length := int64 (toUint32 (thisObject .get (propertyLength )))
586
586
callThis := call .Argument (1 )
587
587
values := make ([]Value , length )
588
- for index := int64 ( 0 ); index < length ; index ++ {
588
+ for index := range length {
589
589
if key := arrayIndexToString (index ); thisObject .hasProperty (key ) {
590
590
values [index ] = iterator .call (call .runtime , callThis , thisObject .get (key ), index , this )
591
591
} else {
@@ -604,7 +604,7 @@ func builtinArrayFilter(call FunctionCall) Value {
604
604
length := int64 (toUint32 (thisObject .get (propertyLength )))
605
605
callThis := call .Argument (1 )
606
606
values := make ([]Value , 0 )
607
- for index := int64 ( 0 ); index < length ; index ++ {
607
+ for index := range length {
608
608
if key := arrayIndexToString (index ); thisObject .hasProperty (key ) {
609
609
value := thisObject .get (key )
610
610
if iterator .call (call .runtime , callThis , value , index , this ).bool () {
0 commit comments