| 143 | } |
| 144 | |
| 145 | DocumentChangeSet::ChangeResult BasicRefactoring::applyChanges(const QString& oldName, const QString& newName, |
| 146 | DocumentChangeSet& changes, DUContext* context, |
| 147 | int usedDeclarationIndex) |
| 148 | { |
| 149 | if (usedDeclarationIndex == std::numeric_limits<int>::max()) |
| 150 | return DocumentChangeSet::ChangeResult::successfulResult(); |
| 151 | |
| 152 | for (int a = 0; a < context->usesCount(); ++a) { |
| 153 | const Use& use(context->uses()[a]); |
| 154 | if (use.m_declarationIndex != usedDeclarationIndex) |
| 155 | continue; |
| 156 | if (use.m_range.isEmpty()) { |
| 157 | qCDebug(LANGUAGE) << "found empty use"; |
| 158 | continue; |
| 159 | } |
| 160 | DocumentChangeSet::ChangeResult result = |
| 161 | changes.addChange(DocumentChange(context->url(), context->transformFromLocalRevision(use.m_range), oldName, |
| 162 | newName)); |
| 163 | if (!result) |
| 164 | return result; |
| 165 | } |
| 166 | |
| 167 | const auto childContexts = context->childContexts(); |
| 168 | for (DUContext* child : childContexts) { |
| 169 | DocumentChangeSet::ChangeResult result = applyChanges(oldName, newName, changes, child, usedDeclarationIndex); |
| 170 | if (!result) |
| 171 | return result; |
| 172 | } |
| 173 | |
| 174 | return DocumentChangeSet::ChangeResult::successfulResult(); |
| 175 | } |
| 176 | |
| 177 | DocumentChangeSet::ChangeResult BasicRefactoring::applyChangesToDeclarations(const QString& oldName, |
| 178 | const QString& newName, |
nothing calls this directly
no test coverage detected