Browse Source

Handle qualifiers in function name

nosoop 10 months ago
parent
commit
df76033356
2 changed files with 9 additions and 1 deletions
  1. 3 1
      src/smgdc/demangler_helpers.py
  2. 6 0
      tests/test_demangler.py

+ 3 - 1
src/smgdc/demangler_helpers.py

@@ -25,8 +25,10 @@ def extract_function_name(node) -> tuple[demangler.Node, ...]:
     # this name will include the class at the start
     def _extract(node: demangler.Node):
         match node:
-            case node if node.kind in ("name", "cv_qual"):
+            case node if node.kind in "name":
                 return node.value
+            case node if node.kind == "cv_qual":
+                return _extract(node.value)
             case node if node.kind == "qual_name":
                 return node.value
         raise ValueError(f"Unexpected node {node!r}")

+ 6 - 0
tests/test_demangler.py

@@ -23,6 +23,12 @@ import smgdc.demangler_helpers as dh
             "_ZN6google8protobuf10TextFormat6Parser10ParserImpl20ParserErrorCollector8AddErrorEiiRKSs",
             True,
         ),
+        (
+            # PASS: qualified name in function
+            "_ZTV13CTFWeaponBase",
+            "_ZNK13CTFWeaponBase11GetWeaponIDEv",
+            True,
+        ),
         (
             # FAIL: unrelated classes
             "_ZTV13CTFBaseRocket",