/src/WasmEdge/lib/loader/ast/component/component_start.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: 2019-2024 Second State INC |
3 | | |
4 | | #include "loader/loader.h" |
5 | | |
6 | | namespace WasmEdge { |
7 | | namespace Loader { |
8 | | |
9 | 0 | Expect<void> Loader::loadStart(AST::Component::Start &S) { |
10 | 0 | auto ReportError = [this](auto E) { |
11 | 0 | return logLoadError(E, FMgr.getLastOffset(), ASTNodeAttr::Comp_Start); |
12 | 0 | }; |
13 | | // start ::= f:<funcidx> arg*:vec(<valueidx>) r:<u32> |
14 | | // => (start f (value arg)* (result (value))Ęł) |
15 | |
|
16 | 0 | EXPECTED_TRY(S.getFunctionIndex(), FMgr.readU32().map_error(ReportError)); |
17 | 0 | auto F = [this, ReportError](uint32_t &V) -> Expect<void> { |
18 | 0 | EXPECTED_TRY(V, FMgr.readU32().map_error(ReportError)); |
19 | 0 | return {}; |
20 | 0 | }; |
21 | 0 | EXPECTED_TRY(loadVec<AST::Component::Start>(S.getArguments(), F)); |
22 | 0 | EXPECTED_TRY(S.getResult(), FMgr.readU32().map_error(ReportError)); |
23 | 0 | return {}; |
24 | 0 | } |
25 | | |
26 | | } // namespace Loader |
27 | | } // namespace WasmEdge |