Skip to content

Commit 5735ca7

Browse files
YuriUfimtsevusiems
authored andcommitted
Revert copy method
1 parent 46d7e6e commit 5735ca7

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

generator/abstractmetabuilder.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,15 +1936,16 @@ bool AbstractMetaBuilder::isEnum(const QStringList &qualified_name)
19361936
return item && item->kind() == _EnumModelItem::__node_kind;
19371937
}
19381938

1939-
AbstractMetaType::shared_pointer AbstractMetaBuilder::inheritTemplateType(const QList<AbstractMetaType::shared_pointer> &template_types,
1939+
AbstractMetaType::shared_pointer AbstractMetaBuilder::inheritTemplateType(
1940+
const QList<AbstractMetaType::shared_pointer> &template_types,
19401941
AbstractMetaType::shared_pointer meta_type, bool *ok)
19411942
{
19421943
if (ok != 0)
19431944
*ok = true;
19441945
if (!meta_type || (!meta_type->typeEntry()->isTemplateArgument() && !meta_type->hasInstantiations()))
1945-
return meta_type ? meta_type : 0;
1946+
return meta_type ? meta_type->copy() : 0;
19461947

1947-
AbstractMetaType::shared_pointer returned = meta_type;
1948+
AbstractMetaType::shared_pointer returned = meta_type->copy();
19481949
returned->setOriginalTemplateType(meta_type);
19491950

19501951
if (returned->typeEntry()->isTemplateArgument()) {
@@ -1958,7 +1959,7 @@ AbstractMetaType::shared_pointer AbstractMetaBuilder::inheritTemplateType(const
19581959
return 0;
19591960
}
19601961

1961-
AbstractMetaType::shared_pointer t = returned;
1962+
AbstractMetaType::shared_pointer t = returned->copy();
19621963
t->setTypeEntry(template_types.at(tae->ordinal())->typeEntry());
19631964
t->setIndirections(template_types.at(tae->ordinal())->indirections() + t->indirections()
19641965
? 1

generator/abstractmetalang.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@
4747
/*******************************************************************************
4848
* AbstractMetaType
4949
*/
50+
AbstractMetaType::shared_pointer AbstractMetaType::copy() const
51+
{
52+
AbstractMetaType *cpy = new AbstractMetaType;
53+
54+
cpy->setTypeUsagePattern(typeUsagePattern());
55+
cpy->setConstant(isConstant());
56+
cpy->setReference(isReference());
57+
cpy->setIndirections(indirections());
58+
cpy->setInstantiations(instantiations());
59+
cpy->setArrayElementCount(arrayElementCount());
60+
cpy->setOriginalTypeDescription(originalTypeDescription());
61+
cpy->setOriginalTemplateType(originalTemplateType() ? originalTemplateType()->copy() : 0);
62+
63+
cpy->setArrayElementType(arrayElementType() ? arrayElementType()->copy() : 0);
64+
65+
cpy->setTypeEntry(typeEntry());
66+
67+
return AbstractMetaType::shared_pointer(cpy);
68+
}
69+
5070
QString AbstractMetaType::cppSignature() const
5171
{
5272
QString s;

generator/abstractmetalang.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ class AbstractMetaType
280280

281281
QString cppSignature() const;
282282

283+
AbstractMetaType::shared_pointer copy() const;
284+
283285
const TypeEntry *typeEntry() const { return m_type_entry; }
284286
void setTypeEntry(const TypeEntry *type) { m_type_entry = type; }
285287

0 commit comments

Comments
 (0)