9
9
10
10
import cpptypes
11
11
12
+ class impl_details :
13
+ @staticmethod
14
+ def dig_declarations ( depend_on_it ):
15
+ #prevent recursive import
16
+ from pygccxml import declarations
17
+
18
+ if isinstance ( depend_on_it , declarations .declaration_t ):
19
+ return [depend_on_it ]
20
+ base_type = declarations .base_type ( declarations .remove_alias ( depend_on_it ) )
21
+ if isinstance ( base_type , cpptypes .declarated_t ):
22
+ return [base_type .declaration ]
23
+ elif isinstance ( base_type , cpptypes .calldef_type_t ):
24
+ result = []
25
+ result .extend ( impl_details .dig_declarations ( base_type .return_type ) )
26
+ for argtype in base_type .arguments_types :
27
+ result .extend ( impl_details .dig_declarations ( argtype ) )
28
+ if isinstance ( base_type , cpptypes .member_function_type_t ):
29
+ result .extend ( impl_details .dig_declarations ( base_type .class_inst ) )
30
+ return result
31
+ return []
32
+
33
+
12
34
class dependency_info_t ( object ):
13
35
def __init__ ( self , declaration , depend_on_it , access_type = None , hint = None ):
14
36
object .__init__ ( self )
@@ -46,19 +68,11 @@ def hint(self):
46
68
about dependency. It can be used later"""
47
69
return self ._hint
48
70
49
- def find_out_depend_on_declaration ( self ):
71
+ def find_out_depend_on_it_declarations ( self ):
50
72
"""if declaration depends on other declaration and not on some type
51
73
this function will return reference to it. Otherwise None will be returned
52
74
"""
53
- #prevent recursive import
54
- from pygccxml import declarations
55
-
56
- if isinstance ( self .depend_on_it , declarations .declaration_t ):
57
- return self .depend_on_it
58
- base_type = declarations .base_type ( declarations .remove_alias ( self .depend_on_it ) )
59
- if isinstance ( base_type , cpptypes .declarated_t ):
60
- return base_type .declaration
61
- return None
75
+ return impl_details .dig_declarations ( self .depend_on_it )
62
76
63
77
@staticmethod
64
78
def i_depend_on_them ( decl ):
@@ -67,9 +81,9 @@ def i_depend_on_them( decl ):
67
81
import class_declaration #prevent cyclic imports
68
82
to_be_included = set ()
69
83
for dependency_info in decl .i_depend_on_them ():
70
- ddecl = dependency_info .find_out_depend_on_declaration ()
71
- if ddecl :
72
- to_be_included .add ( ddecl )
84
+ for ddecl in dependency_info .find_out_depend_on_it_declarations ():
85
+ if ddecl :
86
+ to_be_included .add ( ddecl )
73
87
74
88
if isinstance ( decl .parent , class_declaration .class_t ):
75
89
to_be_included .add ( decl .parent )
0 commit comments