MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / loadCoreSort

Method loadCoreSort

lib/loader/ast/component/component_sort.cpp:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52Expect<void> Loader::loadCoreSort(AST::Component::Sort &Sort) {
53 // core:sort ::= 0x00 => func
54 // | 0x01 => table
55 // | 0x02 => memory
56 // | 0x03 => global
57 // | 0x04 => tag
58 // | 0x10 => type
59 // | 0x11 => module
60 // | 0x12 => instance
61 EXPECTED_TRY(auto Flag, FMgr.readByte().map_error([this](auto E) {
62 return logLoadError(E, FMgr.getLastOffset(), ASTNodeAttr::Comp_Sort);
63 }));
64 switch (Flag) {
65 case 0x00:
66 case 0x01:
67 case 0x02:
68 case 0x03:
69 case 0x04:
70 case 0x10:
71 case 0x11:
72 case 0x12:
73 Sort.setIsCore(true);
74 Sort.setCoreSortType(static_cast<AST::Component::Sort::CoreSortType>(Flag));
75 return {};
76 default:
77 return logLoadError(ErrCode::Value::MalformedSort, FMgr.getLastOffset(),
78 ASTNodeAttr::Comp_Sort);
79 }
80}
81
82} // namespace Loader
83} // namespace WasmEdge

Callers

nothing calls this directly

Calls 3

setIsCoreMethod · 0.80
setCoreSortTypeMethod · 0.80
getLastOffsetMethod · 0.80

Tested by

no test coverage detected