Fixed #31396 -- Added binary XOR operator to F expressions.

This commit is contained in:
Hannes Ljungberg 2020-03-20 23:08:32 +01:00 committed by Mariusz Felisiak
parent 39e1c88de6
commit f3da09df0f
8 changed files with 44 additions and 4 deletions

View file

@ -51,6 +51,7 @@ class Combinable:
BITOR = '|'
BITLEFTSHIFT = '<<'
BITRIGHTSHIFT = '>>'
BITXOR = '#'
def _combine(self, other, connector, reversed):
if not hasattr(other, 'resolve_expression'):
@ -105,6 +106,9 @@ class Combinable:
def bitrightshift(self, other):
return self._combine(other, self.BITRIGHTSHIFT, False)
def bitxor(self, other):
return self._combine(other, self.BITXOR, False)
def __or__(self, other):
if getattr(self, 'conditional', False) and getattr(other, 'conditional', False):
return Q(self) | Q(other)