================
@@ -3197,12 +3188,47 @@ def __repr__(self) -> str:
)
-availabilityKinds = {
- 0: CompletionChunk.Kind("Available"),
- 1: CompletionChunk.Kind("Deprecated"),
- 2: CompletionChunk.Kind("NotAvailable"),
- 3: CompletionChunk.Kind("NotAccessible"),
-}
+# AvailabilityKindCompat is an exact copy of AvailabilityKind, except for
__str__
+# This is a temporary measure to keep the string representation the same
+# until we unify the return of CompletionString.availability to be
AvailabilityKind
+# Note that deriving from AvailabilityKind directly is not possible
+class AvailabilityKindCompat(BaseEnumeration):
+ """
+ Describes the availability of an entity.
+ """
+
+ # Ensure AvailabilityKindCompat is comparable with AvailabilityKind
+ def __eq__(self, other: object) -> bool:
+ if isinstance(other, AvailabilityKind):
+ return self.value == other.value
+ else:
+ return NotImplemented
+
+ def __str__(self) -> str:
+ """
+ Returns the common enum names (full upper-case, underscore separated)
+ to the old format (separated by capitalization), e.g. NOT_ACCESSIBLE
-> NotAccessible
+ This is a temporary measure and will be changed in a future release
+ to return the same format (full upper-case, underscore separated) like
other Kinds
+ """
----------------
Endilll wrote:
```python
"""
Converts enum value to string in the old camelCase format. This is a temporary
measure that will be changed in the future release to return string in ALL_CAPS
format, like for other enums.
"""
```
(reflow as needed)
https://github.com/llvm/llvm-project/pull/160296
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits