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

Method addStructureHandle

src/ast/ast_program.cpp:193–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 }
192
193 bool Program::addStructureHandle ( const StructurePtr & st, const TypeAnnotationPtr & ann, const AnnotationArgumentList & arg ) {
194 if ( ann->rtti_isStructureTypeAnnotation() ) {
195 auto annotation = static_cast<StructureTypeAnnotation*>(ann->clone());
196 annotation->name = st->name;
197 string err;
198 if ( annotation->create(st,arg,err) ) {
199 return thisModule->addAnnotation(annotation, true);
200 } else {
201 error("can't create structure handle "+ann->name,err,"",st->at,CompilationError::cant_create_structure_annotation);
202 return false;
203 }
204 } else {
205 error("not a structure annotation "+ann->name,"","",st->at,CompilationError::invalid_structure_annotation);
206 return false;
207 }
208 }
209
210 Program::Program() {
211 ref_count_magic = TRACK_PTR_PROGRAM;

Callers 1

ast_structureDeclarationFunction · 0.80

Calls 4

addAnnotationMethod · 0.80
cloneMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected