JavaScriptCore-Builtin.prototype-Combined.js [plain text]
function every(callback )
{
"use strict";
if (this === null)
throw new @TypeError("Array.prototype.every requires that |this| not be null");
if (this === undefined)
throw new @TypeError("Array.prototype.every requires that |this| not be undefined");
var array = @Object(this);
var length = @toLength(array.length);
if (typeof callback !== "function")
throw new @TypeError("Array.prototype.every callback must be a function");
var thisArg = arguments.length > 1 ? arguments[1] : undefined;
for (var i = 0; i < length; i++) {
if (!(i in array))
continue;
if (!callback.@call(thisArg, array[i], i, array))
return false;
}
return true;
}
function forEach(callback )
{
"use strict";
if (this === null)
throw new @TypeError("Array.prototype.forEach requires that |this| not be null");
if (this === undefined)
throw new @TypeError("Array.prototype.forEach requires that |this| not be undefined");
var array = @Object(this);
var length = @toLength(array.length);
if (typeof callback !== "function")
throw new @TypeError("Array.prototype.forEach callback must be a function");
var thisArg = arguments.length > 1 ? arguments[1] : undefined;
for (var i = 0; i < length; i++) {
if (i in array)
callback.@call(thisArg, array[i], i, array);
}
}
@overriddenName="[Symbol.match]"
function match(strArg)
{
"use strict";
if (!@isObject(this))
@throwTypeError("RegExp.prototype.@@match requires that |this| be an Object");
let regexp = this;
if (!@hasObservableSideEffectsForRegExpMatch(regexp))
return @regExpMatchFast.@call(regexp, strArg);
let str = @toString(strArg);
if (!regexp.global)
return @regExpExec(regexp, str);
let unicode = regexp.unicode;
regexp.lastIndex = 0;
let resultList = [];
const maximumReasonableMatchSize = 100000000;
while (true) {
let result = @regExpExec(regexp, str);
if (result === null) {
if (resultList.length === 0)
return null;
return resultList;
}
if (resultList.length > maximumReasonableMatchSize)
@throwOutOfMemoryError();
if (!@isObject(result))
@throwTypeError("RegExp.prototype.@@match call to RegExp.exec didn't return null or an object");
let resultString = @toString(result[0]);
if (!resultString.length)
regexp.lastIndex = @advanceStringIndex(str, regexp.lastIndex, unicode);
resultList.@push(resultString);
}
}
@intrinsic=RegExpTestIntrinsic
function test(strArg)
{
"use strict";
let regexp = this;
if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec)
return @regExpTestFast.@call(regexp, strArg);
if (!@isObject(regexp))
@throwTypeError("RegExp.prototype.test requires that |this| be an Object");
let str = @toString(strArg);
let match = @regExpExec(regexp, str);
if (match !== null)
return true;
return false;
}