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

Method clone

src/ast/ast.cpp:255–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253 }
254
255 StructurePtr Structure::clone() const {
256 auto cs = new Structure(name);
257 cs->fields.reserve(fields.size());
258 for ( auto & fd : fields ) {
259 cs->fields.emplace_back(fd.name, new TypeDecl(*fd.type), fd.init ? fd.init->clone() : nullptr, fd.annotation, fd.moveSemantics, fd.at);
260 cs->fields.back().flags = fd.flags;
261 }
262 aliases.foreach([&](const TypeDeclPtr & atype) -> bool {
263 cs->aliases.insert(atype->alias, new TypeDecl(*atype));
264 return true;
265 });
266 cs->at = at;
267 cs->module = module;
268 cs->flags = flags;
269 cs->annotations = cloneAnnotationList(annotations);
270 return cs;
271 }
272
273 bool Structure::isCompatibleCast ( const Structure & castS ) const {
274 if (this == &castS) {

Callers 15

transformCallMethod · 0.45
ast_structureNameFunction · 0.45
ast_structureDeclarationFunction · 0.45
ast_globalLetListFunction · 0.45
ast_globalLetFunction · 0.45
ast_makeBlockFunction · 0.45
ast_LetFunction · 0.45
ast_LetListFunction · 0.45
visitMethod · 0.45
addStructureHandleMethod · 0.45
visitGlobalLetInitMethod · 0.45

Calls 6

cloneAnnotationListFunction · 0.85
reserveMethod · 0.45
sizeMethod · 0.45
foreachMethod · 0.45
insertMethod · 0.45
push_backMethod · 0.45

Tested by 1

transformCallMethod · 0.36