Search in sources :

Example 1 with KtFinallySection

use of org.jetbrains.kotlin.psi.KtFinallySection in project kotlin by JetBrains.

the class KotlinTryFinallySurrounder method getTextRangeForCaret.

@NotNull
@Override
protected TextRange getTextRangeForCaret(@NotNull KtTryExpression expression) {
    KtFinallySection block = expression.getFinallyBlock();
    assert block != null : "Finally block should exists for " + expression.getText();
    KtExpression blockExpression = block.getFinalExpression().getStatements().get(0);
    return blockExpression.getTextRange();
}
Also used : KtFinallySection(org.jetbrains.kotlin.psi.KtFinallySection) KtExpression(org.jetbrains.kotlin.psi.KtExpression) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)1 KtExpression (org.jetbrains.kotlin.psi.KtExpression)1 KtFinallySection (org.jetbrains.kotlin.psi.KtFinallySection)1