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

Method addAnnotation

src/ast/ast_module.cpp:459–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457 }
458
459 bool Module::addAnnotation ( AnnotationPtr ptr, bool canFail ) {
460 auto key = hash64z(ptr->name.c_str());
461 auto it = handleTypes.find(key);
462 if ( it!=handleTypes.end() && it->second==ptr ) {
463 ptr->seal(this);
464 return true;
465 }
466 if ( it==handleTypes.end() ) {
467 ptr->seal(this);
468 handleTypes[key] = ptr;
469 return true;
470 } else {
471 if ( !canFail ) {
472 DAS_FATAL_ERROR("can't add duplicate annotation %s to module %s\n", ptr->name.c_str(), name.c_str() );
473 }
474 return false;
475 }
476 }
477
478 bool Module::addTypeInfoMacro ( TypeInfoMacro * ptr, bool canFail ) {
479 if ( typeInfoMacros.insert(make_pair(ptr->name, unique_ptr<TypeInfoMacro>(ptr))).second ) {

Callers 9

addStructureHandleMethod · 0.80
makeMethod · 0.80
addVectorAnnotationFunction · 0.80
addHandleAnnotationFunction · 0.80

Calls 5

hash64zFunction · 0.85
c_strMethod · 0.45
findMethod · 0.45
endMethod · 0.45
sealMethod · 0.45

Tested by

no test coverage detected