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

Method loadDecl

lib/loader/ast/component/component_declarator.cpp:9–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace Loader {
8
9Expect<void> Loader::loadDecl(AST::Component::CoreImportDecl &Decl) {
10 // core:importdecl ::= m:<core:name> n:<core:name> d:<core:importdesc>
11 // => (import m n d)
12
13 EXPECTED_TRY(Decl.getModuleName(), FMgr.readName().map_error([this](auto E) {
14 return logLoadError(E, FMgr.getLastOffset(),
15 ASTNodeAttr::Comp_Decl_CoreImport);
16 }));
17 EXPECTED_TRY(Decl.getName(), FMgr.readName().map_error([this](auto E) {
18 return logLoadError(E, FMgr.getLastOffset(),
19 ASTNodeAttr::Comp_Decl_CoreImport);
20 }));
21 return loadDesc(Decl.getImportDesc()).map_error([](auto E) {
22 spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Comp_Decl_CoreImport));
23 return E;
24 });
25}
26
27Expect<void> Loader::loadDecl(AST::Component::CoreExportDecl &Decl) {
28 // core:exportdecl ::= n:<core:name> d:<core:importdesc> => (export n d)

Callers

nothing calls this directly

Calls 15

InfoASTClass · 0.85
readNameMethod · 0.80
getLastOffsetMethod · 0.80
setCoreTypeMethod · 0.80
readByteMethod · 0.80
setInstanceMethod · 0.80
EXPECTED_TRYFunction · 0.70
errorFunction · 0.50
getModuleNameMethod · 0.45
getNameMethod · 0.45
getImportDescMethod · 0.45
setImportMethod · 0.45

Tested by

no test coverage detected