-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
When I pass the while(1) console.log(Date.now()) loop, the output is
while(1) {
if (window.CP.shouldStopExecution(1)) {
break;
}
console.log(Date.now());
window.CP.exitedLoop(1);
}
Which isn't correct, since window.CP.exitedLoop(1); should come after the closing bracket. If I however pass it the same function but with a body (aka. while(1) { console.log(Date.now()); }) I get
while(1) {
if (window.CP.shouldStopExecution(1)) {
break;
}
console.log(Date.now());
}
window.CP.exitedLoop(1);
Possible solution
I'll get this out of the way first: I have absolutely no idea why this works, I stumbled upon it by accident.
Switching the last two lines in
patches.push({ pos: start, str: prolog });
patches.push({ pos: end, str: epilog });
patches.push({ pos: node.range[1], str: LOOP_EXIT.replace('%d', loopId) });
To get
patches.push({ pos: start, str: prolog });
patches.push({ pos: node.range[1], str: LOOP_EXIT.replace('%d', loopId) });
patches.push({ pos: end, str: epilog });
Solves this problem for me.
Metadata
Metadata
Assignees
Labels
No labels