| 306 | } |
| 307 | |
| 308 | ReferenceInfo ReferenceInfoBuilder::build() const { |
| 309 | ComponentsVector components; |
| 310 | NamesVector names; |
| 311 | |
| 312 | const auto* current = this; |
| 313 | bool shouldContinue = true; |
| 314 | |
| 315 | while (current != nullptr && shouldContinue) { |
| 316 | switch (current->_type) { |
| 317 | case Type::Root: |
| 318 | if (current->_referenceInfo != nullptr) { |
| 319 | assignReferenceInfo(components, names, *current->_referenceInfo, current->_isFunction); |
| 320 | } |
| 321 | break; |
| 322 | case Type::Object: |
| 323 | shouldContinue = assignComponent(components, |
| 324 | names, |
| 325 | ReferenceInfo::Component::Type::Property, |
| 326 | current->_index, |
| 327 | current->_name, |
| 328 | current->_isFunction); |
| 329 | break; |
| 330 | case Type::Property: |
| 331 | shouldContinue = assignComponent(components, |
| 332 | names, |
| 333 | ReferenceInfo::Component::Type::Property, |
| 334 | current->_index, |
| 335 | current->_name, |
| 336 | current->_isFunction); |
| 337 | break; |
| 338 | case Type::ReturnValue: |
| 339 | shouldContinue = assignComponent(components, |
| 340 | names, |
| 341 | ReferenceInfo::Component::Type::ReturnValue, |
| 342 | current->_index, |
| 343 | current->_name, |
| 344 | current->_isFunction); |
| 345 | break; |
| 346 | case Type::ParameterValue: |
| 347 | shouldContinue = assignComponent(components, |
| 348 | names, |
| 349 | ReferenceInfo::Component::Type::ParameterValue, |
| 350 | current->_index, |
| 351 | current->_name, |
| 352 | current->_isFunction); |
| 353 | break; |
| 354 | case Type::ArrayItem: |
| 355 | shouldContinue = assignComponent(components, |
| 356 | names, |
| 357 | ReferenceInfo::Component::Type::ArrayItem, |
| 358 | current->_index, |
| 359 | current->_name, |
| 360 | current->_isFunction); |
| 361 | break; |
| 362 | } |
| 363 | |
| 364 | current = current->_parent; |
| 365 | } |
no test coverage detected