| 149 | } |
| 150 | |
| 151 | void Uses::removeUse(const DeclarationId& id, const IndexedTopDUContext& use) |
| 152 | { |
| 153 | UsesItem item; |
| 154 | item.declaration = id; |
| 155 | UsesRequestItem request(item); |
| 156 | |
| 157 | LockedItemRepository::write<Uses>([&](UsesRepo& repo) { |
| 158 | uint index = repo.findIndex(item); |
| 159 | |
| 160 | if (index) { |
| 161 | // Check whether the item is already in the mapped list, else copy the list into the new created item |
| 162 | const UsesItem* oldItem = repo.itemFromIndex(index); |
| 163 | for (unsigned int a = 0; a < oldItem->usesSize(); ++a) |
| 164 | if (!(oldItem->uses()[a] == use)) |
| 165 | item.usesList().append(oldItem->uses()[a]); |
| 166 | |
| 167 | repo.deleteItem(index); |
| 168 | Q_ASSERT(repo.findIndex(item) == 0); |
| 169 | |
| 170 | // This inserts the changed item |
| 171 | if (item.usesSize() != 0) |
| 172 | repo.index(request); |
| 173 | } |
| 174 | }); |
| 175 | } |
| 176 | |
| 177 | bool Uses::hasUses(const DeclarationId& id) const |
| 178 | { |
no test coverage detected