From 152e77bad3cf20e365ea41da04b3f7e7bf9afbd6 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Mon, 24 Oct 2016 19:51:41 +0300 Subject: [PATCH] Added comment --- .../kotlin/idea/replacement/introduceValue.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/idea/idea-replacement-engine/src/org/jetbrains/kotlin/idea/replacement/introduceValue.kt b/idea/idea-replacement-engine/src/org/jetbrains/kotlin/idea/replacement/introduceValue.kt index de023ecae1c..8764d9cdb52 100644 --- a/idea/idea-replacement-engine/src/org/jetbrains/kotlin/idea/replacement/introduceValue.kt +++ b/idea/idea-replacement-engine/src/org/jetbrains/kotlin/idea/replacement/introduceValue.kt @@ -37,6 +37,17 @@ import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.utils.addToStdlib.check +/** + * Modifies [MutableReplacementCode] introducing a variable initialized by [value] and replacing all of [usages] with its use. + * The variable must be initialized (and so the value is calculated) before any other code in [MutableReplacementCode]. + * @param value Value to use for variable initialization + * @param valueType Type of the value + * @param usages Usages to be replaced. This collection can be empty and in this case the actual variable is not needed. + * But the expression [value] must be calculated because it may have side effects. + * @param expressionToBeReplaced Expression to be replaced by the [MutableReplacementCode]. + * @param nameSuggestion Name suggestion for the variable. + * @param safeCall If true, then the whole code must not be executed if the [value] evaluates to null. + */ internal fun MutableReplacementCode.introduceValue( value: KtExpression, valueType: KotlinType?,