| 255 | } |
| 256 | |
| 257 | void PropertyExpressionEngine::hasSetValue() |
| 258 | { |
| 259 | auto* owner = freecad_cast<App::DocumentObject*>(getContainer()); |
| 260 | if (!owner || !owner->isAttachedToDocument() || owner->isRestoring() |
| 261 | || testFlag(LinkDetached)) { |
| 262 | PropertyExpressionContainer::hasSetValue(); |
| 263 | return; |
| 264 | } |
| 265 | |
| 266 | std::map<App::DocumentObject*, bool> deps; |
| 267 | std::map<std::pair<std::string, App::DocumentObject*>, bool> propDeps; |
| 268 | std::vector<std::string> labels; |
| 269 | unregisterElementReference(); |
| 270 | UpdateElementReferenceExpressionVisitor<PropertyExpressionEngine> v(*this); |
| 271 | for (auto& e : expressions) { |
| 272 | auto expr = e.second.expression; |
| 273 | if (expr) { |
| 274 | expr->getDepObjects(deps, &labels, &propDeps); |
| 275 | if (!restoring) { |
| 276 | expr->visit(v); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | registerLabelReferences(std::move(labels)); |
| 281 | |
| 282 | updateDeps(std::move(deps), &propDeps); |
| 283 | |
| 284 | if (pimpl) { |
| 285 | pimpl->conns.clear(); |
| 286 | pimpl->propMap.clear(); |
| 287 | } |
| 288 | // check if there is any hidden references |
| 289 | bool hasHidden = false; |
| 290 | for (auto& v : _Deps) { |
| 291 | if (v.second) { |
| 292 | hasHidden = true; |
| 293 | break; |
| 294 | } |
| 295 | } |
| 296 | if (hasHidden) { |
| 297 | if (!pimpl) { |
| 298 | pimpl = std::make_unique<Private>(); |
| 299 | } |
| 300 | for (auto& e : expressions) { |
| 301 | auto expr = e.second.expression; |
| 302 | if (!expr) { |
| 303 | continue; |
| 304 | } |
| 305 | for (auto& dep : expr->getIdentifiers()) { |
| 306 | if (!dep.second) { |
| 307 | continue; |
| 308 | } |
| 309 | const ObjectIdentifier& var = dep.first; |
| 310 | for (auto& vdep : var.getDep(true)) { |
| 311 | auto obj = vdep.first; |
| 312 | auto objName = obj->getFullName() + "."; |
| 313 | for (auto& propName : vdep.second) { |
| 314 | std::string key = objName + propName; |
nothing calls this directly
no test coverage detected