Changeset View
Changeset View
Standalone View
Standalone View
language/duchain/declaration.cpp
Show First 20 Lines • Show All 439 Lines • ▼ Show 20 Line(s) | |||||
440 | 440 | | |||
441 | void Declaration::setInternalContext(DUContext* context) | 441 | void Declaration::setInternalContext(DUContext* context) | ||
442 | { | 442 | { | ||
443 | if(this->context()) { | 443 | if(this->context()) { | ||
444 | ENSURE_CAN_WRITE | 444 | ENSURE_CAN_WRITE | ||
445 | } | 445 | } | ||
446 | DUCHAIN_D_DYNAMIC(Declaration); | 446 | DUCHAIN_D_DYNAMIC(Declaration); | ||
447 | 447 | | |||
448 | if( context == d->m_internalContext.context() ) | 448 | if( !context || context == d->m_internalContext.context() ) | ||
449 | return; | 449 | return; | ||
450 | 450 | | |||
451 | if(!m_topContext) { | 451 | if(!m_topContext) { | ||
452 | //Take the top-context from the other side. We need to allocate an index, so we can safely call setOwner(..) | 452 | //Take the top-context from the other side. We need to allocate an index, so we can safely call setOwner(..) | ||
453 | m_topContext = context->topContext(); | 453 | m_topContext = context->topContext(); | ||
454 | allocateOwnIndex(); | 454 | allocateOwnIndex(); | ||
455 | } | 455 | } | ||
456 | 456 | | |||
457 | DUContext* oldInternalContext = d->m_internalContext.context(); | 457 | DUContext* oldInternalContext = d->m_internalContext.context(); | ||
458 | 458 | | |||
459 | d->m_internalContext = context; | 459 | d->m_internalContext = context; | ||
460 | 460 | | |||
461 | //Q_ASSERT( !oldInternalContext || oldInternalContext->owner() == this ); | 461 | //Q_ASSERT( !oldInternalContext || oldInternalContext->owner() == this ); | ||
462 | if( oldInternalContext && oldInternalContext->owner() == this ) | 462 | if( oldInternalContext && oldInternalContext->owner() == this ) | ||
463 | oldInternalContext->setOwner(nullptr); | 463 | oldInternalContext->setOwner(nullptr); | ||
464 | 464 | | |||
465 | | ||||
466 | if( context ) | | |||
467 | context->setOwner(this); | 465 | context->setOwner(this); | ||
468 | } | 466 | } | ||
469 | 467 | | |||
470 | 468 | | |||
471 | bool Declaration::operator ==(const Declaration & other) const | 469 | bool Declaration::operator ==(const Declaration & other) const | ||
472 | { | 470 | { | ||
473 | ENSURE_CAN_READ | 471 | ENSURE_CAN_READ | ||
474 | 472 | | |||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |