Skip to content

Commit f19ca93

Browse files
committed
Fix typedef thing
- Fixes robotpy#41
1 parent dd564dd commit f19ca93

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ def finalize_vars(self):
16851685

16861686
elif nestedTypedef:
16871687
var["fundamental"] = is_fundamental(nestedTypedef)
1688-
if not var["fundamental"]:
1688+
if not var["fundamental"] and "method" in var:
16891689
var["raw_type"] = var["method"]["path"] + "::" + tag
16901690

16911691
else:

test/test_CppHeaderParser.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,5 +3838,35 @@ def test_fn(self):
38383838
)
38393839

38403840

3841+
class NestedTypedef(unittest.TestCase):
3842+
def setUp(self):
3843+
self.cppHeader = CppHeaderParser.CppHeader(
3844+
"""
3845+
template <class SomeType> class A {
3846+
public:
3847+
typedef B <SomeType> C;
3848+
3849+
A();
3850+
3851+
protected:
3852+
C aCInstance;
3853+
};
3854+
""",
3855+
"string",
3856+
)
3857+
3858+
def test_fn(self):
3859+
c = self.cppHeader.classes["A"]
3860+
self.assertEqual("A", c["name"])
3861+
3862+
self.assertEqual(0, len(c["properties"]["public"]))
3863+
self.assertEqual(1, len(c["properties"]["protected"]))
3864+
self.assertEqual(0, len(c["properties"]["private"]))
3865+
3866+
c = c["properties"]["protected"][0]
3867+
self.assertEqual(c["name"], "aCInstance")
3868+
self.assertEqual(c["type"], "C")
3869+
3870+
38413871
if __name__ == "__main__":
38423872
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy