Visitar URL original
Avoid findLastIndex · babel/babel@22afa1f · GitHub
Skip to content

Commit 22afa1f

Browse files
Avoid findLastIndex
1 parent 81edc1e commit 22afa1f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • packages/babel-plugin-transform-regenerator/src/regenerator

‎packages/babel-plugin-transform-regenerator/src/regenerator/emit.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,13 @@ export class Emitter {
10751075
let newCallee;
10761076
let newArgs;
10771077

1078-
const lastLeapingArgIndex = argsPath.findLastIndex(argPath =>
1079-
meta.containsLeap(argPath.node),
1080-
);
1078+
let lastLeapingArgIndex = argsPath.length - 1;
1079+
while (
1080+
lastLeapingArgIndex >= 0 &&
1081+
!meta.containsLeap(argsPath[lastLeapingArgIndex].node)
1082+
) {
1083+
lastLeapingArgIndex--;
1084+
}
10811085

10821086
let injectFirstArg = null;
10831087

0 commit comments

Comments
 (0)