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

Method CheckBlockSignature

src/shared-validator.cc:462–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462Result SharedValidator::CheckBlockSignature(const Location& loc,
463 Opcode opcode,
464 Type sig_type,
465 TypeVector* out_param_types,
466 TypeVector* out_result_types) {
467 Result result = Result::Ok;
468
469 if (sig_type.IsIndex()) {
470 Index sig_index = sig_type.GetIndex();
471 FuncType func_type;
472 result |= CheckFuncTypeIndex(Var(sig_index, loc), &func_type);
473
474 if (!func_type.params.empty() && !options_.features.multi_value_enabled()) {
475 result |= PrintError(loc, "%s params not currently supported.",
476 opcode.GetName());
477 }
478 // Multiple results without --enable-multi-value is checked above in
479 // OnType.
480
481 *out_param_types = func_type.params;
482 *out_result_types = func_type.results;
483 } else {
484 if (sig_type.IsReferenceWithIndex()) {
485 Index index = sig_type.GetReferenceIndex();
486 auto iter = func_types_.find(index);
487
488 if (iter == func_types_.end()) {
489 result |=
490 PrintError(loc, "reference %" PRIindex " is out of range", index);
491 }
492 }
493
494 out_param_types->clear();
495 *out_result_types = sig_type.GetInlineVector();
496 }
497
498 return result;
499}
500
501Index SharedValidator::GetFunctionTypeIndex(Index func_index) const {
502 assert(func_index < funcs_.size());

Callers

nothing calls this directly

Calls 11

IsIndexMethod · 0.80
GetIndexMethod · 0.80
IsReferenceWithIndexMethod · 0.80
GetReferenceIndexMethod · 0.80
findMethod · 0.80
GetInlineVectorMethod · 0.80
VarClass · 0.50
emptyMethod · 0.45
GetNameMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected