Minor rename

This commit is contained in:
Valentin Kipyatkov
2014-04-30 18:36:06 +04:00
parent d781626201
commit e7c87b2391
3 changed files with 5 additions and 4 deletions
+1
View File
@@ -2,6 +2,7 @@
<dictionary name="valentin"> <dictionary name="valentin">
<words> <words>
<w>pparent</w> <w>pparent</w>
<w>rparenth</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>
@@ -52,7 +52,7 @@ import org.jetbrains.jet.lang.resolve.calls.util.hasUnmappedParameters
enum class Tail { enum class Tail {
COMMA COMMA
PARENTHESIS RPARENTH
ELSE ELSE
} }
@@ -139,7 +139,7 @@ class ExpectedInfos(val bindingContext: BindingContext, val moduleDescriptor: Mo
if (parameters.size <= argumentIndex) continue if (parameters.size <= argumentIndex) continue
} }
val parameterDescriptor = parameters[argumentIndex] val parameterDescriptor = parameters[argumentIndex]
val tail = if (isFunctionLiteralArgument) null else if (argumentIndex == parameters.size - 1) Tail.PARENTHESIS else Tail.COMMA val tail = if (isFunctionLiteralArgument) null else if (argumentIndex == parameters.size - 1) Tail.RPARENTH else Tail.COMMA
expectedInfos.add(ExpectedInfo(parameterDescriptor.getType(), tail)) expectedInfos.add(ExpectedInfo(parameterDescriptor.getType(), tail))
} }
} }
@@ -164,7 +164,7 @@ class ExpectedInfos(val bindingContext: BindingContext, val moduleDescriptor: Mo
private fun calculateForIf(expressionWithType: JetExpression): Collection<ExpectedInfo>? { private fun calculateForIf(expressionWithType: JetExpression): Collection<ExpectedInfo>? {
val ifExpression = (expressionWithType.getParent() as? JetContainerNode)?.getParent() as? JetIfExpression ?: return null val ifExpression = (expressionWithType.getParent() as? JetContainerNode)?.getParent() as? JetIfExpression ?: return null
return when (expressionWithType) { return when (expressionWithType) {
ifExpression.getCondition() -> listOf(ExpectedInfo(KotlinBuiltIns.getInstance().getBooleanType(), Tail.PARENTHESIS)) ifExpression.getCondition() -> listOf(ExpectedInfo(KotlinBuiltIns.getInstance().getBooleanType(), Tail.RPARENTH))
ifExpression.getThen() -> calculate(ifExpression)?.map { ExpectedInfo(it.`type`, Tail.ELSE) } ifExpression.getThen() -> calculate(ifExpression)?.map { ExpectedInfo(it.`type`, Tail.ELSE) }
@@ -73,7 +73,7 @@ fun LookupElement.addTail(tail: Tail?): LookupElement {
} }
} }
Tail.PARENTHESIS -> object: LookupElementDecorator<LookupElement>(this) { Tail.RPARENTH -> object: LookupElementDecorator<LookupElement>(this) {
override fun handleInsert(context: InsertionContext) { override fun handleInsert(context: InsertionContext) {
handlers.WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false).handleInsert(context, getDelegate()) handlers.WithTailInsertHandler(")", spaceBefore = false, spaceAfter = false).handleInsert(context, getDelegate())
} }