| 376 | } |
| 377 | |
| 378 | void DUChainUtils::collectItems( DUContext* context, DUChainItemFilter& filter ) { |
| 379 | |
| 380 | QVector<DUContext*> children = context->childContexts(); |
| 381 | QVector<Declaration*> localDeclarations = context->localDeclarations(); |
| 382 | |
| 383 | QVector<DUContext*>::const_iterator childIt = children.constBegin(); |
| 384 | QVector<Declaration*>::const_iterator declIt = localDeclarations.constBegin(); |
| 385 | |
| 386 | while(childIt != children.constEnd() || declIt != localDeclarations.constEnd()) { |
| 387 | |
| 388 | DUContext* child = nullptr; |
| 389 | if(childIt != children.constEnd()) |
| 390 | child = *childIt; |
| 391 | |
| 392 | Declaration* decl = nullptr; |
| 393 | if(declIt != localDeclarations.constEnd()) |
| 394 | decl = *declIt; |
| 395 | |
| 396 | if(decl) { |
| 397 | if(child && child->range().start.line >= decl->range().start.line) |
| 398 | child = nullptr; |
| 399 | } |
| 400 | |
| 401 | if(child) { |
| 402 | if(decl && decl->range().start >= child->range().start) |
| 403 | decl = nullptr; |
| 404 | } |
| 405 | |
| 406 | if(decl) { |
| 407 | if( filter.accept(decl) ) { |
| 408 | //Action is done in the filter |
| 409 | } |
| 410 | |
| 411 | ++declIt; |
| 412 | continue; |
| 413 | } |
| 414 | |
| 415 | if(child) { |
| 416 | if( filter.accept(child) ) |
| 417 | collectItems(child, filter); |
| 418 | ++childIt; |
| 419 | continue; |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | KDevelop::DUContext* DUChainUtils::argumentContext(KDevelop::Declaration* decl) { |
| 425 | DUContext* internal = decl->internalContext(); |
nothing calls this directly
no test coverage detected