Fixed JS/PHP generators for math_number

It was returning ORDER_ATOMIC for the block for any number; changed it so that it now returns ORDER_UNARY_NEGATION for negative numbers.
This commit is contained in:
jschanker
2018-01-24 20:34:38 -05:00
committed by Neil Fraser
parent 9ce13d8883
commit f0b68fad66
2 changed files with 6 additions and 2 deletions

View File

@@ -32,12 +32,14 @@ goog.require('Blockly.PHP');
Blockly.PHP['math_number'] = function(block) {
// Numeric value.
var code = parseFloat(block.getFieldValue('NUM'));
var order = code >= 0 ? Blockly.PHP.ORDER_ATOMIC :
Blockly.PHP.ORDER_UNARY_NEGATION;
if (code == Infinity) {
code = 'INF';
} else if (code == -Infinity) {
code = '-INF';
}
return [code, Blockly.PHP.ORDER_ATOMIC];
return [code, order];
};
Blockly.PHP['math_arithmetic'] = function(block) {