Don't use "arrays" in lib/compiler/asts.js

The "arrays" module will be removed.

See #442.
redux
David Majda 8 years ago
parent 5822596ab8
commit 4dec5e52ba

@ -1,16 +1,27 @@
"use strict";
let arrays = require("../utils/arrays"),
visitor = require("./visitor");
let visitor = require("./visitor");
/* AST utilities. */
let asts = {
findRule: function(ast, name) {
return arrays.find(ast.rules, r => r.name === name);
for (let i = 0; i < ast.rules.length; i++) {
if (ast.rules[i].name === name) {
return ast.rules[i];
}
}
return undefined;
},
indexOfRule: function(ast, name) {
return arrays.indexOf(ast.rules, r => r.name === name);
for (let i = 0; i < ast.rules.length; i++) {
if (ast.rules[i].name === name) {
return i;
}
}
return -1;
},
alwaysConsumesOnSuccess: function(ast, node) {

Loading…
Cancel
Save