Skip to content

Commit 5c5ff71

Browse files
authored
Merge pull request #296 from TurboWarp/round-floor-ceil-type
Use more specific type for round, floor, ceiling
2 parents bf7ae82 + a2701ef commit 5c5ff71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/irgen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ class ScriptTreeGenerator {
362362
const operator = block.fields.OPERATOR.value.toLowerCase();
363363
switch (operator) {
364364
case 'abs': return new IntermediateInput(InputOpcode.OP_ABS, InputType.NUMBER_POS | InputType.NUMBER_ZERO, {value});
365-
case 'floor': return new IntermediateInput(InputOpcode.OP_FLOOR, InputType.NUMBER, {value});
366-
case 'ceiling': return new IntermediateInput(InputOpcode.OP_CEILING, InputType.NUMBER, {value});
365+
case 'floor': return new IntermediateInput(InputOpcode.OP_FLOOR, InputType.NUMBER_INT | InputType.NUMBER_INF, {value});
366+
case 'ceiling': return new IntermediateInput(InputOpcode.OP_CEILING, InputType.NUMBER_INT | InputType.NUMBER_INF, {value});
367367
case 'sqrt': return new IntermediateInput(InputOpcode.OP_SQRT, InputType.NUMBER_OR_NAN, {value});
368368
case 'sin': return new IntermediateInput(InputOpcode.OP_SIN, InputType.NUMBER_OR_NAN, {value});
369369
case 'cos': return new IntermediateInput(InputOpcode.OP_COS, InputType.NUMBER_OR_NAN, {value});
@@ -458,7 +458,7 @@ class ScriptTreeGenerator {
458458
});
459459
}
460460
case 'operator_round':
461-
return new IntermediateInput(InputOpcode.OP_ROUND, InputType.NUMBER, {
461+
return new IntermediateInput(InputOpcode.OP_ROUND, InputType.NUMBER_INT | InputType.NUMBER_INF, {
462462
value: this.descendInputOfBlock(block, 'NUM').toType(InputType.NUMBER)
463463
});
464464
case 'operator_subtract':

0 commit comments

Comments
 (0)