Rename escapeAndQuoteYulString() back to escapeAndQuoteString()

This commit is contained in:
Kamil Śliwak 2021-07-14 21:29:01 +02:00
parent 312ac4a255
commit 6753c8f624
5 changed files with 7 additions and 9 deletions

View File

@ -153,7 +153,7 @@ public:
return; return;
m_out << m_prefix << " /*"; m_out << m_prefix << " /*";
if (m_location.sourceName) if (m_location.sourceName)
m_out << " " + escapeAndQuoteYulString(*m_location.sourceName); m_out << " " + escapeAndQuoteString(*m_location.sourceName);
if (m_location.hasText()) if (m_location.hasText())
m_out << ":" << to_string(m_location.start) + ":" + to_string(m_location.end); m_out << ":" << to_string(m_location.start) + ":" + to_string(m_location.end);
m_out << " " << locationFromSources(m_sourceCodes, m_location); m_out << " " << locationFromSources(m_sourceCodes, m_location);

View File

@ -3166,5 +3166,5 @@ bool IRGeneratorForStatements::visit(TryCatchClause const& _clause)
string IRGeneratorForStatements::linkerSymbol(ContractDefinition const& _library) const string IRGeneratorForStatements::linkerSymbol(ContractDefinition const& _library) const
{ {
solAssert(_library.isLibrary(), ""); solAssert(_library.isLibrary(), "");
return "linkersymbol(" + util::escapeAndQuoteYulString(_library.fullyQualifiedName()) + ")"; return "linkersymbol(" + util::escapeAndQuoteString(_library.fullyQualifiedName()) + ")";
} }

View File

@ -192,13 +192,11 @@ string solidity::util::formatAsStringOrNumber(string const& _value)
if (c <= 0x1f || c >= 0x7f || c == '"') if (c <= 0x1f || c >= 0x7f || c == '"')
return "0x" + h256(_value, h256::AlignLeft).hex(); return "0x" + h256(_value, h256::AlignLeft).hex();
// The difference in escaping is only in characters below 0x1f and the string does not have them return escapeAndQuoteString(_value);
// so this will work for Solidity strings too.
return escapeAndQuoteYulString(_value);
} }
string solidity::util::escapeAndQuoteYulString(string const& _input) string solidity::util::escapeAndQuoteString(string const& _input)
{ {
string out; string out;

View File

@ -552,9 +552,9 @@ bool isValidDecimal(std::string const& _string);
/// _value cannot be longer than 32 bytes. /// _value cannot be longer than 32 bytes.
std::string formatAsStringOrNumber(std::string const& _value); std::string formatAsStringOrNumber(std::string const& _value);
/// @returns a string with the usual backslash-escapes for non-ASCII /// @returns a string with the usual backslash-escapes for non-printable and non-ASCII
/// characters and surrounded by '"'-characters. /// characters and surrounded by '"'-characters.
std::string escapeAndQuoteYulString(std::string const& _input); std::string escapeAndQuoteString(std::string const& _input);
template<typename Container, typename Compare> template<typename Container, typename Compare>
bool containerEqual(Container const& _lhs, Container const& _rhs, Compare&& _compare) bool containerEqual(Container const& _lhs, Container const& _rhs, Compare&& _compare)

View File

@ -57,7 +57,7 @@ string AsmPrinter::operator()(Literal const& _literal) const
break; break;
} }
return escapeAndQuoteYulString(_literal.value.str()) + appendTypeName(_literal.type); return escapeAndQuoteString(_literal.value.str()) + appendTypeName(_literal.type);
} }
string AsmPrinter::operator()(Identifier const& _identifier) const string AsmPrinter::operator()(Identifier const& _identifier) const