Avoid for(const ... of ...) usage in webidl parser.

Servo's JS engine doesn't support this construct yet.
This commit is contained in:
Josh Matthews 2018-01-05 01:10:37 -05:00
parent 2b6f573eb5
commit de1c2394a5

View file

@ -14,7 +14,8 @@
const types = ["float", "integer", "identifier", "string", "whitespace", "other"];
while (str.length > 0) {
let matched = false;
for (const type of types) {
for (var i in types) {
const type = types[i];
str = str.replace(re[type], tok => {
tokens.push({ type, value: tok });
matched = true;
@ -119,10 +120,11 @@
"multiline-comment": /^\/\*((?:.|\n|\r)*?)\*\//
};
const wsTypes = [];
for (const k in re) wsTypes.push(k);
for (var k in re) wsTypes.push(k);
while (w.length) {
let matched = false;
for (const type of wsTypes) {
for (var i in wsTypes) {
const type = wsTypes[i];
w = w.replace(re[type], (tok, m1) => {
store.push({ type: type + (pea ? ("-" + pea) : ""), value: m1 });
matched = true;