ArrayIteratorPrototype.js [plain text]
function next()
{
"use strict";
if (this == null)
@throwTypeError("%ArrayIteratorPrototype%.next requires that |this| not be null or undefined");
let next = this.@arrayIteratorNext;
if (next === @undefined)
@throwTypeError("%ArrayIteratorPrototype%.next requires that |this| be an Array Iterator instance");
return next.@call(this);
}
@globalPrivate
function arrayIteratorValueNext()
{
"use strict";
var done = true;
var value;
var array = this.@iteratedObject;
if (!this.@arrayIteratorIsDone) {
var index = this.@arrayIteratorNextIndex;
var length = array.length >>> 0;
if (index >= length) {
this.@arrayIteratorIsDone = true;
} else {
this.@arrayIteratorNextIndex = index + 1;
done = false;
value = array[index];
}
}
return { done, value };
}
@globalPrivate
function arrayIteratorKeyNext()
{
"use strict";
var done = true;
var value;
var array = this.@iteratedObject;
if (!this.@arrayIteratorIsDone) {
var index = this.@arrayIteratorNextIndex;
var length = array.length >>> 0;
if (index >= length) {
this.@arrayIteratorIsDone = true;
} else {
this.@arrayIteratorNextIndex = index + 1;
done = false;
value = index;
}
}
return { done, value };
}
@globalPrivate
function arrayIteratorKeyValueNext()
{
"use strict";
var done = true;
var value;
var array = this.@iteratedObject;
if (!this.@arrayIteratorIsDone) {
var index = this.@arrayIteratorNextIndex;
var length = array.length >>> 0;
if (index >= length) {
this.@arrayIteratorIsDone = true;
} else {
this.@arrayIteratorNextIndex = index + 1;
done = false;
value = [ index, array[index] ];
}
}
return { done, value };
}