Use .find instead of .filter to get targetPath in ImportInjector (#10608)
This commit is contained in:
parent
43065a9e24
commit
9ada30c207
@ -417,10 +417,10 @@ export default class ImportInjector {
|
|||||||
node._blockHoist = blockHoist;
|
node._blockHoist = blockHoist;
|
||||||
});
|
});
|
||||||
|
|
||||||
const targetPath = this._programPath.get("body").filter(p => {
|
const targetPath = this._programPath.get("body").find(p => {
|
||||||
const val = p.node._blockHoist;
|
const val = p.node._blockHoist;
|
||||||
return Number.isFinite(val) && val < 4;
|
return Number.isFinite(val) && val < 4;
|
||||||
})[0];
|
});
|
||||||
|
|
||||||
if (targetPath) {
|
if (targetPath) {
|
||||||
targetPath.insertBefore(statements);
|
targetPath.insertBefore(statements);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user