From ded9ef17e8508127c5ee732b78c27b5b6862b573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 20 Apr 2023 19:47:26 +0200 Subject: [PATCH] Misc small refactors: Use ranges::views::keys and fmt::format() --- libsolidity/interface/CompilerStack.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index e02d6afee..ce57cedb7 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -82,6 +82,9 @@ #include #include +#include + +#include #include #include @@ -710,10 +713,11 @@ bool CompilerStack::compile(State _stopAfter) 1834_error, Error::Type::CodeGenerationError, *sourceLocation, - "Unimplemented feature error" + - ((comment && !comment->empty()) ? ": " + *comment : string{}) + - " in " + - _unimplementedError.lineInfo() + fmt::format( + "Unimplemented feature error {} in {}", + (comment && !comment->empty()) ? ": " + *comment : "", + _unimplementedError.lineInfo() + ) ); return false; } @@ -949,10 +953,7 @@ Json::Value CompilerStack::assemblyJSON(string const& _contractName) const vector CompilerStack::sourceNames() const { - vector names; - for (auto const& s: m_sources) - names.push_back(s.first); - return names; + return ranges::to(m_sources | ranges::views::keys); } map CompilerStack::sourceIndices() const