ArrayIteratorPrototype.js [plain text]
function next()
{
"use strict";
if (this == null)
@throwTypeError("%ArrayIteratorPrototype%.next requires that |this| not be null or undefined");
let next = @getByIdDirectPrivate(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 = @getByIdDirectPrivate(this, "iteratedObject");
if (!@getByIdDirectPrivate(this, "arrayIteratorIsDone")) {
var index = @getByIdDirectPrivate(this, "arrayIteratorNextIndex");
var length = array.length >>> 0;
if (index >= length)
@putByIdDirectPrivate(this, "arrayIteratorIsDone", true);
else {
@putByIdDirectPrivate(this, "arrayIteratorNextIndex", index + 1);
done = false;
value = array[index];
}
}
return { value, done };
}
@globalPrivate
function arrayIteratorKeyNext()
{
"use strict";
var done = true;
var value;
var array = @getByIdDirectPrivate(this, "iteratedObject");
if (!@getByIdDirectPrivate(this, "arrayIteratorIsDone")) {
var index = @getByIdDirectPrivate(this, "arrayIteratorNextIndex");
var length = array.length >>> 0;
if (index >= length)
@putByIdDirectPrivate(this, "arrayIteratorIsDone", true);
else {
@putByIdDirectPrivate(this, "arrayIteratorNextIndex", index + 1);
done = false;
value = index;
}
}
return { value, done };
}
@globalPrivate
function arrayIteratorKeyValueNext()
{
"use strict";
var done = true;
var value;
var array = @getByIdDirectPrivate(this, "iteratedObject");
if (!@getByIdDirectPrivate(this, "arrayIteratorIsDone")) {
var index = @getByIdDirectPrivate(this, "arrayIteratorNextIndex");
var length = array.length >>> 0;
if (index >= length)
@putByIdDirectPrivate(this, "arrayIteratorIsDone", true);
else {
@putByIdDirectPrivate(this, "arrayIteratorNextIndex", index + 1);
done = false;
value = [ index, array[index] ];
}
}
return { value, done };
}