Bug 1217422 - Remove for-each from parser/. r=jst

This commit is contained in:
Tooru Fujisawa 2015-10-19 02:20:47 +09:00
parent 9081f56f3e
commit 1b1c51c551

View File

@ -36,7 +36,7 @@ function parseTestcase(testcase) {
var lines = testcase.split("\n"); var lines = testcase.split("\n");
/* check that the first non-empty, non-comment line is #data */ /* check that the first non-empty, non-comment line is #data */
for each (var line in lines) { for (var line of lines) {
if (!line || startsWith(line, "##")) { if (!line || startsWith(line, "##")) {
continue; continue;
} }
@ -51,7 +51,7 @@ function parseTestcase(testcase) {
var errors = []; var errors = [];
var fragment = []; var fragment = [];
var currentList = input; var currentList = input;
for each (var line in lines) { for (var line of lines) {
if (startsWith(line, "##todo")) { if (startsWith(line, "##todo")) {
todo(false, line.substring(6)); todo(false, line.substring(6));
continue; continue;
@ -84,10 +84,10 @@ function parseTestcase(testcase) {
* @param The list of strings * @param The list of strings
*/ */
function test_parser(testlist) { function test_parser(testlist) {
for each (var testgroup in testlist) { for (var testgroup of testlist) {
var tests = testgroup.split("#data\n"); var tests = testgroup.split("#data\n");
tests = ["#data\n" + test for each(test in tests) if (test)]; tests = tests.filter(test => test).map(test => "#data\n" + test);
for each (var test in tests) { for (var test of tests) {
yield parseTestcase(test); yield parseTestcase(test);
} }
} }