================ @@ -2181,6 +2193,60 @@ def from_cursor_result(res, fn, args): res._tu = args[0]._tu return res +class BinaryOperator(BaseEnumeration): + """ + Describes the BinaryOperator of a declaration + """ + + # The unique kind objects, index by id. + _kinds = [] + _name_map = None + + def __nonzero__(self): + """ Allows checks of the kind ```if cursor.binary_operator:```""" + return self.value != 0 + + @property + def is_assignment(self): + return BinaryOperator.Assign.value <= self.value < BinaryOperator.Comma.value + + def __repr__(self): + return 'BinaryOperator.%s' % (self.name,) + +BinaryOperator.Invalid = BinaryOperator(0) +BinaryOperator.PtrMemD = BinaryOperator(1) ---------------- AaronBallman wrote:
Despite looking like an off-by-one error, this is correct -- the code in CIndex.cpp does not cast `BinaryOperatorKind`, it uses a `switch` to map between values. https://github.com/llvm/llvm-project/pull/98489 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits