Changeset View
Changeset View
Standalone View
Standalone View
duchain/expressionvisitor.cpp
Show First 20 Lines • Show All 634 Lines • ▼ Show 20 Line(s) | 633 | { | |||
---|---|---|---|---|---|
635 | auto defId = m_defaultTypes.constFind(node->value); | 635 | auto defId = m_defaultTypes.constFind(node->value); | ||
636 | if ( defId != m_defaultTypes.constEnd() ) { | 636 | if ( defId != m_defaultTypes.constEnd() ) { | ||
637 | return encounter(*defId); | 637 | return encounter(*defId); | ||
638 | } | 638 | } | ||
639 | } | 639 | } | ||
640 | 640 | | |||
641 | void ExpressionVisitor::visitName(Python::NameAst* node) | 641 | void ExpressionVisitor::visitName(Python::NameAst* node) | ||
642 | { | 642 | { | ||
643 | RangeInRevision range; | 643 | CursorInRevision findNameBefore; | ||
644 | if ( m_scanUntilCursor.isValid() ) { | 644 | if ( m_scanUntilCursor.isValid() ) { | ||
645 | range = RangeInRevision(CursorInRevision(0, 0), m_scanUntilCursor); | 645 | findNameBefore = m_scanUntilCursor; | ||
646 | } | 646 | } | ||
647 | else if ( m_forceGlobalSearching ) { | 647 | else if ( m_forceGlobalSearching ) { | ||
648 | range = RangeInRevision::invalid(); | 648 | findNameBefore = CursorInRevision::invalid(); | ||
649 | } | 649 | } | ||
650 | else { | 650 | else { | ||
651 | range = RangeInRevision(0, 0, node->endLine, node->endCol); | 651 | findNameBefore = CursorInRevision(node->endLine, node->endCol); | ||
652 | } | 652 | } | ||
653 | DUChainReadLocker lock; | 653 | DUChainReadLocker lock; | ||
654 | Declaration* d = Helper::declarationForName(QualifiedIdentifier(node->identifier->value), | 654 | Declaration* d = Helper::declarationForName(node, findNameBefore, | ||
655 | range, DUChainPointer<const DUContext>(context())); | 655 | DUChainPointer<const DUContext>(context())); | ||
656 | 656 | | |||
657 | if ( d ) { | 657 | if ( d ) { | ||
658 | bool isAlias = dynamic_cast<AliasDeclaration*>(d) || d->isFunctionDeclaration() || dynamic_cast<ClassDeclaration*>(d); | 658 | bool isAlias = dynamic_cast<AliasDeclaration*>(d) || d->isFunctionDeclaration() || dynamic_cast<ClassDeclaration*>(d); | ||
659 | return encounter(d->abstractType(), DeclarationPointer(d), isAlias); | 659 | return encounter(d->abstractType(), DeclarationPointer(d), isAlias); | ||
660 | } | 660 | } | ||
661 | else { | 661 | else { | ||
662 | if ( m_reportUnknownNames ) { | 662 | if ( m_reportUnknownNames ) { | ||
663 | addUnknownName(node->identifier->value); | 663 | addUnknownName(node->identifier->value); | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |