mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
@@ -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('=', ' ');
|
||||
|
||||
Reference in New Issue
Block a user