final Document document = editor.getDocument();
RangeMarker stmtRange = document.createRangeMarker(stmt.getTextRange());
GoExpr condition = stmt.getExpression();
boolean parentIsFunctionDeclaration = isFunctionBlock(stmt.getParent());
GoBlockStatement thenBlock = stmt.getThenBlock();
final int rightCurlyPosition = blockRightCurlyPosition(thenBlock);
final int leftCurlyPosition = blockLeftCurlyPosition(thenBlock);
if (rightCurlyPosition < 0 || leftCurlyPosition < 0) {
return;
}
GoBlockStatement elseBlock = stmt.getElseBlock();
boolean hasElseBlock = elseBlock != null;
List<PsiElement> siblings = getSiblings(stmt);
if (hasElseBlock) {
swapThenAndElseBlock(document, condition, thenBlock, elseBlock);