You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To be on the safe side, generators should wrap all operators in parens by default, and only remove them if the generator can prove there is no precedence/associativity issue. Otherwise you'll get issues with things like PHP's weird-ass left associative ternary operator.
Input (Python):
not 0.1 > 0.1
Expected output (JavaScript):
!(0.1 > 0.1)
Actual output (JavaScript):
!0.1 > 0.1
The text was updated successfully, but these errors were encountered:
There is already a dict with operator precedence order in the base code generator. It was in one of the initial python generator versions and it was good enough for the alpha release, but now I can just overload some of the precedences in the language specific generators
In Python the
not
operator has low precedence. In JS the!
operator has high precedence.To be on the safe side, generators should wrap all operators in parens by default, and only remove them if the generator can prove there is no precedence/associativity issue. Otherwise you'll get issues with things like PHP's weird-ass left associative ternary operator.
Input (Python):
not 0.1 > 0.1
Expected output (JavaScript):
!(0.1 > 0.1)
Actual output (JavaScript):
!0.1 > 0.1
The text was updated successfully, but these errors were encountered: