| 650 | } |
| 651 | |
| 652 | const UHDM::typespec* bindTypespec(std::string_view name, |
| 653 | SURELOG::ValuedComponentI* instance, |
| 654 | Serializer& s) { |
| 655 | const typespec* result = nullptr; |
| 656 | ModuleInstance* modInst = valuedcomponenti_cast<ModuleInstance*>(instance); |
| 657 | while (modInst) { |
| 658 | for (Parameter* param : modInst->getTypeParams()) { |
| 659 | const std::string_view pname = param->getName(); |
| 660 | if (pname == name) { |
| 661 | if (any* uparam = param->getUhdmParam()) { |
| 662 | if (type_parameter* tparam = any_cast<type_parameter*>(uparam)) { |
| 663 | if (const ref_typespec* rt = tparam->Typespec()) { |
| 664 | result = rt->Actual_typespec(); |
| 665 | } |
| 666 | ElaboratorContext elaboratorContext(&s, false, true); |
| 667 | result = any_cast<typespec*>( |
| 668 | UHDM::clone_tree((any*)result, &elaboratorContext)); |
| 669 | } |
| 670 | } |
| 671 | break; |
| 672 | } |
| 673 | } |
| 674 | if (result == nullptr) { |
| 675 | if (ModuleDefinition* mod = (ModuleDefinition*)modInst->getDefinition()) { |
| 676 | if (Parameter* param = mod->getParameter(name)) { |
| 677 | if (any* uparam = param->getUhdmParam()) { |
| 678 | if (type_parameter* tparam = any_cast<type_parameter*>(uparam)) { |
| 679 | if (const ref_typespec* rt = tparam->Typespec()) { |
| 680 | result = rt->Actual_typespec(); |
| 681 | } |
| 682 | ElaboratorContext elaboratorContext(&s, false, true); |
| 683 | result = any_cast<typespec*>( |
| 684 | UHDM::clone_tree((any*)result, &elaboratorContext)); |
| 685 | } |
| 686 | } |
| 687 | } |
| 688 | if (const DataType* dt = mod->getDataType(name)) { |
| 689 | dt = dt->getActual(); |
| 690 | result = dt->getTypespec(); |
| 691 | ElaboratorContext elaboratorContext(&s, false, true); |
| 692 | result = any_cast<typespec*>( |
| 693 | UHDM::clone_tree((any*)result, &elaboratorContext)); |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | modInst = modInst->getParent(); |
| 698 | } |
| 699 | return result; |
| 700 | } |
| 701 | |
| 702 | typespec* CompileHelper::compileDatastructureTypespec( |
| 703 | DesignComponent* component, const FileContent* fC, NodeId type, |
no test coverage detected