MCPcopy Create free account
hub / github.com/KDE/kdevelop / setInternalContext

Method setInternalContext

kdevplatform/language/duchain/declaration.cpp:431–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431void Declaration::setInternalContext(DUContext* context)
432{
433 if (this->context()) {
434 ENSURE_CAN_WRITE
435 }
436 DUCHAIN_D_DYNAMIC(Declaration);
437
438 if (context == d->m_internalContext.context())
439 return;
440
441 if (!m_topContext) {
442 //Take the top-context from the other side. We need to allocate an index, so we can safely call setOwner(..)
443 m_topContext = context->topContext();
444 allocateOwnIndex();
445 }
446
447 DUContext* oldInternalContext = d->m_internalContext.context();
448
449 d->m_internalContext = context;
450
451 //Q_ASSERT( !oldInternalContext || oldInternalContext->owner() == this );
452 if (oldInternalContext && oldInternalContext->owner() == this)
453 oldInternalContext->setOwner(nullptr);
454
455 if (context)
456 context->setOwner(this);
457}
458
459bool Declaration::operator ==(const Declaration& other) const
460{
461 ENSURE_CAN_READ
462
463 return this == &other;
464}
465
466QString Declaration::toString() const
467{
468 return QStringLiteral("%3 %4").arg(abstractType() ? abstractType()->toString() : QStringLiteral(
469 "<notype>"), identifier().toString());
470}
471
472bool Declaration::isDefinition() const
473{
474 ENSURE_CAN_READ
475 DUCHAIN_D(Declaration);
476
477 return d->m_isDefinition;
478}
479
480void Declaration::setDeclarationIsDefinition(bool dd)
481{
482 ENSURE_CAN_WRITE
483 DUCHAIN_D_DYNAMIC(Declaration);
484 d->m_isDefinition = dd;
485}
486
487bool Declaration::isAutoDeclaration() const
488{

Callers 10

~DUContextMethod · 0.80
setOwnerMethod · 0.80
createDeclarationMethod · 0.80
declareFunctionMethod · 0.80
visitMethod · 0.80
declareExportsMethod · 0.80
importDirectoryMethod · 0.80
createObjectMethod · 0.80

Calls 4

contextMethod · 0.95
setOwnerMethod · 0.80
topContextMethod · 0.45
ownerMethod · 0.45

Tested by

no test coverage detected