Added PyQualifiedReference.isQualified() that potentially doesn't require AST access

This commit is contained in:
Andrey Vlasovskikh
2014-01-23 18:04:13 +04:00
parent 99af1d0136
commit 585e827014
36 changed files with 69 additions and 45 deletions
@@ -58,7 +58,7 @@ public interface NameDefiner extends PsiElement {
for (PyElement elt : it) {
if (elt != null) {
// qualified refs don't match by last name, and we're not checking FQNs here
if (elt instanceof PyQualifiedExpression && ((PyQualifiedExpression)elt).getQualifier() != null) continue;
if (elt instanceof PyQualifiedExpression && ((PyQualifiedExpression)elt).isQualified()) continue;
if (name.equals(elt.getName())) { // plain name matches
ret = elt;
break;
@@ -30,6 +30,13 @@ public interface PyQualifiedExpression extends PyExpression {
@Nullable
PyExpression getQualifier();
/**
* Checks if the expression is qualified.
*
* Unlike {@link #getQualifier()}, it may not require AST access.
*/
boolean isQualified();
/**
* Returns the name to the right of the qualifier.
*
@@ -57,6 +57,4 @@ public interface PyTargetExpression extends PyQualifiedExpression, PsiNamedEleme
@Nullable
PyClass getContainingClass();
boolean isQualified();
}