Skip to content

Commit 6fdc0e1

Browse files
author
Neil Fraser
committed
Simplify polyfill timeout calculation
1 parent fec4730 commit 6fdc0e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

interpreter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Interpreter.prototype.appendCode = function(code) {
357357
*/
358358
Interpreter.prototype.step = function() {
359359
var stack = this.stateStack;
360-
var startTime = Date.now();
360+
var endTime = Date.now() + this['POLYFILL_TIMEOUT'];
361361
do {
362362
var state = stack[stack.length - 1];
363363
if (!state) {
@@ -390,7 +390,7 @@ Interpreter.prototype.step = function() {
390390
throw Error('Setter not supported in this context');
391391
}
392392
// This may be polyfill code. Keep executing until we arrive at user code.
393-
} while (!node['end'] && startTime + this['POLYFILL_TIMEOUT'] > Date.now());
393+
} while (!node['end'] && endTime > Date.now());
394394
return true;
395395
};
396396

0 commit comments

Comments
 (0)