LibWasm: Use String::join in Printer where apropriate

This commit is contained in:
Hendiadyoin1 2022-10-03 13:08:10 +02:00 committed by Linus Groh
parent 8a9d4246f1
commit e0a6ed4bc0
Notes: sideshowbarker 2024-07-17 06:23:58 +09:00

View file

@ -131,27 +131,13 @@ void Printer::print(Wasm::DataSection::Data const& data)
[this](DataSection::Data::Passive const& value) { [this](DataSection::Data::Passive const& value) {
print_indent(); print_indent();
print("(passive init {}xu8 (", value.init.size()); print("(passive init {}xu8 (", value.init.size());
bool first = true; print(String::join(' ', value.init, "{:x}"sv));
for (auto v : value.init) {
if (first)
print("{:x}", v);
else
print(" {:x}", v);
first = false;
}
print(")\n"); print(")\n");
}, },
[this](DataSection::Data::Active const& value) { [this](DataSection::Data::Active const& value) {
print_indent(); print_indent();
print("(active init {}xu8 (", value.init.size()); print("(active init {}xu8 (", value.init.size());
bool first = true; print(String::join(' ', value.init, "{:x}"sv));
for (auto v : value.init) {
if (first)
print("{:x}", v);
else
print(" {:x}", v);
first = false;
}
print("\n"); print("\n");
{ {
TemporaryChange change { m_indent, m_indent + 1 }; TemporaryChange change { m_indent, m_indent + 1 };