Merge pull request #7028 from sophiebits/getLetReferences-n2

Fix O(n^2) getLetReferences – 40% faster on large flat files
This commit is contained in:
Sven SAULEAU 2017-12-15 07:59:57 +01:00 committed by GitHub
commit a24c9f8ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -647,20 +647,20 @@ class BlockScoping {
//
if (block.body) {
const declarPaths = this.blockPath.get("body");
for (let i = 0; i < block.body.length; i++) {
const declarPath = this.blockPath.get("body")[i];
addDeclarationsFromChild(declarPath);
addDeclarationsFromChild(declarPaths[i]);
}
}
if (block.cases) {
const declarPaths = this.blockPath.get("cases");
for (let i = 0; i < block.cases.length; i++) {
const consequents = block.cases[i].consequent;
for (let j = 0; j < consequents.length; j++) {
const declarPath = this.blockPath.get("cases")[i];
const declar = consequents[j];
addDeclarationsFromChild(declarPath, declar);
addDeclarationsFromChild(declarPaths[i], declar);
}
}
}