mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-49176: all comments are moved with the function body after inline (PY-36491)
GitOrigin-RevId: b25b35392252d9855f23f98381505c5de5c948d5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2671f91d88
commit
cb1875f3c6
@@ -255,16 +255,13 @@ class PyInlineFunctionProcessor(project: Project,
|
||||
|
||||
declarations.forEach { insertElement(it) }
|
||||
if (replacementFunction.firstChild != null) {
|
||||
if (replacementFunction.firstChild is PsiComment) {
|
||||
SyntaxTraverser.psiApi().children(replacementFunction)
|
||||
.takeWhile { it is PsiComment || it is PsiWhiteSpace }
|
||||
.filterIsInstance<PsiComment>()
|
||||
.forEach { insertElement(it) }
|
||||
}
|
||||
val statements = if (hasDocstring) replacementFunction.statements.drop(1) else replacementFunction.statements.toList()
|
||||
val directChildren = SyntaxTraverser.psiApi().children(replacementFunction).filter { it !is PsiWhiteSpace }.toList()
|
||||
val statementsAndComments = if (hasDocstring) directChildren.drop(1) else directChildren
|
||||
val statements = statementsAndComments.filterIsInstance<PyStatement>()
|
||||
if (statements.size > 1 || statements.firstOrNull() !is PyPassStatement) {
|
||||
statements.asSequence()
|
||||
statementsAndComments.asSequence()
|
||||
.map { insertElement(it) }
|
||||
.filterIsInstance<PyStatement>()
|
||||
.forEach { PyClassRefactoringUtil.restoreNamedReferences(it) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user