mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:27:36 +00:00
Everywhere: Remove the AK::
qualifier from Stream usages
This commit is contained in:
parent
874c7bba28
commit
43f98ac6e1
73 changed files with 275 additions and 278 deletions
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace Wasm {
|
||||
|
||||
ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof)
|
||||
ParseError with_eof_check(Stream const& stream, ParseError error_if_not_eof)
|
||||
{
|
||||
if (stream.is_eof())
|
||||
return ParseError::UnexpectedEof;
|
||||
|
@ -22,7 +22,7 @@ ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
static auto parse_vector(AK::Stream& stream)
|
||||
static auto parse_vector(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
if constexpr (requires { T::parse(stream); }) {
|
||||
|
@ -73,7 +73,7 @@ static auto parse_vector(AK::Stream& stream)
|
|||
}
|
||||
}
|
||||
|
||||
static ParseResult<DeprecatedString> parse_name(AK::Stream& stream)
|
||||
static ParseResult<DeprecatedString> parse_name(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
auto data = parse_vector<u8>(stream);
|
||||
|
@ -89,8 +89,8 @@ struct ParseUntilAnyOfResult {
|
|||
Vector<T> values;
|
||||
};
|
||||
template<typename T, u8... terminators, typename... Args>
|
||||
static ParseResult<ParseUntilAnyOfResult<T>> parse_until_any_of(AK::Stream& stream, Args&... args)
|
||||
requires(requires(AK::Stream& stream, Args... args) { T::parse(stream, args...); })
|
||||
static ParseResult<ParseUntilAnyOfResult<T>> parse_until_any_of(Stream& stream, Args&... args)
|
||||
requires(requires(Stream& stream, Args... args) { T::parse(stream, args...); })
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
ReconsumableStream new_stream { stream };
|
||||
|
@ -119,7 +119,7 @@ requires(requires(AK::Stream& stream, Args... args) { T::parse(stream, args...);
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ValueType> ValueType::parse(AK::Stream& stream)
|
||||
ParseResult<ValueType> ValueType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ValueType"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -146,7 +146,7 @@ ParseResult<ValueType> ValueType::parse(AK::Stream& stream)
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ResultType> ResultType::parse(AK::Stream& stream)
|
||||
ParseResult<ResultType> ResultType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ResultType"sv);
|
||||
auto types = parse_vector<ValueType>(stream);
|
||||
|
@ -155,7 +155,7 @@ ParseResult<ResultType> ResultType::parse(AK::Stream& stream)
|
|||
return ResultType { types.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<FunctionType> FunctionType::parse(AK::Stream& stream)
|
||||
ParseResult<FunctionType> FunctionType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("FunctionType"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -179,7 +179,7 @@ ParseResult<FunctionType> FunctionType::parse(AK::Stream& stream)
|
|||
return FunctionType { parameters_result.release_value(), results_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Limits> Limits::parse(AK::Stream& stream)
|
||||
ParseResult<Limits> Limits::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Limits"sv);
|
||||
auto flag_or_error = stream.read_value<u8>();
|
||||
|
@ -207,7 +207,7 @@ ParseResult<Limits> Limits::parse(AK::Stream& stream)
|
|||
return Limits { static_cast<u32>(min), move(max) };
|
||||
}
|
||||
|
||||
ParseResult<MemoryType> MemoryType::parse(AK::Stream& stream)
|
||||
ParseResult<MemoryType> MemoryType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("MemoryType"sv);
|
||||
auto limits_result = Limits::parse(stream);
|
||||
|
@ -216,7 +216,7 @@ ParseResult<MemoryType> MemoryType::parse(AK::Stream& stream)
|
|||
return MemoryType { limits_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<TableType> TableType::parse(AK::Stream& stream)
|
||||
ParseResult<TableType> TableType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TableType"sv);
|
||||
auto type_result = ValueType::parse(stream);
|
||||
|
@ -230,7 +230,7 @@ ParseResult<TableType> TableType::parse(AK::Stream& stream)
|
|||
return TableType { type_result.release_value(), limits_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<GlobalType> GlobalType::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalType> GlobalType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("GlobalType"sv);
|
||||
auto type_result = ValueType::parse(stream);
|
||||
|
@ -249,7 +249,7 @@ ParseResult<GlobalType> GlobalType::parse(AK::Stream& stream)
|
|||
return GlobalType { type_result.release_value(), mutable_ == 0x01 };
|
||||
}
|
||||
|
||||
ParseResult<BlockType> BlockType::parse(AK::Stream& stream)
|
||||
ParseResult<BlockType> BlockType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("BlockType"sv);
|
||||
auto kind_or_error = stream.read_value<u8>();
|
||||
|
@ -282,7 +282,7 @@ ParseResult<BlockType> BlockType::parse(AK::Stream& stream)
|
|||
return BlockType { TypeIndex(index_value) };
|
||||
}
|
||||
|
||||
ParseResult<Vector<Instruction>> Instruction::parse(AK::Stream& stream, InstructionPointer& ip)
|
||||
ParseResult<Vector<Instruction>> Instruction::parse(Stream& stream, InstructionPointer& ip)
|
||||
{
|
||||
struct NestedInstructionState {
|
||||
Vector<Instruction> prior_instructions;
|
||||
|
@ -782,7 +782,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(AK::Stream& stream, Instruct
|
|||
return resulting_instructions;
|
||||
}
|
||||
|
||||
ParseResult<CustomSection> CustomSection::parse(AK::Stream& stream)
|
||||
ParseResult<CustomSection> CustomSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("CustomSection"sv);
|
||||
auto name = parse_name(stream);
|
||||
|
@ -808,7 +808,7 @@ ParseResult<CustomSection> CustomSection::parse(AK::Stream& stream)
|
|||
return CustomSection(name.release_value(), move(data_buffer));
|
||||
}
|
||||
|
||||
ParseResult<TypeSection> TypeSection::parse(AK::Stream& stream)
|
||||
ParseResult<TypeSection> TypeSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TypeSection"sv);
|
||||
auto types = parse_vector<FunctionType>(stream);
|
||||
|
@ -817,7 +817,7 @@ ParseResult<TypeSection> TypeSection::parse(AK::Stream& stream)
|
|||
return TypeSection { types.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ImportSection::Import> ImportSection::Import::parse(AK::Stream& stream)
|
||||
ParseResult<ImportSection::Import> ImportSection::Import::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Import"sv);
|
||||
auto module = parse_name(stream);
|
||||
|
@ -850,7 +850,7 @@ ParseResult<ImportSection::Import> ImportSection::Import::parse(AK::Stream& stre
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ImportSection> ImportSection::parse(AK::Stream& stream)
|
||||
ParseResult<ImportSection> ImportSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ImportSection"sv);
|
||||
auto imports = parse_vector<Import>(stream);
|
||||
|
@ -859,7 +859,7 @@ ParseResult<ImportSection> ImportSection::parse(AK::Stream& stream)
|
|||
return ImportSection { imports.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<FunctionSection> FunctionSection::parse(AK::Stream& stream)
|
||||
ParseResult<FunctionSection> FunctionSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("FunctionSection"sv);
|
||||
auto indices = parse_vector<size_t>(stream);
|
||||
|
@ -874,7 +874,7 @@ ParseResult<FunctionSection> FunctionSection::parse(AK::Stream& stream)
|
|||
return FunctionSection { move(typed_indices) };
|
||||
}
|
||||
|
||||
ParseResult<TableSection::Table> TableSection::Table::parse(AK::Stream& stream)
|
||||
ParseResult<TableSection::Table> TableSection::Table::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Table"sv);
|
||||
auto type = TableType::parse(stream);
|
||||
|
@ -883,7 +883,7 @@ ParseResult<TableSection::Table> TableSection::Table::parse(AK::Stream& stream)
|
|||
return Table { type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<TableSection> TableSection::parse(AK::Stream& stream)
|
||||
ParseResult<TableSection> TableSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TableSection"sv);
|
||||
auto tables = parse_vector<Table>(stream);
|
||||
|
@ -892,7 +892,7 @@ ParseResult<TableSection> TableSection::parse(AK::Stream& stream)
|
|||
return TableSection { tables.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<MemorySection::Memory> MemorySection::Memory::parse(AK::Stream& stream)
|
||||
ParseResult<MemorySection::Memory> MemorySection::Memory::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Memory"sv);
|
||||
auto type = MemoryType::parse(stream);
|
||||
|
@ -901,7 +901,7 @@ ParseResult<MemorySection::Memory> MemorySection::Memory::parse(AK::Stream& stre
|
|||
return Memory { type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<MemorySection> MemorySection::parse(AK::Stream& stream)
|
||||
ParseResult<MemorySection> MemorySection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("MemorySection"sv);
|
||||
auto memories = parse_vector<Memory>(stream);
|
||||
|
@ -910,7 +910,7 @@ ParseResult<MemorySection> MemorySection::parse(AK::Stream& stream)
|
|||
return MemorySection { memories.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Expression> Expression::parse(AK::Stream& stream)
|
||||
ParseResult<Expression> Expression::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Expression"sv);
|
||||
InstructionPointer ip { 0 };
|
||||
|
@ -921,7 +921,7 @@ ParseResult<Expression> Expression::parse(AK::Stream& stream)
|
|||
return Expression { move(instructions.value().values) };
|
||||
}
|
||||
|
||||
ParseResult<GlobalSection::Global> GlobalSection::Global::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalSection::Global> GlobalSection::Global::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Global"sv);
|
||||
auto type = GlobalType::parse(stream);
|
||||
|
@ -933,7 +933,7 @@ ParseResult<GlobalSection::Global> GlobalSection::Global::parse(AK::Stream& stre
|
|||
return Global { type.release_value(), exprs.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<GlobalSection> GlobalSection::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalSection> GlobalSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("GlobalSection"sv);
|
||||
auto result = parse_vector<Global>(stream);
|
||||
|
@ -942,7 +942,7 @@ ParseResult<GlobalSection> GlobalSection::parse(AK::Stream& stream)
|
|||
return GlobalSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ExportSection::Export> ExportSection::Export::parse(AK::Stream& stream)
|
||||
ParseResult<ExportSection::Export> ExportSection::Export::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Export"sv);
|
||||
auto name = parse_name(stream);
|
||||
|
@ -973,7 +973,7 @@ ParseResult<ExportSection::Export> ExportSection::Export::parse(AK::Stream& stre
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ExportSection> ExportSection::parse(AK::Stream& stream)
|
||||
ParseResult<ExportSection> ExportSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ExportSection"sv);
|
||||
auto result = parse_vector<Export>(stream);
|
||||
|
@ -982,7 +982,7 @@ ParseResult<ExportSection> ExportSection::parse(AK::Stream& stream)
|
|||
return ExportSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(AK::Stream& stream)
|
||||
ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("StartFunction"sv);
|
||||
auto index = GenericIndexParser<FunctionIndex>::parse(stream);
|
||||
|
@ -991,7 +991,7 @@ ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(AK::
|
|||
return StartFunction { index.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<StartSection> StartSection::parse(AK::Stream& stream)
|
||||
ParseResult<StartSection> StartSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("StartSection"sv);
|
||||
auto result = StartFunction::parse(stream);
|
||||
|
@ -1000,7 +1000,7 @@ ParseResult<StartSection> StartSection::parse(AK::Stream& stream)
|
|||
return StartSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(Stream& stream)
|
||||
{
|
||||
auto expression = Expression::parse(stream);
|
||||
if (expression.is_error())
|
||||
|
@ -1012,7 +1012,7 @@ ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(AK
|
|||
return SegmentType0 { indices.release_value(), Active { 0, expression.release_value() } };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(Stream& stream)
|
||||
{
|
||||
auto kind_or_error = stream.read_value<u8>();
|
||||
if (kind_or_error.is_error())
|
||||
|
@ -1028,49 +1028,49 @@ ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(AK
|
|||
return SegmentType1 { indices.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType2> ElementSection::SegmentType2::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType2> ElementSection::SegmentType2::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 2");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType3> ElementSection::SegmentType3::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType3> ElementSection::SegmentType3::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 3");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 4");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 5");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType6> ElementSection::SegmentType6::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType6> ElementSection::SegmentType6::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 6");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType7> ElementSection::SegmentType7::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType7> ElementSection::SegmentType7::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 7");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::Element> ElementSection::Element::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::Element> ElementSection::Element::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Element"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -1139,7 +1139,7 @@ ParseResult<ElementSection::Element> ElementSection::Element::parse(AK::Stream&
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ElementSection> ElementSection::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection> ElementSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ElementSection"sv);
|
||||
auto result = parse_vector<Element>(stream);
|
||||
|
@ -1148,7 +1148,7 @@ ParseResult<ElementSection> ElementSection::parse(AK::Stream& stream)
|
|||
return ElementSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Locals> Locals::parse(AK::Stream& stream)
|
||||
ParseResult<Locals> Locals::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Locals"sv);
|
||||
auto count_or_error = stream.read_value<LEB128<size_t>>();
|
||||
|
@ -1166,7 +1166,7 @@ ParseResult<Locals> Locals::parse(AK::Stream& stream)
|
|||
return Locals { static_cast<u32>(count), type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection::Func> CodeSection::Func::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection::Func> CodeSection::Func::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Func"sv);
|
||||
auto locals = parse_vector<Locals>(stream);
|
||||
|
@ -1178,7 +1178,7 @@ ParseResult<CodeSection::Func> CodeSection::Func::parse(AK::Stream& stream)
|
|||
return Func { locals.release_value(), body.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection::Code> CodeSection::Code::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection::Code> CodeSection::Code::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Code"sv);
|
||||
auto size_or_error = stream.read_value<LEB128<size_t>>();
|
||||
|
@ -1195,7 +1195,7 @@ ParseResult<CodeSection::Code> CodeSection::Code::parse(AK::Stream& stream)
|
|||
return Code { static_cast<u32>(size), func.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection> CodeSection::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection> CodeSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("CodeSection"sv);
|
||||
auto result = parse_vector<Code>(stream);
|
||||
|
@ -1204,7 +1204,7 @@ ParseResult<CodeSection> CodeSection::parse(AK::Stream& stream)
|
|||
return CodeSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<DataSection::Data> DataSection::Data::parse(AK::Stream& stream)
|
||||
ParseResult<DataSection::Data> DataSection::Data::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Data"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -1246,7 +1246,7 @@ ParseResult<DataSection::Data> DataSection::Data::parse(AK::Stream& stream)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ParseResult<DataSection> DataSection::parse(AK::Stream& stream)
|
||||
ParseResult<DataSection> DataSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("DataSection"sv);
|
||||
auto data = parse_vector<Data>(stream);
|
||||
|
@ -1256,7 +1256,7 @@ ParseResult<DataSection> DataSection::parse(AK::Stream& stream)
|
|||
return DataSection { data.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] AK::Stream& stream)
|
||||
ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("DataCountSection"sv);
|
||||
auto value_or_error = stream.read_value<LEB128<u32>>();
|
||||
|
@ -1272,7 +1272,7 @@ ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] AK::Strea
|
|||
return DataCountSection { value };
|
||||
}
|
||||
|
||||
ParseResult<Module> Module::parse(AK::Stream& stream)
|
||||
ParseResult<Module> Module::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Module"sv);
|
||||
u8 buf[4];
|
||||
|
|
|
@ -17,7 +17,7 @@ DeprecatedString instruction_name(OpCode const& opcode);
|
|||
Optional<OpCode> instruction_from_name(StringView name);
|
||||
|
||||
struct Printer {
|
||||
explicit Printer(AK::Stream& stream, size_t initial_indent = 0)
|
||||
explicit Printer(Stream& stream, size_t initial_indent = 0)
|
||||
: m_stream(stream)
|
||||
, m_indent(initial_indent)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
m_stream.write_entire_buffer(builder.string_view().bytes()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
size_t m_indent { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, LabelIndex);
|
|||
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, DataIndex);
|
||||
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, InstructionPointer, Arithmetic, Comparison, Flags, Increment);
|
||||
|
||||
ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof);
|
||||
ParseError with_eof_check(Stream const& stream, ParseError error_if_not_eof);
|
||||
|
||||
template<typename T>
|
||||
struct GenericIndexParser {
|
||||
static ParseResult<T> parse(AK::Stream& stream)
|
||||
static ParseResult<T> parse(Stream& stream)
|
||||
{
|
||||
auto value_or_error = stream.read_value<LEB128<size_t>>();
|
||||
if (value_or_error.is_error())
|
||||
|
@ -72,9 +72,9 @@ struct GenericIndexParser {
|
|||
}
|
||||
};
|
||||
|
||||
class ReconsumableStream : public AK::Stream {
|
||||
class ReconsumableStream : public Stream {
|
||||
public:
|
||||
explicit ReconsumableStream(AK::Stream& stream)
|
||||
explicit ReconsumableStream(Stream& stream)
|
||||
: m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ private:
|
|||
m_stream.close();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
Vector<u8, 8> m_buffer;
|
||||
};
|
||||
|
||||
class ConstrainedStream : public AK::Stream {
|
||||
class ConstrainedStream : public Stream {
|
||||
public:
|
||||
explicit ConstrainedStream(AK::Stream& stream, size_t size)
|
||||
explicit ConstrainedStream(Stream& stream, size_t size)
|
||||
: m_stream(stream)
|
||||
, m_bytes_left(size)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
m_stream.close();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
size_t m_bytes_left { 0 };
|
||||
};
|
||||
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
auto is_numeric() const { return !is_reference(); }
|
||||
auto kind() const { return m_kind; }
|
||||
|
||||
static ParseResult<ValueType> parse(AK::Stream& stream);
|
||||
static ParseResult<ValueType> parse(Stream& stream);
|
||||
|
||||
static DeprecatedString kind_name(Kind kind)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
|
||||
auto const& types() const { return m_types; }
|
||||
|
||||
static ParseResult<ResultType> parse(AK::Stream& stream);
|
||||
static ParseResult<ResultType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<ValueType> m_types;
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
auto& parameters() const { return m_parameters; }
|
||||
auto& results() const { return m_results; }
|
||||
|
||||
static ParseResult<FunctionType> parse(AK::Stream& stream);
|
||||
static ParseResult<FunctionType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<ValueType> m_parameters;
|
||||
|
@ -286,7 +286,7 @@ public:
|
|||
auto min() const { return m_min; }
|
||||
auto& max() const { return m_max; }
|
||||
|
||||
static ParseResult<Limits> parse(AK::Stream& stream);
|
||||
static ParseResult<Limits> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_min { 0 };
|
||||
|
@ -303,7 +303,7 @@ public:
|
|||
|
||||
auto& limits() const { return m_limits; }
|
||||
|
||||
static ParseResult<MemoryType> parse(AK::Stream& stream);
|
||||
static ParseResult<MemoryType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Limits m_limits;
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
auto& limits() const { return m_limits; }
|
||||
auto& element_type() const { return m_element_type; }
|
||||
|
||||
static ParseResult<TableType> parse(AK::Stream& stream);
|
||||
static ParseResult<TableType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
ValueType m_element_type;
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
auto& type() const { return m_type; }
|
||||
auto is_mutable() const { return m_is_mutable; }
|
||||
|
||||
static ParseResult<GlobalType> parse(AK::Stream& stream);
|
||||
static ParseResult<GlobalType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
ValueType m_type;
|
||||
|
@ -387,7 +387,7 @@ public:
|
|||
return m_type_index;
|
||||
}
|
||||
|
||||
static ParseResult<BlockType> parse(AK::Stream& stream);
|
||||
static ParseResult<BlockType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Kind m_kind { Empty };
|
||||
|
@ -451,7 +451,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
static ParseResult<Vector<Instruction>> parse(AK::Stream& stream, InstructionPointer& ip);
|
||||
static ParseResult<Vector<Instruction>> parse(Stream& stream, InstructionPointer& ip);
|
||||
|
||||
auto& opcode() const { return m_opcode; }
|
||||
auto& arguments() const { return m_arguments; }
|
||||
|
@ -498,7 +498,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& contents() const { return m_contents; }
|
||||
|
||||
static ParseResult<CustomSection> parse(AK::Stream& stream);
|
||||
static ParseResult<CustomSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
|
@ -516,7 +516,7 @@ public:
|
|||
|
||||
auto& types() const { return m_types; }
|
||||
|
||||
static ParseResult<TypeSection> parse(AK::Stream& stream);
|
||||
static ParseResult<TypeSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<FunctionType> m_types;
|
||||
|
@ -538,7 +538,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& description() const { return m_description; }
|
||||
|
||||
static ParseResult<Import> parse(AK::Stream& stream);
|
||||
static ParseResult<Import> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
|
@ -565,7 +565,7 @@ public:
|
|||
|
||||
auto& imports() const { return m_imports; }
|
||||
|
||||
static ParseResult<ImportSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ImportSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Import> m_imports;
|
||||
|
@ -582,7 +582,7 @@ public:
|
|||
|
||||
auto& types() const { return m_types; }
|
||||
|
||||
static ParseResult<FunctionSection> parse(AK::Stream& stream);
|
||||
static ParseResult<FunctionSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<TypeIndex> m_types;
|
||||
|
@ -599,7 +599,7 @@ public:
|
|||
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Table> parse(AK::Stream& stream);
|
||||
static ParseResult<Table> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
TableType m_type;
|
||||
|
@ -615,7 +615,7 @@ public:
|
|||
|
||||
auto& tables() const { return m_tables; };
|
||||
|
||||
static ParseResult<TableSection> parse(AK::Stream& stream);
|
||||
static ParseResult<TableSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Table> m_tables;
|
||||
|
@ -632,7 +632,7 @@ public:
|
|||
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Memory> parse(AK::Stream& stream);
|
||||
static ParseResult<Memory> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
MemoryType m_type;
|
||||
|
@ -648,7 +648,7 @@ public:
|
|||
|
||||
auto& memories() const { return m_memories; }
|
||||
|
||||
static ParseResult<MemorySection> parse(AK::Stream& stream);
|
||||
static ParseResult<MemorySection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Memory> m_memories;
|
||||
|
@ -663,7 +663,7 @@ public:
|
|||
|
||||
auto& instructions() const { return m_instructions; }
|
||||
|
||||
static ParseResult<Expression> parse(AK::Stream& stream);
|
||||
static ParseResult<Expression> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Instruction> m_instructions;
|
||||
|
@ -682,7 +682,7 @@ public:
|
|||
auto& type() const { return m_type; }
|
||||
auto& expression() const { return m_expression; }
|
||||
|
||||
static ParseResult<Global> parse(AK::Stream& stream);
|
||||
static ParseResult<Global> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
GlobalType m_type;
|
||||
|
@ -699,7 +699,7 @@ public:
|
|||
|
||||
auto& entries() const { return m_entries; }
|
||||
|
||||
static ParseResult<GlobalSection> parse(AK::Stream& stream);
|
||||
static ParseResult<GlobalSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Global> m_entries;
|
||||
|
@ -721,7 +721,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& description() const { return m_description; }
|
||||
|
||||
static ParseResult<Export> parse(AK::Stream& stream);
|
||||
static ParseResult<Export> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
|
@ -737,7 +737,7 @@ public:
|
|||
|
||||
auto& entries() const { return m_entries; }
|
||||
|
||||
static ParseResult<ExportSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ExportSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Export> m_entries;
|
||||
|
@ -754,7 +754,7 @@ public:
|
|||
|
||||
auto& index() const { return m_index; }
|
||||
|
||||
static ParseResult<StartFunction> parse(AK::Stream& stream);
|
||||
static ParseResult<StartFunction> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
FunctionIndex m_index;
|
||||
|
@ -769,7 +769,7 @@ public:
|
|||
|
||||
auto& function() const { return m_function; }
|
||||
|
||||
static ParseResult<StartSection> parse(AK::Stream& stream);
|
||||
static ParseResult<StartSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
StartFunction m_function;
|
||||
|
@ -788,43 +788,43 @@ public:
|
|||
|
||||
struct SegmentType0 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType0> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType0> parse(Stream& stream);
|
||||
|
||||
Vector<FunctionIndex> function_indices;
|
||||
Active mode;
|
||||
};
|
||||
struct SegmentType1 {
|
||||
static ParseResult<SegmentType1> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType1> parse(Stream& stream);
|
||||
|
||||
Vector<FunctionIndex> function_indices;
|
||||
};
|
||||
struct SegmentType2 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType2> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType2> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType3 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType3> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType3> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType4 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType4> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType4> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType5 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType5> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType5> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType6 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType6> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType6> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType7 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType7> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType7> parse(Stream& stream);
|
||||
};
|
||||
|
||||
struct Element {
|
||||
static ParseResult<Element> parse(AK::Stream&);
|
||||
static ParseResult<Element> parse(Stream&);
|
||||
|
||||
ValueType type;
|
||||
Vector<Expression> init;
|
||||
|
@ -840,7 +840,7 @@ public:
|
|||
|
||||
auto& segments() const { return m_segments; }
|
||||
|
||||
static ParseResult<ElementSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ElementSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Element> m_segments;
|
||||
|
@ -858,7 +858,7 @@ public:
|
|||
auto n() const { return m_n; }
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Locals> parse(AK::Stream& stream);
|
||||
static ParseResult<Locals> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_n { 0 };
|
||||
|
@ -879,7 +879,7 @@ public:
|
|||
auto& locals() const { return m_locals; }
|
||||
auto& body() const { return m_body; }
|
||||
|
||||
static ParseResult<Func> parse(AK::Stream& stream);
|
||||
static ParseResult<Func> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Locals> m_locals;
|
||||
|
@ -896,7 +896,7 @@ public:
|
|||
auto size() const { return m_size; }
|
||||
auto& func() const { return m_func; }
|
||||
|
||||
static ParseResult<Code> parse(AK::Stream& stream);
|
||||
static ParseResult<Code> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_size { 0 };
|
||||
|
@ -912,7 +912,7 @@ public:
|
|||
|
||||
auto& functions() const { return m_functions; }
|
||||
|
||||
static ParseResult<CodeSection> parse(AK::Stream& stream);
|
||||
static ParseResult<CodeSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Code> m_functions;
|
||||
|
@ -939,7 +939,7 @@ public:
|
|||
|
||||
auto& value() const { return m_value; }
|
||||
|
||||
static ParseResult<Data> parse(AK::Stream& stream);
|
||||
static ParseResult<Data> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Value m_value;
|
||||
|
@ -954,7 +954,7 @@ public:
|
|||
|
||||
auto& data() const { return m_data; }
|
||||
|
||||
static ParseResult<DataSection> parse(AK::Stream& stream);
|
||||
static ParseResult<DataSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Data> m_data;
|
||||
|
@ -971,7 +971,7 @@ public:
|
|||
|
||||
auto& count() const { return m_count; }
|
||||
|
||||
static ParseResult<DataCountSection> parse(AK::Stream& stream);
|
||||
static ParseResult<DataCountSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Optional<u32> m_count;
|
||||
|
@ -1066,7 +1066,7 @@ public:
|
|||
StringView validation_error() const { return *m_validation_error; }
|
||||
void set_validation_error(DeprecatedString error) { m_validation_error = move(error); }
|
||||
|
||||
static ParseResult<Module> parse(AK::Stream& stream);
|
||||
static ParseResult<Module> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
bool populate_sections();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue