Problem statement
Bug Report: The JavaScript/PHP generators for math_number currently return ORDER_ATOMIC for all numbers when they should be returning ORDER_UNARY_NEGATION for negative numbers. In JavaScript, this can cause an issue if you e.g., extend Number.prototype by adding an abs method for absolute value and want to have a corresponding abs block (not for use in production, educational purposes only!) For example:

Expected Behavior
The generated code for the block above should be (-5).abs() so that it evaluates to 5.
Actual Behavior
With ORDER_ATOMIC, the above block would generate the code -5 .abs(), which would incorrectly produce -5 since the -5 block is "ripped apart" as described in Operator Precedence | Blockly | Google Developers.
Operating System and Browser
All
Additional Information
The math_number block generator for Dart, Python, and Lua account for negative numbers.
Problem statement
Bug Report: The JavaScript/PHP generators for
math_numbercurrently returnORDER_ATOMICfor all numbers when they should be returningORDER_UNARY_NEGATIONfor negative numbers. In JavaScript, this can cause an issue if you e.g., extendNumber.prototypeby adding anabsmethod for absolute value and want to have a correspondingabsblock (not for use in production, educational purposes only!) For example:Expected Behavior
The generated code for the block above should be
(-5).abs()so that it evaluates to5.Actual Behavior
With
ORDER_ATOMIC, the above block would generate the code-5 .abs(), which would incorrectly produce-5since the-5block is "ripped apart" as described in Operator Precedence | Blockly | Google Developers.Operating System and Browser
All
Additional Information
The
math_numberblock generator for Dart, Python, and Lua account for negative numbers.