MCPcopy Create free account
hub / github.com/WebAssembly/wabt / ResolveTargetRefType

Method ResolveTargetRefType

src/wast-parser.cc:1403–1426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1401}
1402
1403Result WastParser::ResolveTargetRefType(const Module& module,
1404 Type* type,
1405 const Var& var,
1406 Errors* errors) {
1407 assert(type->IsReferenceWithIndex() && !var.is_index());
1408
1409 if (type->GetReferenceIndex() != kInvalidIndex) {
1410 // Type has either a name or an absolute index. The former might
1411 // be resolved earlier, and the latter does not need any resolving.
1412 return Result::Ok;
1413 }
1414
1415 Index type_index = module.type_bindings.FindIndex(var.name());
1416
1417 if (type_index != kInvalidIndex) {
1418 *type = Type(static_cast<Type::Enum>(*type), type_index);
1419 return Result::Ok;
1420 }
1421
1422 errors->emplace_back(
1423 ErrorLevel::Error, var.loc, module.filename,
1424 StringPrintf("undefined reference type name %s", var.name().c_str()));
1425 return Result::Ok;
1426}
1427
1428Result WastParser::ResolveTargetTypeVector(const Module& module,
1429 TypeVector* types,

Callers

nothing calls this directly

Calls 8

StringPrintfFunction · 0.85
IsReferenceWithIndexMethod · 0.80
is_indexMethod · 0.80
GetReferenceIndexMethod · 0.80
emplace_backMethod · 0.80
TypeClass · 0.50
FindIndexMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected