| 1507 | } |
| 1508 | |
| 1509 | ParsingEnvironmentFilePointer DUChain::environmentFileForDocument(const IndexedString& document, |
| 1510 | const ParsingEnvironment* environment, |
| 1511 | bool proxyContext) const |
| 1512 | { |
| 1513 | ENSURE_CHAIN_READ_LOCKED; |
| 1514 | |
| 1515 | if (sdDUChainPrivate->m_destroyed) |
| 1516 | return ParsingEnvironmentFilePointer(); |
| 1517 | const QList<ParsingEnvironmentFilePointer> list = sdDUChainPrivate->getEnvironmentInformation(document); |
| 1518 | |
| 1519 | // qCDebug(LANGUAGE) << document.str() << ": matching" << list.size() << (onlyProxyContexts ? "proxy-contexts" : (noProxyContexts ? "content-contexts" : "contexts")); |
| 1520 | |
| 1521 | for (auto& envFilePtr : list) { |
| 1522 | if (envFilePtr && (envFilePtr->isProxyContext() == proxyContext) && envFilePtr->matchEnvironment(environment) && |
| 1523 | // Verify that the environment-file and its top-context are "good": The top-context must exist, |
| 1524 | // and there must be a content-context associated to the proxy-context. |
| 1525 | envFilePtr->topContext() && |
| 1526 | (!proxyContext || DUChainUtils::contentContextFromProxyContext(envFilePtr->topContext()))) { |
| 1527 | return envFilePtr; |
| 1528 | } |
| 1529 | } |
| 1530 | return ParsingEnvironmentFilePointer(); |
| 1531 | } |
| 1532 | |
| 1533 | QList<ParsingEnvironmentFilePointer> DUChain::allEnvironmentFiles(const IndexedString& document) |
| 1534 | { |