fix incorrect resolve to self in tuple expressions; fix possible SOE

This commit is contained in:
Dmitry Jemerov
2008-03-26 21:21:51 +03:00
parent 6c6c25c1fe
commit bbcd7164ed
4 changed files with 13 additions and 1 deletions
@@ -240,6 +240,9 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
}
}
PsiElement target = resolve();
if (target == this) {
return null;
}
return getTypeFromTarget(target);
}
@@ -54,7 +54,7 @@ public class PyTupleExpressionImpl extends PyElementImpl implements PyTupleExpre
PsiElement lastParent,
@NotNull PsiElement place) {
for (PyExpression expression : getElements()) {
if (!expression.processDeclarations(processor, substitutor, lastParent, place)) {
if (expression != lastParent && !expression.processDeclarations(processor, substitutor, lastParent, place)) {
return false;
}
}
+3
View File
@@ -0,0 +1,3 @@
aa = 1
bb = 2
c = aa, b<ref>b
@@ -87,6 +87,12 @@ public class PyResolveTest extends ResolveTestCase {
assertTrue(targetElement instanceof PyTargetExpression);
}
public void testTuple() throws Exception {
PsiElement targetElement = resolve();
assertTrue(targetElement instanceof PyTargetExpression);
assertTrue(targetElement.getParent() instanceof PyAssignmentStatement);
}
@Override
protected String getTestDataPath() {
return PathManager.getHomePath() + "/plugins/python/testData/resolve/";