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

Method hasUserFinalizer

src/ast/ast.cpp:349–363  ·  view source on GitHub ↗

True if this class has a non-generated finalizer method. Class finalizers keep the plain name "finalize" (parser: ast_structVarDef), so the registry lookup is by that name with the classParent identity check filtering out other classes' finalizers and free-function struct finalizers.

Source from the content-addressed store, hash-verified

347 // by that name with the classParent identity check filtering out other classes'
348 // finalizers and free-function struct finalizers.
349 bool Structure::hasUserFinalizer() const {
350 if ( !module ) return false;
351 uint64_t hName = hash64z("finalize");
352 if ( auto kv = module->functionsByName.find(hName) ) {
353 for ( auto * fn : kv->second ) {
354 if ( !fn->generated && fn->classParent == this ) return true;
355 }
356 }
357 if ( auto kv = module->genericsByName.find(hName) ) {
358 for ( auto * fn : kv->second ) {
359 if ( !fn->generated && fn->classParent == this ) return true;
360 }
361 }
362 return false;
363 }
364
365 bool Structure::canCopy(bool tempMatters) const {
366 if ( circularGuard ) return true;

Callers 1

Calls 2

hash64zFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected