MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / gc_collect

Method gc_collect

src/ast/ast_module.cpp:387–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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){

Callers 5

inferTypesDirtyMethod · 0.45
~GcCollectOnExitMethod · 0.45
~ModuleGcFinalizeMethod · 0.45
InitializeMethod · 0.45
das_program_simulateFunction · 0.45

Calls 2

getMethod · 0.45
foreachMethod · 0.45

Tested by

no test coverage detected