| 28 | using namespace solidity::langutil; |
| 29 | |
| 30 | SourceReferenceExtractor::Message SourceReferenceExtractor::extract( |
| 31 | CharStreamProvider const& _charStreamProvider, |
| 32 | util::Exception const& _exception, |
| 33 | std::variant<Error::Type, Error::Severity> _typeOrSeverity |
| 34 | ) |
| 35 | { |
| 36 | SourceLocation const* location = boost::get_error_info<errinfo_sourceLocation>(_exception); |
| 37 | |
| 38 | std::string const* message = boost::get_error_info<util::errinfo_comment>(_exception); |
| 39 | SourceReference primary = extract(_charStreamProvider, location, message ? *message : ""); |
| 40 | |
| 41 | std::vector<SourceReference> secondary; |
| 42 | auto secondaryLocation = boost::get_error_info<errinfo_secondarySourceLocation>(_exception); |
| 43 | if (secondaryLocation && !secondaryLocation->infos.empty()) |
| 44 | for (auto const& info: secondaryLocation->infos) |
| 45 | secondary.emplace_back(extract(_charStreamProvider, &info.second, info.first)); |
| 46 | |
| 47 | return Message{std::move(primary), _typeOrSeverity, std::move(secondary), std::nullopt}; |
| 48 | } |
| 49 | |
| 50 | SourceReferenceExtractor::Message SourceReferenceExtractor::extract( |
| 51 | CharStreamProvider const& _charStreamProvider, |
no test coverage detected