Skip to content

Commit 2a2d152

Browse files
committed
Infinite iteration count can also use simpler condition
1 parent 2ac7095 commit 2a2d152

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/jsgen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class JSGenerator {
610610
break;
611611
case StackOpcode.CONTROL_REPEAT: {
612612
const i = this.localVariables.next();
613-
if (node.times.isAlwaysType(InputType.NUMBER_INT)) {
613+
if (node.times.isAlwaysType(InputType.NUMBER_INT | InputType.NUMBER_INF)) {
614614
this.source += `for (var ${i} = ${this.descendInput(node.times)}; ${i} > 0; ${i}--) {\n`;
615615
} else {
616616
this.source += `for (var ${i} = ${this.descendInput(node.times)}; ${i} >= 0.5; ${i}--) {\n`;

0 commit comments

Comments
 (0)