Fixed extract method in case of expression with selection that breaks AST

This commit is contained in:
Oleg Shpynov
2010-02-01 12:38:49 +03:00
parent f420478d1a
commit 9393b15d8c
3 changed files with 15 additions and 1 deletions

View File

@@ -97,7 +97,7 @@ public class PyExtractMethodHandler implements RefactoringActionHandler {
final PsiElement expression = PyRefactoringUtil.getSelectedExpression(project, file, element1, element2);
if (expression != null) {
final ScopeOwner owner = PsiTreeUtil.getParentOfType(expression, ScopeOwner.class);
final ScopeOwner owner = PsiTreeUtil.getParentOfType(element1, ScopeOwner.class);
if (owner == null) {
return;
}

View File

@@ -0,0 +1,10 @@
r = 2
h = 5
print(123 * <begin>r ** 2 * h<end>)
<result>
In:
h
r
Out:

View File

@@ -133,5 +133,9 @@ public class PyCodeFragmentTest extends LightMarkedTestCase {
doTest();
}
public void testExpression2() throws Exception {
doTest();
}
}