PY-25491 Use AST-based search to find 'as' target expression

We don't store stubs for 'as' targets of type PyTargetExpression in
PyImportElements. We store the 'as' name in the stubs for
PyImportElements instead. The getAsName() checks if the element has
a stub, and if it hasn't, then asks its AST about the name. It used to
access AST via getStubOrPsiChild() and it was always AST because it
happened after a 'getStub() == null' check. But now we have green stubs
so getStubOrPsiChild() accesses the green stub via getGreenStub() even
though we have AST.
This commit is contained in:
Andrey Vlasovskikh
2017-08-22 22:33:35 +03:00
parent af23aacf19
commit 62910585fe
@@ -72,7 +72,7 @@ public class PyImportElementImpl extends PyBaseElementImpl<PyImportElementStub>
}
public PyTargetExpression getAsNameElement() {
return getStubOrPsiChild(PyElementTypes.TARGET_EXPRESSION);
return findChildByType(PyElementTypes.TARGET_EXPRESSION);
}
public String getAsName() {