| 385 | } |
| 386 | |
| 387 | void Module::gc_collect ( gc_root * from, gc_root * targetArg ) { |
| 388 | auto target = targetArg ? targetArg : module_gc_root.get(); |
| 389 | // collect alias types |
| 390 | aliasTypes.foreach([&](auto td) { |
| 391 | if ( td ) td->gc_collect(target, from); |
| 392 | }); |
| 393 | // collect types in handle/annotation types |
| 394 | for ( auto & [key, ann] : handleTypes ) { |
| 395 | if ( ann ) ann->gc_collect(target, from); |
| 396 | } |
| 397 | // collect types in structures (full recursive walk via virtual gc_collect) |
| 398 | structures.foreach([&](auto & st) { |
| 399 | st->gc_collect(target, from); |
| 400 | }); |
| 401 | // collect types in functions (full recursive walk via virtual gc_collect) |
| 402 | functions.foreach([&](auto & fn) { |
| 403 | fn->gc_collect(target, from); |
| 404 | }); |
| 405 | generics.foreach([&](auto & fn) { |
| 406 | fn->gc_collect(target, from); |
| 407 | }); |
| 408 | // collect types in globals |
| 409 | globals.foreach([&](auto & var) { |
| 410 | var->gc_collect(target, from); |
| 411 | }); |
| 412 | // collect types in enumerations |
| 413 | enumerations.foreach([&](auto & en) { |
| 414 | en->gc_collect(target, from); |
| 415 | }); |
| 416 | } |
| 417 | |
| 418 | void Module::CollectSharedModules() { |
| 419 | Module::foreach([&](Module * mod){ |
no test coverage detected