| 1369 | } |
| 1370 | |
| 1371 | DUContext* DUContext::findContextAt(const CursorInRevision& position, bool includeRightBorder) const |
| 1372 | { |
| 1373 | ENSURE_CAN_READ |
| 1374 | |
| 1375 | // qCDebug(LANGUAGE) << "searching" << position << "in:" << scopeIdentifier(true).toString() << range() << includeRightBorder; |
| 1376 | |
| 1377 | if (!range().contains(position) && (!includeRightBorder || range().end != position)) { |
| 1378 | // qCDebug(LANGUAGE) << "mismatch"; |
| 1379 | return nullptr; |
| 1380 | } |
| 1381 | |
| 1382 | const auto childContexts = m_dynamicData->m_childContexts; |
| 1383 | for (int a = childContexts.size() - 1; a >= 0; --a) { |
| 1384 | if (DUContext* specific = childContexts[a]->findContextAt(position, includeRightBorder)) { |
| 1385 | return specific; |
| 1386 | } |
| 1387 | } |
| 1388 | |
| 1389 | return const_cast<DUContext*>(this); |
| 1390 | } |
| 1391 | |
| 1392 | Declaration* DUContext::findDeclarationAt(const CursorInRevision& position) const |
| 1393 | { |