void PrintVisitor::visit(const CellCallExp &e) { if (displayOriginal) { e.getName().getOriginal()->accept(*this); } else { e.getName().accept(*this); } *ostr << SCI_OPEN_CELL; exps_t args = e.getArgs(); for (exps_t::const_iterator it = args.begin(), itEnd = args.end(); it != itEnd; /**/) { if (displayOriginal) { (*it)->getOriginal()->accept(*this); } else { (*it)->accept(*this); } if (++it != itEnd) { *ostr << SCI_COMMA << " "; } } *ostr << SCI_CLOSE_CELL; }
void MuteVisitor::visit(const CellCallExp &e) { exps_t args = e.getArgs(); for (auto arg : args) { arg->mute(); arg->accept(*this); } }
void RunVisitorT<T>::visitprivate(const CellCallExp &e) { CoverageInstance::invokeAndStartChrono((void*)&e); //get head T execMeCell; try { e.getName().accept(execMeCell); } catch (ScilabException &) { CoverageInstance::stopChrono((void*)&e); throw; } if (execMeCell.getResult() != NULL) { //a{xxx} with a variable, extraction types::InternalType *pIT = NULL; pIT = execMeCell.getResult(); if (pIT) { if (pIT->isCell() == false) { CoverageInstance::stopChrono((void*)&e); throw ast::InternalError(_W("[error] Cell contents reference from a non-cell array object.\n"), 999, e.getFirstLocation()); } //Create list of indexes ast::exps_t exps = e.getArgs(); types::typed_list *pArgs = GetArgumentList(exps); if (pArgs->size() == 0) { // Case a{} delete pArgs; std::wostringstream os; os << _W("Cell : Cannot extract without arguments.\n"); CoverageInstance::stopChrono((void*)&e); throw ast::InternalError(os.str(), 999, e.getFirstLocation()); } types::List* pList = pIT->getAs<types::Cell>()->extractCell(pArgs); if (pList == NULL) { delete pArgs; std::wostringstream os; os << _W("inconsistent row/column dimensions\n"); //os << ((*e.args_get().begin())->getLocation()).getLocationString() << std::endl; CoverageInstance::stopChrono((void*)&e); throw ast::InternalError(os.str(), 999, e.getFirstLocation()); } if (pList->getSize() == 1) { types::InternalType* ret = pList->get(0); setResult(ret); ret->IncreaseRef(); pList->killMe(); ret->DecreaseRef(); } else { setResult(pList); } //clean pArgs return by GetArgumentList for (int iArg = 0; iArg < (int)pArgs->size(); iArg++) { (*pArgs)[iArg]->killMe(); } delete pArgs; } } else { //result == NULL ,variable doesn't exist :( // Should never be in this case // In worst case variable pointing to function does not exists // visitprivate(SimpleVar) will throw the right exception. } CoverageInstance::stopChrono((void*)&e); }