File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
2- import re
32import sys
43from typing import List , TYPE_CHECKING
54
@@ -417,8 +416,12 @@ def _getVariantName(variant) -> str:
417416 we can extract `TheVariantName` from it for display purpose.
418417 """
419418 s = variant .GetType ().GetName ()
420- match = re .search (r"::([^:]+)\$Variant$" , s )
421- return match .group (1 ) if match else ""
419+ if not s .endswith ("$Variant" ):
420+ return ""
421+
422+ # trim off path and "$Variant"
423+ # len("$Variant") == 8
424+ return s .rsplit ("::" , 1 )[1 ][:- 8 ]
422425
423426
424427class ClangEncodedEnumProvider :
Original file line number Diff line number Diff line change @@ -58,8 +58,6 @@ class RustType(Enum):
5858STD_PATHBUF_REGEX = re .compile (r"^(std::([a-z_]+::)+)PathBuf$" )
5959STD_PATH_REGEX = re .compile (r"^&(mut )?(std::([a-z_]+::)+)Path$" )
6060
61- TUPLE_ITEM_REGEX = re .compile (r"__\d+$" )
62-
6361ENCODED_ENUM_PREFIX = "RUST$ENCODED$ENUM$"
6462ENUM_DISR_FIELD_NAME = "<<variant>>"
6563ENUM_LLDB_ENCODED_VARIANTS = "$variants$"
@@ -88,7 +86,12 @@ class RustType(Enum):
8886
8987
9088def is_tuple_fields (fields : List ) -> bool :
91- return all (TUPLE_ITEM_REGEX .match (str (field .name )) for field in fields )
89+ for f in fields :
90+ name = str (f .name )
91+ if not name .startswith ("__" ) or not name [2 :].isdigit ():
92+ return False
93+
94+ return True
9295
9396
9497def classify_struct (name : str , fields : List ) -> RustType :
You can’t perform that action at this time.
0 commit comments