| 4314 | } |
| 4315 | |
| 4316 | VectorOfany* CompileHelper::compileTfCallArguments( |
| 4317 | DesignComponent* component, const FileContent* fC, NodeId Arg_list_node, |
| 4318 | CompileDesign* compileDesign, Reduce reduce, UHDM::any* call, |
| 4319 | ValuedComponentI* instance, bool muteErrors) { |
| 4320 | FileSystem* const fileSystem = FileSystem::getInstance(); |
| 4321 | UHDM::Serializer& s = compileDesign->getSerializer(); |
| 4322 | if (fC->Type(Arg_list_node) == VObjectType::paSelect) { |
| 4323 | // Task or func call with no argument, not even () |
| 4324 | return nullptr; |
| 4325 | } |
| 4326 | NodeId argumentNode = fC->Child(Arg_list_node); |
| 4327 | if (!argumentNode) return nullptr; |
| 4328 | VectorOfio_decl* io_decls = nullptr; |
| 4329 | if (const func_call* tf = any_cast<func_call*>(call)) { |
| 4330 | const function* func = tf->Function(); |
| 4331 | if (func) io_decls = func->Io_decls(); |
| 4332 | } else if (const task_call* tf = any_cast<task_call*>(call)) { |
| 4333 | const task* task = tf->Task(); |
| 4334 | if (task) io_decls = task->Io_decls(); |
| 4335 | } |
| 4336 | VectorOfany* arguments = s.MakeAnyVec(); |
| 4337 | std::map<std::string, any*, std::less<>> args; |
| 4338 | std::vector<any*> argOrder; |
| 4339 | while (argumentNode) { |
| 4340 | NodeId argument = argumentNode; |
| 4341 | if (fC->Type(argument) == VObjectType::paArgument) { |
| 4342 | argument = fC->Child(argument); |
| 4343 | } |
| 4344 | NodeId sibling = fC->Sibling(argument); |
| 4345 | NodeId Expression; |
| 4346 | if ((fC->Type(argument) == VObjectType::slStringConst) && |
| 4347 | (fC->Type(sibling) == VObjectType::paExpression)) { |
| 4348 | // arg by name |
| 4349 | Expression = sibling; |
| 4350 | UHDM::any* exp = |
| 4351 | compileExpression(component, fC, Expression, compileDesign, reduce, |
| 4352 | call, instance, muteErrors); |
| 4353 | if (exp) { |
| 4354 | if (exp->VpiParent() == nullptr) exp->VpiParent(call); |
| 4355 | args.emplace(fC->SymName(argument), exp); |
| 4356 | argOrder.push_back(exp); |
| 4357 | } |
| 4358 | argumentNode = fC->Sibling(argumentNode); |
| 4359 | } else if (((fC->Type(argument) == VObjectType::paUnary_Tilda) || |
| 4360 | (fC->Type(argument) == VObjectType::paUnary_Not)) && |
| 4361 | (fC->Type(sibling) == VObjectType::paExpression)) { |
| 4362 | // arg by position |
| 4363 | Expression = argument; |
| 4364 | UHDM::any* exp = |
| 4365 | compileExpression(component, fC, Expression, compileDesign, reduce, |
| 4366 | call, instance, muteErrors); |
| 4367 | if (exp) { |
| 4368 | if (exp->VpiParent() == nullptr) exp->VpiParent(call); |
| 4369 | arguments->push_back(exp); |
| 4370 | } |
| 4371 | argumentNode = fC->Sibling(argumentNode); |
| 4372 | } else { |
| 4373 | // arg by position |