================
@@ -3024,82 +3024,6 @@ class _CXUnsavedFile(Structure):
     _fields_ = [("name", c_char_p), ("contents", c_char_p), ("length", 
c_ulong)]
 
 
-# Functions calls through the python interface are rather slow. Fortunately,
-# for most symbols, we do not need to perform a function call. Their spelling
-# never changes and is consequently provided by this spelling cache.
-SPELLING_CACHE = {
-    # 0: CompletionChunk.Kind("Optional"),
-    # 1: CompletionChunk.Kind("TypedText"),
-    # 2: CompletionChunk.Kind("Text"),
-    # 3: CompletionChunk.Kind("Placeholder"),
-    # 4: CompletionChunk.Kind("Informative"),
-    # 5 : CompletionChunk.Kind("CurrentParameter"),
-    6: "(",  # CompletionChunk.Kind("LeftParen"),
-    7: ")",  # CompletionChunk.Kind("RightParen"),
-    8: "[",  # CompletionChunk.Kind("LeftBracket"),
-    9: "]",  # CompletionChunk.Kind("RightBracket"),
-    10: "{",  # CompletionChunk.Kind("LeftBrace"),
-    11: "}",  # CompletionChunk.Kind("RightBrace"),
-    12: "<",  # CompletionChunk.Kind("LeftAngle"),
-    13: ">",  # CompletionChunk.Kind("RightAngle"),
-    14: ", ",  # CompletionChunk.Kind("Comma"),
-    # 15: CompletionChunk.Kind("ResultType"),
-    16: ":",  # CompletionChunk.Kind("Colon"),
-    17: ";",  # CompletionChunk.Kind("SemiColon"),
-    18: "=",  # CompletionChunk.Kind("Equal"),
-    19: " ",  # CompletionChunk.Kind("HorizontalSpace"),
-    # 20: CompletionChunk.Kind("VerticalSpace")
-}
-
-
-class CompletionChunk:
-    __kind_id: int
-
-    def __init__(self, completionString: CObjP, key: int):
-        self.cs = completionString
-        self.key = key
-
-    def __repr__(self) -> str:
-        return "{'" + self.spelling + "', " + str(self.kind) + "}"
-
-    @CachedProperty
-    def spelling(self) -> str:
-        kind_id = conf.lib.clang_getCompletionChunkKind(self.cs, self.key)
-        if kind_id in SPELLING_CACHE:
-            return SPELLING_CACHE[kind_id]
-        return _CXString.from_result(
-            conf.lib.clang_getCompletionChunkText(self.cs, self.key)
-        )
-
-    @CachedProperty
-    def kind(self) -> CompletionChunkKind:
-        return CompletionChunkKind.from_id(
-            conf.lib.clang_getCompletionChunkKind(self.cs, self.key)
-        )
-
-    @CachedProperty
-    def string(self) -> CompletionString | None:
-        res = conf.lib.clang_getCompletionChunkCompletionString(self.cs, 
self.key)
-
-        if not res:
-            return None
-        return CompletionString(res)
-
-    def isKindOptional(self) -> bool:
-        return self.kind == CompletionChunkKind.OPTIONAL
-
-    def isKindTypedText(self) -> bool:
-        return self.kind == CompletionChunkKind.TYPED_TEXT
-
-    def isKindPlaceHolder(self) -> bool:
-        return self.kind == CompletionChunkKind.PLACEHOLDER
-
-    def isKindInformative(self) -> bool:
-        return self.kind == CompletionChunkKind.INFORMATIVE
-
-    def isKindResultType(self) -> bool:
-        return self.kind == CompletionChunkKind.RESULT_TYPE
-
 ### Completion Chunk Kinds ###
 class CompletionChunkKind(BaseEnumeration):
----------------
DeinAlptraum wrote:

Since I want to refer to `CompletionChunkKind` in the definition of 
`CompletionChunk.SPELLING_CACHE`, I had to move the definition of 
`CompletionChunk` after `CompletionChunkKind`

https://github.com/llvm/llvm-project/pull/177586
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to