Remove unnecessary intermediate var.

This commit is contained in:
Jesse McCarthy 2016-01-11 11:48:29 -05:00
parent 6a3b3dc3e9
commit bcfa58a6a2

View File

@ -242,16 +242,14 @@ export let visitor = {
let target = path.getEarliestCommonAncestorFrom(state.references).getStatementParent();
// don't perform the allocation inside a loop
let highestLoop;
target.findParent(function (path) {
if (path.isLoop()) {
highestLoop = path;
target = path;
} else if (path.isFunction()) {
// stop crawling up for functions
return true;
}
});
if (highestLoop) target = highestLoop;
target.insertBefore(loop);
}