mirror of https://github.com/tc39/test262.git
Dont use const in for (of) loops, for when those aren't properly
supported
This commit is contained in:
parent
880f8a5ba6
commit
0a8622de68
|
@ -13,20 +13,20 @@ function buildString(args) {
|
||||||
const loneCodePoints = args.loneCodePoints;
|
const loneCodePoints = args.loneCodePoints;
|
||||||
const ranges = args.ranges;
|
const ranges = args.ranges;
|
||||||
const CHUNK_SIZE = 10000;
|
const CHUNK_SIZE = 10000;
|
||||||
let result = Reflect.apply(String.fromCodePoint, null, loneCodePoints);
|
let result = String.fromCodePoint.apply(null, loneCodePoints);
|
||||||
for (let i = 0; i < ranges.length; i++) {
|
for (let i = 0; i < ranges.length; i++) {
|
||||||
const range = ranges[i];
|
let range = ranges[i];
|
||||||
const start = range[0];
|
let start = range[0];
|
||||||
const end = range[1];
|
let end = range[1];
|
||||||
const codePoints = [];
|
let codePoints = [];
|
||||||
for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
|
for (let length = 0, codePoint = start; codePoint <= end; codePoint++) {
|
||||||
codePoints[length++] = codePoint;
|
codePoints[length++] = codePoint;
|
||||||
if (length === CHUNK_SIZE) {
|
if (length === CHUNK_SIZE) {
|
||||||
result += Reflect.apply(String.fromCodePoint, null, codePoints);
|
result += String.fromCodePoint.apply(null, codePoints);
|
||||||
codePoints.length = length = 0;
|
codePoints.length = length = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result += Reflect.apply(String.fromCodePoint, null, codePoints);
|
result += String.fromCodePoint.apply(null, codePoints);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,8 @@ function printCodePoint(codePoint) {
|
||||||
|
|
||||||
function printStringCodePoints(string) {
|
function printStringCodePoints(string) {
|
||||||
const buf = [];
|
const buf = [];
|
||||||
for (const symbol of string) {
|
for (let symbol of string) {
|
||||||
const formatted = printCodePoint(symbol.codePointAt(0));
|
let formatted = printCodePoint(symbol.codePointAt(0));
|
||||||
buf.push(formatted);
|
buf.push(formatted);
|
||||||
}
|
}
|
||||||
return buf.join(' ');
|
return buf.join(' ');
|
||||||
|
@ -50,8 +50,8 @@ function printStringCodePoints(string) {
|
||||||
|
|
||||||
function testPropertyEscapes(regExp, string, expression) {
|
function testPropertyEscapes(regExp, string, expression) {
|
||||||
if (!regExp.test(string)) {
|
if (!regExp.test(string)) {
|
||||||
for (const symbol of string) {
|
for (let symbol of string) {
|
||||||
const formatted = printCodePoint(symbol.codePointAt(0));
|
let formatted = printCodePoint(symbol.codePointAt(0));
|
||||||
assert(
|
assert(
|
||||||
regExp.test(symbol),
|
regExp.test(symbol),
|
||||||
`\`${ expression }\` should match ${ formatted } (\`${ symbol }\`)`
|
`\`${ expression }\` should match ${ formatted } (\`${ symbol }\`)`
|
||||||
|
@ -70,7 +70,7 @@ function testPropertyOfStrings(args) {
|
||||||
const nonMatchStrings = args.nonMatchStrings;
|
const nonMatchStrings = args.nonMatchStrings;
|
||||||
const allStrings = matchStrings.join('');
|
const allStrings = matchStrings.join('');
|
||||||
if (!regExp.test(allStrings)) {
|
if (!regExp.test(allStrings)) {
|
||||||
for (const string of matchStrings) {
|
for (let string of matchStrings) {
|
||||||
assert(
|
assert(
|
||||||
regExp.test(string),
|
regExp.test(string),
|
||||||
`\`${ expression }\` should match ${ string } (${ printStringCodePoints(string) })`
|
`\`${ expression }\` should match ${ string } (${ printStringCodePoints(string) })`
|
||||||
|
@ -82,7 +82,7 @@ function testPropertyOfStrings(args) {
|
||||||
|
|
||||||
const allNonMatchStrings = nonMatchStrings.join('');
|
const allNonMatchStrings = nonMatchStrings.join('');
|
||||||
if (regExp.test(allNonMatchStrings)) {
|
if (regExp.test(allNonMatchStrings)) {
|
||||||
for (const string of nonMatchStrings) {
|
for (let string of nonMatchStrings) {
|
||||||
assert(
|
assert(
|
||||||
!regExp.test(string),
|
!regExp.test(string),
|
||||||
`\`${ expression }\` should not match ${ string } (${ printStringCodePoints(string) })`
|
`\`${ expression }\` should not match ${ string } (${ printStringCodePoints(string) })`
|
||||||
|
|
Loading…
Reference in New Issue