mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibWasm: Stub out/implement parsing of all ElementSection segments
Previously, this was parsing only one kind because I mistakenly assumed that they all had the same shape, now it can parse two kinds, and will return NotImplemented for the rest.
This commit is contained in:
parent
4d9246ac9d
commit
a5194274af
5 changed files with 235 additions and 81 deletions
|
@ -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());
|
||||
for (auto& index : segment.function_indices) {
|
||||
print_indent();
|
||||
print("(function index {})\n", index.value());
|
||||
}
|
||||
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());
|
||||
}
|
||||
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue