summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWasm/Printer
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWasm/Printer')
-rw-r--r--Userland/Libraries/LibWasm/Printer/Printer.cpp56
-rw-r--r--Userland/Libraries/LibWasm/Printer/Printer.h12
2 files changed, 43 insertions, 25 deletions
diff --git a/Userland/Libraries/LibWasm/Printer/Printer.cpp b/Userland/Libraries/LibWasm/Printer/Printer.cpp
index 17cf67a7fe..f02ac20103 100644
--- a/Userland/Libraries/LibWasm/Printer/Printer.cpp
+++ b/Userland/Libraries/LibWasm/Printer/Printer.cpp
@@ -169,42 +169,56 @@ void Printer::print(const Wasm::ElementSection& section)
print("(section element\n");
{
TemporaryChange change { m_indent, m_indent + 1 };
- print(section.function());
+ for (auto& entry : section.segments())
+ entry.visit([this](auto& segment) { print(segment); });
}
print_indent();
print(")\n");
}
-void Printer::print(const Wasm::ElementSection::Element& element)
+void Printer::print(const Wasm::ElementSection::SegmentType0&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType1& segment)
{
print_indent();
- print("(element\n");
+ print("(element segment kind 1\n");
{
TemporaryChange change { m_indent, m_indent + 1 };
- print_indent();
- print("(table with index {})\n", element.table().value());
- print_indent();
- print("(offset\n");
- {
- TemporaryChange change { m_indent, m_indent + 1 };
- print(element.offset());
- }
- print_indent();
- print(")\n");
- print_indent();
- print("(initializers\n");
- {
- TemporaryChange change { m_indent, m_indent + 1 };
- for (auto& index : element.init())
- print("(init function {})\n", index.value());
+ for (auto& index : segment.function_indices) {
+ print_indent();
+ print("(function index {})\n", index.value());
}
- print_indent();
- print(")\n");
}
print_indent();
print(")\n");
}
+void Printer::print(const Wasm::ElementSection::SegmentType2&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType3&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType4&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType5&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType6&)
+{
+}
+
+void Printer::print(const Wasm::ElementSection::SegmentType7&)
+{
+}
+
void Printer::print(const Wasm::ExportSection& section)
{
print_indent();
diff --git a/Userland/Libraries/LibWasm/Printer/Printer.h b/Userland/Libraries/LibWasm/Printer/Printer.h
index 8226916aa5..d1104c5ae6 100644
--- a/Userland/Libraries/LibWasm/Printer/Printer.h
+++ b/Userland/Libraries/LibWasm/Printer/Printer.h
@@ -21,13 +21,19 @@ struct Printer {
void print(const Wasm::CodeSection&);
void print(const Wasm::CodeSection::Code&);
void print(const Wasm::CodeSection::Func&);
- void print(const Wasm::ConstrainedStream&);
void print(const Wasm::CustomSection&);
void print(const Wasm::DataCountSection&);
void print(const Wasm::DataSection&);
void print(const Wasm::DataSection::Data&);
void print(const Wasm::ElementSection&);
- void print(const Wasm::ElementSection::Element&);
+ void print(const Wasm::ElementSection::SegmentType0&);
+ void print(const Wasm::ElementSection::SegmentType1&);
+ void print(const Wasm::ElementSection::SegmentType2&);
+ void print(const Wasm::ElementSection::SegmentType3&);
+ void print(const Wasm::ElementSection::SegmentType4&);
+ void print(const Wasm::ElementSection::SegmentType5&);
+ void print(const Wasm::ElementSection::SegmentType6&);
+ void print(const Wasm::ElementSection::SegmentType7&);
void print(const Wasm::ExportSection&);
void print(const Wasm::ExportSection::Export&);
void print(const Wasm::Expression&);
@@ -46,8 +52,6 @@ struct Printer {
void print(const Wasm::MemoryType&);
void print(const Wasm::Module&);
void print(const Wasm::Module::Function&);
- void print(const Wasm::ReconsumableStream&);
- void print(const Wasm::ResultType&);
void print(const Wasm::StartSection&);
void print(const Wasm::StartSection::StartFunction&);
void print(const Wasm::TableSection&);