mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-75537 Slightly simplified PyAssignmentStatementImpl.getTargetsToValuesMapping()
GitOrigin-RevId: 41f02b5c164380ad978cfa66eb36bb5b97189855
This commit is contained in:
committed by
intellij-monorepo-bot
parent
05942bee35
commit
47e2c8c0bc
+5
-4
@@ -51,10 +51,11 @@ public class PyAssignmentStatementImpl extends PyElementImpl implements PyAssign
|
||||
if (!PsiTreeUtil.hasErrorElements(this)) { // no parse errors
|
||||
PyExpression[] constituents = PsiTreeUtil.getChildrenOfType(this, PyExpression.class); // "a = b = c" -> [a, b, c]
|
||||
if (constituents != null && constituents.length > 1) {
|
||||
PyExpression rhs = constituents[constituents.length - 1]; // last
|
||||
List<PyExpression> lhses = Lists.newArrayList(constituents);
|
||||
if (!lhses.isEmpty()) lhses.remove(lhses.size() - 1); // copy all but last; most often it's one element.
|
||||
for (PyExpression lhs : lhses) mapToValues(lhs, rhs, ret);
|
||||
int lastIndex = constituents.length - 1;
|
||||
PyExpression rhs = constituents[lastIndex];
|
||||
for (int i = 0; i < lastIndex; i++) {
|
||||
mapToValues(constituents[i], rhs, ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user