| 460 | } |
| 461 | |
| 462 | Result 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 | |
| 501 | Index SharedValidator::GetFunctionTypeIndex(Index func_index) const { |
| 502 | assert(func_index < funcs_.size()); |
nothing calls this directly
no test coverage detected