| 439 | } |
| 440 | |
| 441 | static void collectStructDeps ( const TypeDeclPtr & type, Structure * owner, das_hash_set<Structure *> & deps ) { |
| 442 | if ( !type ) return; |
| 443 | if ( type->baseType == Type::tStructure && type->structType && type->structType != owner ) { |
| 444 | if ( type->isPointer() ) return; // pointers don't need full definition |
| 445 | if ( !deps.insert(type->structType).second ) return; // already visited |
| 446 | // recurse into the struct's own fields |
| 447 | for ( auto & field : type->structType->fields ) { |
| 448 | collectStructDeps(field.type, owner, deps); |
| 449 | } |
| 450 | } |
| 451 | // recurse into firstType / secondType for containers |
| 452 | if ( type->firstType ) collectStructDeps(type->firstType, owner, deps); |
| 453 | if ( type->secondType ) collectStructDeps(type->secondType, owner, deps); |
| 454 | // recurse into argTypes (e.g. tuple, variant element types) |
| 455 | for ( auto & argType : type->argTypes ) { |
| 456 | collectStructDeps(argType, owner, deps); |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | static void topoSortStructures ( vector<StructurePtr> & structs ) { |
| 461 | if ( structs.size() <= 1 ) return; |
no test coverage detected