mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix incorrect resolve to self in tuple expressions; fix possible SOE
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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/";
|
||||
|
||||
Reference in New Issue
Block a user