Yul formatting: Reduce multiple consecutive empty lines to a single one.

This commit is contained in:
chriseth 2020-04-22 10:49:44 +02:00
parent c7b4fa34bd
commit f82f167290
7 changed files with 7 additions and 37 deletions

View File

@ -59,6 +59,13 @@ string solidity::yul::reindent(string const& _code)
for (string& line: lines)
boost::trim(line);
// Reduce multiple consecutive empty lines.
lines = fold(lines, vector<string>{}, [](auto&& _lines, auto&& _line) {
if (!(_line.empty() && !_lines.empty() && _lines.back().empty()))
_lines.emplace_back(std::move(_line));
return std::move(_lines);
});
stringstream out;
int depth = 0;

View File

@ -16,12 +16,8 @@ object \"C_6\" {
codecopy(0, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(0, datasize(\"C_6_deployed\"))
function constructor_C_6() {
}
}
@ -50,7 +46,6 @@ object \"C_6\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
@ -71,7 +66,6 @@ object \"C_6\" {
function fun_f_5() {
}
function shift_right_224_unsigned(value) -> newValue {

View File

@ -16,12 +16,8 @@ object \"C_10\" {
codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\"))
return(0, datasize(\"C_10_deployed\"))
function constructor_C_10() {
}
}
@ -50,7 +46,6 @@ object \"C_10\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
@ -81,11 +76,8 @@ object \"C_10\" {
function array_length_t_string_memory_ptr(value) -> length {
length := mload(value)
}
function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {

View File

@ -16,12 +16,8 @@ object \"C_10\" {
codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\"))
return(0, datasize(\"C_10_deployed\"))
function constructor_C_10() {
}
}
@ -50,7 +46,6 @@ object \"C_10\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }

View File

@ -16,12 +16,8 @@ object \"C_10\" {
codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\"))
return(0, datasize(\"C_10_deployed\"))
function constructor_C_10() {
}
}
@ -50,7 +46,6 @@ object \"C_10\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }

View File

@ -16,12 +16,8 @@ object \"C_10\" {
codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\"))
return(0, datasize(\"C_10_deployed\"))
function constructor_C_10() {
}
}
@ -50,7 +46,6 @@ object \"C_10\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }
@ -81,11 +76,8 @@ object \"C_10\" {
function array_length_t_string_memory_ptr(value) -> length {
length := mload(value)
}
function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {

View File

@ -16,12 +16,8 @@ object \"C_10\" {
codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\"))
return(0, datasize(\"C_10_deployed\"))
function constructor_C_10() {
}
}
@ -50,7 +46,6 @@ object \"C_10\" {
if iszero(calldatasize()) { }
revert(0, 0)
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert(0, 0) }