Remove unnecessary intermediate var.
This commit is contained in:
parent
6a3b3dc3e9
commit
bcfa58a6a2
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user