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

Function WasmEdge_FunctionTypeCreate

lib/api/wasmedge.cpp:1400–1422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1398// >>>>>>>> WasmEdge function type functions >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1399
1400WASMEDGE_CAPI_EXPORT WasmEdge_FunctionTypeContext *WasmEdge_FunctionTypeCreate(
1401 const WasmEdge_ValType *ParamList, const uint32_t ParamLen,
1402 const WasmEdge_ValType *ReturnList, const uint32_t ReturnLen) noexcept {
1403 try {
1404 auto *Cxt = new WasmEdge::AST::FunctionType;
1405 if (ParamLen > 0) {
1406 Cxt->getParamTypes().resize(ParamLen);
1407 }
1408 for (uint32_t I = 0; I < ParamLen; I++) {
1409 Cxt->getParamTypes()[I] = genValType(ParamList[I]);
1410 }
1411 if (ReturnLen > 0) {
1412 Cxt->getReturnTypes().resize(ReturnLen);
1413 }
1414 for (uint32_t I = 0; I < ReturnLen; I++) {
1415 Cxt->getReturnTypes()[I] = genValType(ReturnList[I]);
1416 }
1417 return toFuncTypeCxt(Cxt);
1418 } catch (...) {
1419 handleCAPIError();
1420 return nullptr;
1421 }
1422}
1423
1424WASMEDGE_CAPI_EXPORT uint32_t WasmEdge_FunctionTypeGetParametersLength(
1425 const WasmEdge_FunctionTypeContext *Cxt) noexcept {

Callers 6

createExternModuleFunction · 0.85
createSpecTestModuleFunction · 0.85
TESTFunction · 0.85
CreateTestModuleFunction · 0.85
mainFunction · 0.85

Calls 4

handleCAPIErrorFunction · 0.85
resizeMethod · 0.80
getParamTypesMethod · 0.80
genValTypeFunction · 0.70

Tested by 4

createExternModuleFunction · 0.68
TESTFunction · 0.68
CreateTestModuleFunction · 0.68