Added PyAugAssignmentStatement.getOperator()

There was no public API for accessing the operator of an augmented
assignment expression, the *Impl class was used instead which is a
bad practice.
This commit is contained in:
Andrey Vlasovskikh
2015-03-24 18:08:29 +03:00
parent e7db2ff39c
commit 186032ab9d
2 changed files with 5 additions and 3 deletions
@@ -15,6 +15,7 @@
*/
package com.jetbrains.python.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -26,4 +27,6 @@ public interface PyAugAssignmentStatement extends PyStatement {
PyExpression getTarget();
@Nullable
PyExpression getValue();
@Nullable
PsiElement getOperation();
}
@@ -50,7 +50,6 @@ import com.jetbrains.python.PythonLanguage;
import com.jetbrains.python.codeInsight.controlflow.ReadWriteInstruction;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyAugAssignmentStatementImpl;
import com.jetbrains.python.psi.impl.PyPsiUtils;
import com.jetbrains.python.refactoring.PyDefUseUtil;
import com.jetbrains.python.refactoring.PyReplaceExpressionUtil;
@@ -315,8 +314,8 @@ public class PyInlineLocalHandler extends InlineActionHandler {
private static PyExpression prepareValue(@NotNull PyStatement def, @NotNull String localName, @NotNull Project project) {
final PyExpression value = getValue(def);
assert value != null;
if (def instanceof PyAugAssignmentStatementImpl) {
final PyAugAssignmentStatementImpl expression = (PyAugAssignmentStatementImpl)def;
if (def instanceof PyAugAssignmentStatement) {
final PyAugAssignmentStatement expression = (PyAugAssignmentStatement)def;
final PsiElement operation = expression.getOperation();
assert operation != null;
final String op = operation.getText().replace('=', ' ');