|
13 | 13 | """
|
14 | 14 |
|
15 | 15 | import scopedef
|
| 16 | +import itertools |
16 | 17 | import compilers
|
17 | 18 | import algorithm
|
18 | 19 | import declaration
|
@@ -276,13 +277,28 @@ def recursive_derived(self):
|
276 | 277 |
|
277 | 278 | def _get_is_abstract(self):
|
278 | 279 | if self.compiler == compilers.MSVC_PDB_9:
|
| 280 | + #prevent cyclic dependencies |
279 | 281 | import calldef
|
280 |
| - import matchers #prevent cyclic dependencies |
281 |
| - m = matchers.virtuality_type_matcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL ) |
282 |
| - if self.calldefs( m, recursive=False, allow_empty=True ): |
| 282 | + import function_traits |
| 283 | + from matchers import virtuality_type_matcher_t as vtmatcher_t |
| 284 | + filter_pv = vtmatcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL ) |
| 285 | + if self.calldefs( filter_pv, recursive=False, allow_empty=True ): |
283 | 286 | return True
|
| 287 | + filter_npv = vtmatcher_t( calldef.VIRTUALITY_TYPES.VIRTUAL ) \ |
| 288 | + | vtmatcher_t( calldef.VIRTUALITY_TYPES.NOT_VIRTUAL ) |
| 289 | + pv_calldefs = [] |
| 290 | + npv_calldefs = [] |
| 291 | + |
| 292 | + npv_calldefs.extend( self.calldefs( filter_npv, recursive=False, allow_empty=True ) ) |
284 | 293 | for base in self.recursive_bases:
|
285 |
| - if base.related_class.calldefs( m, recursive=False, allow_empty=True ): |
| 294 | + cls = base.related_class |
| 295 | + pv_calldefs.extend( cls.calldefs( filter_pv, recursive=False, allow_empty=True ) ) |
| 296 | + npv_calldefs.extend( cls.calldefs( filter_npv, recursive=False, allow_empty=True ) ) |
| 297 | + |
| 298 | + for pure_virtual in pv_calldefs: |
| 299 | + impl_found = filter( lambda f: function_traits.is_same_function( pure_virtual, f ) |
| 300 | + , npv_calldefs ) |
| 301 | + if not impl_found: |
286 | 302 | return True
|
287 | 303 | return False
|
288 | 304 | else:
|
|
0 commit comments