SourceContext ResourceManager::readContext(const SourceLocation &location, size_t maxContextLength) { const Resource &resource = getResource(location.getSourceId()); if (resource.isValid()) { // Fetch a char reader for the resource std::unique_ptr<std::istream> is = resource.stream(); CharReader reader{*is, location.getSourceId()}; // Return the context return contextReaders[location.getSourceId()].readContext( reader, location, maxContextLength, resource.getLocation()); } return SourceContext{}; }