| 797 | } |
| 798 | |
| 799 | expr *CompileHelper::reduceExpr(any *result, bool &invalidValue, |
| 800 | DesignComponent *component, |
| 801 | CompileDesign *compileDesign, |
| 802 | ValuedComponentI *instance, PathId fileId, |
| 803 | uint32_t lineNumber, any *pexpr, |
| 804 | bool muteErrors) { |
| 805 | UHDM::GetObjectFunctor getObjectFunctor = |
| 806 | [&](std::string_view name, const any *inst, |
| 807 | const any *pexpr) -> UHDM::any * { |
| 808 | return getObject(name, component, compileDesign, instance, pexpr); |
| 809 | }; |
| 810 | UHDM::GetObjectFunctor getValueFunctor = |
| 811 | [&](std::string_view name, const any *inst, |
| 812 | const any *pexpr) -> UHDM::any * { |
| 813 | return (expr *)getValue(name, component, compileDesign, Reduce::Yes, |
| 814 | instance, fileId, lineNumber, (any *)pexpr, |
| 815 | muteErrors); |
| 816 | }; |
| 817 | UHDM::GetTaskFuncFunctor getTaskFuncFunctor = |
| 818 | [&](std::string_view name, const any *inst) -> UHDM::task_func * { |
| 819 | auto ret = getTaskFunc(name, component, compileDesign, instance, pexpr); |
| 820 | return ret.first; |
| 821 | }; |
| 822 | UHDM::ExprEval eval(muteErrors); |
| 823 | eval.setGetObjectFunctor(getObjectFunctor); |
| 824 | eval.setGetValueFunctor(getValueFunctor); |
| 825 | eval.setGetTaskFuncFunctor(getTaskFuncFunctor); |
| 826 | if (m_exprEvalPlaceHolder == nullptr) { |
| 827 | m_exprEvalPlaceHolder = compileDesign->getSerializer().MakeModule_inst(); |
| 828 | m_exprEvalPlaceHolder->Param_assigns( |
| 829 | compileDesign->getSerializer().MakeParam_assignVec()); |
| 830 | } else { |
| 831 | m_exprEvalPlaceHolder->Param_assigns()->erase( |
| 832 | m_exprEvalPlaceHolder->Param_assigns()->begin(), |
| 833 | m_exprEvalPlaceHolder->Param_assigns()->end()); |
| 834 | } |
| 835 | expr *res = eval.reduceExpr(result, invalidValue, m_exprEvalPlaceHolder, |
| 836 | pexpr, muteErrors); |
| 837 | // If loop was detected, drop the partially constructed new value! |
| 838 | return m_unwind ? nullptr : res; |
| 839 | } |
| 840 | |
| 841 | any *CompileHelper::getValue(std::string_view name, DesignComponent *component, |
| 842 | CompileDesign *compileDesign, Reduce reduce, |
no outgoing calls
no test coverage detected