Extract Function: Keep track of original parameter descriptors

This commit is contained in:
Alexey Sedunov
2014-07-01 14:23:59 +04:00
parent 09a1a8ce8f
commit 3e3918ab6e
191 changed files with 328 additions and 7 deletions
@@ -34,9 +34,11 @@ import org.jetbrains.jet.lang.psi.JetTypeConstraint
import org.jetbrains.jet.plugin.refactoring.extractFunction.AnalysisResult.Status
import org.jetbrains.jet.plugin.refactoring.JetRefactoringBundle
import org.jetbrains.jet.plugin.refactoring.extractFunction.AnalysisResult.ErrorMessage
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
trait Parameter {
val argumentText: String
val originalDescriptor: DeclarationDescriptor
val name: String
val mirrorVarName: String?
val parameterType: JetType
@@ -315,6 +315,7 @@ private fun JetType.processTypeIfExtractable(
private class MutableParameter(
override val argumentText: String,
override val originalDescriptor: DeclarationDescriptor,
override val name: String,
override val mirrorVarName: String?,
override val receiverCandidate: Boolean
@@ -454,7 +455,7 @@ private fun ExtractionData.inferParametersInfo(
else
(thisExpr ?: ref).getText() ?: throw AssertionError("'this' reference shouldn't be empty: code fragment = ${getCodeFragmentText()}")
MutableParameter(argumentText, parameterName, mirrorVarName, extractThis)
MutableParameter(argumentText, descriptorToExtract, parameterName, mirrorVarName, extractThis)
}
parameter.addDefaultType(parameterType)