add support for "!=" and "==" operators on colors#79
add support for "!=" and "==" operators on colors#79SBD580 wants to merge 3 commits intoleafo:masterfrom
Conversation
first check for 'op_${opName}' and then for 'op_${ltype}_${rtype}',
as we might want to "{color} != {color}".
This is not an optimal solution, as a way to override a general operator
by it's arguments type is something good and not viable this way.
|
Can you elaborate? I don't understand what this fixes. The != operator seems to work for me. |
|
try to compile something like this: @if #ffffff != #000000 { I'm getting an Exception: |
The previous fix break the tests and was not good. This is a new one which just implement the op_neq_color_color method so the "!=" operator will work on colors as well
Implement the op_eq_color_color in order to support the equality between two colors. In addition, fix small issue on "!=" operator when dealing with alpha value.
|
I pushed a simpler fix, does that look okay to you? |
|
Oh, I actually didn't know it is possible to compare arrays directly with the '==' and '!=' operators - COOL. But what about rgb(0,0,0,1) and rgb(0,0,0) - they will not be equal that way. In addition, I would implement this in separate methods (op_neq_color_color and op_eq_color_color) as this method usually return Color and not a Boolean and multiple return types are not a good practice I think. |
No description provided.