mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user