@@ -647,6 +647,21 @@ def get_pure_virtual_methods(self, type="public"):
647
647
r [meth ["name" ]] = meth
648
648
return r
649
649
650
+ def _lookup_type (self , name ):
651
+ # TODO: should have indexes for these lookups... and they
652
+ # should be more unified
653
+ for access in supportedAccessSpecifier :
654
+ for e in self ["enums" ][access ]:
655
+ if e .get ("name" ) == name :
656
+ return {
657
+ "enum" : self ["name" ] + "::" + e ["name" ],
658
+ "type" : e ["name" ],
659
+ "namespace" : e ["namespace" ],
660
+ }
661
+ for n in self ["nested_classes" ]:
662
+ if n ["name" ] == name :
663
+ return {"raw_type" : self ["name" ] + "::" + n ["name" ], "type" : n ["name" ]}
664
+
650
665
def __init__ (self , nameStack , curTemplate , doxygen , location ):
651
666
self ["nested_classes" ] = []
652
667
self ["parent" ] = None
@@ -1505,15 +1520,21 @@ def resolve_type(self, string, result): # recursive
1505
1520
else :
1506
1521
used = None
1507
1522
1508
- # Search for using directives in parents
1509
- parent = result ["parent" ]
1510
- while parent :
1511
- p_using = parent .get ("using" )
1512
- if p_using :
1513
- used = p_using .get (alias )
1514
- if used :
1515
- break
1516
- parent = parent ["parent" ]
1523
+ # Search for in parents
1524
+ if not used :
1525
+ parent = result ["parent" ]
1526
+ while parent :
1527
+ p_using = parent .get ("using" )
1528
+ if p_using :
1529
+ used = p_using .get (alias )
1530
+ if used :
1531
+ break
1532
+ lookup = getattr (parent , "_lookup_type" , None )
1533
+ if lookup :
1534
+ used = lookup (alias )
1535
+ if used :
1536
+ break
1537
+ parent = parent ["parent" ]
1517
1538
1518
1539
if not used and self .using :
1519
1540
# search for type in all enclosing namespaces
@@ -1525,7 +1546,7 @@ def resolve_type(self, string, result): # recursive
1525
1546
break
1526
1547
1527
1548
if used :
1528
- for i in ("type" , "namespace" , "ctypes_type" , "raw_type" ):
1549
+ for i in ("enum" , " type" , "namespace" , "ctypes_type" , "raw_type" ):
1529
1550
if i in used :
1530
1551
result [i ] = used [i ]
1531
1552
result ["unresolved" ] = False
@@ -1860,6 +1881,26 @@ def finalize(self):
1860
1881
if meth ["pure_virtual" ]:
1861
1882
cls ["abstract" ] = True
1862
1883
1884
+ # hack
1885
+ rtnType = {
1886
+ "aliases" : [],
1887
+ "parent" : cls ,
1888
+ "unresolved" : True ,
1889
+ "constant" : 0 ,
1890
+ "constexpr" : 0 ,
1891
+ "static" : 0 ,
1892
+ "pointer" : 0 ,
1893
+ "reference" : 0 ,
1894
+ }
1895
+ self .resolve_type (meth ["rtnType" ], rtnType )
1896
+ if not rtnType ["unresolved" ]:
1897
+ if "enum" in rtnType :
1898
+ meth ["rtnType" ] = rtnType ["enum" ]
1899
+ elif "raw_type" in rtnType :
1900
+ meth ["rtnType" ] = rtnType ["raw_type" ]
1901
+
1902
+ # TODO: all of this needs to die and be replaced by CppVariable
1903
+
1863
1904
if (
1864
1905
not meth ["returns_fundamental" ]
1865
1906
and meth ["returns" ] in C99_NONSTANDARD
0 commit comments