MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / finish

Method finish

modules/gdscript/gdscript.cpp:2339–2380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2337}
2338
2339void GDScriptLanguage::finish() {
2340 if (finishing) {
2341 return;
2342 }
2343 finishing = true;
2344
2345 // Clear the cache before parsing the script_list
2346 GDScriptCache::clear();
2347
2348 // Clear dependencies between scripts, to ensure cyclic references are broken
2349 // (to avoid leaks at exit).
2350 SelfList<GDScript> *s = script_list.first();
2351 while (s) {
2352 // This ensures the current script is not released before we can check
2353 // what's the next one in the list (we can't get the next upfront because we
2354 // don't know if the reference breaking will cause it -or any other after
2355 // it, for that matter- to be released so the next one is not the same as
2356 // before).
2357 Ref<GDScript> scr = s->self();
2358 if (scr.is_valid()) {
2359 for (KeyValue<StringName, GDScriptFunction *> &E : scr->member_functions) {
2360 GDScriptFunction *func = E.value;
2361 for (int i = 0; i < func->argument_types.size(); i++) {
2362 func->argument_types.write[i].script_type_ref = Ref<Script>();
2363 }
2364 func->return_type.script_type_ref = Ref<Script>();
2365 }
2366 for (KeyValue<StringName, GDScript::MemberInfo> &E : scr->member_indices) {
2367 E.value.data_type.script_type_ref = Ref<Script>();
2368 }
2369
2370 // Clear backup for scripts that could slip out of the cyclic reference
2371 // check
2372 scr->clear();
2373 }
2374 s = s->next();
2375 }
2376 script_list.clear();
2377 function_list.clear();
2378
2379 finishing = false;
2380}
2381
2382void GDScriptLanguage::profiling_start() {
2383#ifdef DEBUG_ENABLED

Callers 5

finish_languageFunction · 0.45
finalize_physicsFunction · 0.45
finalize_displayFunction · 0.45
cleanupMethod · 0.45

Calls 7

clearFunction · 0.85
firstMethod · 0.80
selfMethod · 0.80
sizeMethod · 0.65
is_validMethod · 0.45
clearMethod · 0.45
nextMethod · 0.45

Tested by 1

finish_languageFunction · 0.36