Skip to content

Commit 5b70de8

Browse files
authored
Fix recurisve hangs (#613)
1 parent 46ff45e commit 5b70de8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/operators.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ export const callIteratively = (f: any, ...args: any[]) => {
192192
const pastCalls: [string, any[]][] = []
193193
while (true) {
194194
const dummy = locationDummyNode(line, column)
195-
if (Date.now() - startTime > MAX_TIME) {
196-
throw new PotentialInfiniteRecursionError(dummy, pastCalls)
197-
}
198195
f = forceIt(f)
199196
if (typeof f === 'function') {
200197
if (f.transformedFunction !== undefined) {
@@ -223,6 +220,9 @@ export const callIteratively = (f: any, ...args: any[]) => {
223220
let res
224221
try {
225222
res = f(...args)
223+
if (Date.now() - startTime > MAX_TIME) {
224+
throw new PotentialInfiniteRecursionError(dummy, pastCalls)
225+
}
226226
} catch (error) {
227227
// if we already handled the error, simply pass it on
228228
if (!(error instanceof RuntimeSourceError || error instanceof ExceptionError)) {

0 commit comments

Comments
 (0)