| 134 | } |
| 135 | |
| 136 | Declaration::~Declaration() |
| 137 | { |
| 138 | uint oldOwnIndex = m_indexInTopContext; |
| 139 | |
| 140 | TopDUContext* topContext = this->topContext(); |
| 141 | |
| 142 | //Only perform the actions when the top-context isn't being deleted, or when it hasn't been stored to disk |
| 143 | if (persistentlyDestroying()) { |
| 144 | DUCHAIN_D_DYNAMIC(Declaration); |
| 145 | |
| 146 | // Inserted by the builder after construction has finished. |
| 147 | if (d->m_internalContext.context()) |
| 148 | d->m_internalContext.context()->setOwner(nullptr); |
| 149 | |
| 150 | setInSymbolTable(false); |
| 151 | } |
| 152 | |
| 153 | // If the parent-context already has dynamic data, like for example any temporary context, |
| 154 | // always delete the declaration, to not create crashes within more complex code like C++ template stuff. |
| 155 | if (context() && !d_func()->m_anonymousInContext) { |
| 156 | if (!topContext->deleting() || !topContext->isOnDisk() || context()->d_func()->isDynamic()) |
| 157 | context()->m_dynamicData->removeDeclaration(this); |
| 158 | } |
| 159 | |
| 160 | clearOwnIndex(); |
| 161 | |
| 162 | if (!topContext->deleting() || !topContext->isOnDisk()) { |
| 163 | setContext(nullptr); |
| 164 | |
| 165 | setAbstractType(AbstractType::Ptr()); |
| 166 | } |
| 167 | Q_ASSERT(d_func()->isDynamic() == |
| 168 | (!topContext->deleting() || !topContext->isOnDisk() || |
| 169 | topContext->m_dynamicData->isTemporaryDeclarationIndex(oldOwnIndex))); |
| 170 | Q_UNUSED(oldOwnIndex); |
| 171 | } |
| 172 | |
| 173 | QByteArray Declaration::comment() const |
| 174 | { |
nothing calls this directly
no test coverage detected