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 , Generator
54
@@ -460,8 +459,12 @@ def _getVariantName(variant) -> str:
460459 we can extract `TheVariantName` from it for display purpose.
461460 """
462461 s = variant .GetType ().GetName ()
463- match = re .search (r"::([^:]+)\$Variant$" , s )
464- return match .group (1 ) if match else ""
462+ if not s .endswith ("$Variant" ):
463+ return ""
464+
465+ # trim off path and "$Variant"
466+ # len("$Variant") == 8
467+ return s .rsplit ("::" , 1 )[1 ][:- 8 ]
465468
466469
467470class 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