mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Generalize existing functions for indenting and prefixing
This commit is contained in:
+1
-15
@@ -30,8 +30,6 @@
|
||||
#include <libsolutil/StringUtils.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
#include <range/v3/view/transform.hpp>
|
||||
|
||||
@@ -40,18 +38,6 @@ using namespace solidity::langutil;
|
||||
using namespace solidity::util;
|
||||
using namespace solidity::yul;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::string indent(std::string const& _input)
|
||||
{
|
||||
if (_input.empty())
|
||||
return _input;
|
||||
return boost::replace_all_copy(" " + _input, "\n", "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string Data::toString(Dialect const*, DebugInfoSelection const&, CharStreamProvider const*) const
|
||||
{
|
||||
return "data \"" + name.str() + "\" hex\"" + util::toHex(data) + "\"";
|
||||
@@ -86,7 +72,7 @@ std::string Object::toString(
|
||||
for (auto const& obj: subObjects)
|
||||
inner += "\n" + obj->toString(_dialect, _debugInfoSelection, _soliditySourceProvider);
|
||||
|
||||
return useSrcComment + "object \"" + name.str() + "\" {\n" + indent(inner) + "\n}";
|
||||
return useSrcComment + "object \"" + name.str() + "\" {\n" + indent(inner, true /* _indentEmptyLines */) + "\n}";
|
||||
}
|
||||
|
||||
Json::Value Data::toJson() const
|
||||
|
||||
Reference in New Issue
Block a user