Coverage Report

Created: 2025-07-01 06:18

/src/WasmEdge/include/ast/component/export.h
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
//===-- wasmedge/ast/component/export.h - Export class definition ---------===//
5
//
6
// Part of the WasmEdge Project.
7
//
8
//===----------------------------------------------------------------------===//
9
///
10
/// \file
11
/// This file contains the declaration of the Export node class.
12
///
13
//===----------------------------------------------------------------------===//
14
#pragma once
15
16
#include "ast/component/sort.h"
17
#include "ast/component/type.h"
18
19
#include <optional>
20
#include <string>
21
22
namespace WasmEdge {
23
namespace AST {
24
namespace Component {
25
26
// export      ::= en:<exportname'> si:<sortidx> ed?:<externdesc>?
27
//               => (export en si ed?)
28
// exportname' ::= 0x00 len:<u32> en:<exportname>
29
//               => en  (if len = |en|)
30
31
/// AST Component::Export node.
32
class Export {
33
public:
34
0
  std::string &getName() noexcept { return Name; }
35
0
  std::string_view getName() const noexcept { return Name; }
36
0
  SortIndex<Sort> &getSortIndex() noexcept { return Idx; }
37
0
  const SortIndex<Sort> &getSortIndex() const noexcept { return Idx; }
38
0
  std::optional<ExternDesc> &getDesc() noexcept { return Desc; }
39
0
  const std::optional<ExternDesc> getDesc() const noexcept { return Desc; }
40
41
private:
42
  std::string Name;
43
  SortIndex<Sort> Idx;
44
  std::optional<ExternDesc> Desc;
45
};
46
47
} // namespace Component
48
} // namespace AST
49
} // namespace WasmEdge