Migrate kotlin sources, maven projects and stdlib to new lambda syntax

This commit is contained in:
Stanislav Erokhin
2015-04-01 16:36:44 +03:00
parent e0988de707
commit b703f59e04
74 changed files with 136 additions and 140 deletions
@@ -100,7 +100,7 @@ fun rethrowWithCancelIndicator(exception: ProcessCanceledException): ProcessCanc
return exception
}
fun PrefixMatcher.asNameFilter() = { (name: Name) ->
fun PrefixMatcher.asNameFilter() = { name: Name ->
if (name.isSpecial()) {
false
}
@@ -48,7 +48,7 @@ object KeywordValues {
}
if (!skipTrueFalse) {
val booleanInfoClassifier = { (info: ExpectedInfo) ->
val booleanInfoClassifier = { info: ExpectedInfo ->
if (info.type == KotlinBuiltIns.getInstance().getBooleanType()) ExpectedInfoClassification.matches(TypeSubstitutor.EMPTY) else ExpectedInfoClassification.notMatches
}
collection.addLookupElements(null, expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("true").bold().assignSmartCompletionPriority(SmartCompletionItemPriority.TRUE) })
@@ -45,7 +45,7 @@ object LambdaItems {
for (functionType in distinctTypes) {
val lookupString = buildLambdaPresentation(functionType)
val lookupElement = LookupElementBuilder.create(lookupString)
.withInsertHandler({ (context, lookupElement) ->
.withInsertHandler({ context, lookupElement ->
val offset = context.getStartOffset()
val placeholder = "{}"
context.getDocument().replaceString(offset, context.getTailOffset(), placeholder)
@@ -76,7 +76,7 @@ class MultipleArgumentsItemProvider(val bindingContext: BindingContext,
return LookupElementBuilder
.create(variables.map { IdeDescriptorRenderers.SOURCE_CODE.renderName(it.getName()) }.joinToString(", "))
.withInsertHandler { (context, lookupElement) ->
.withInsertHandler { context, lookupElement ->
if (context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) {
val offset = context.getOffsetMap().getOffset(SmartCompletion.MULTIPLE_ARGUMENTS_REPLACEMENT_OFFSET)
if (offset != -1) {
@@ -146,7 +146,7 @@ class SmartCompletion(
val result = ArrayList<LookupElement>()
val types = descriptor.fuzzyTypes(smartCastTypes)
val infoClassifier = { (expectedInfo: ExpectedInfo) -> types.classifyExpectedInfo(expectedInfo) }
val infoClassifier = { expectedInfo: ExpectedInfo -> types.classifyExpectedInfo(expectedInfo) }
result.addLookupElements(descriptor, expectedInfos, infoClassifier) { descriptor ->
lookupElementFactory.createLookupElement(descriptor, resolutionFacade, bindingContext, true)
@@ -199,7 +199,7 @@ class SmartCompletion(
if (shouldCompleteThisItems(prefixMatcher)) {
val items = thisExpressionItems(bindingContext, place, prefixMatcher.getPrefix())
for ((factory, type) in items) {
val classifier = { (expectedInfo: ExpectedInfo) -> type.classifyExpectedInfo(expectedInfo) }
val classifier = { expectedInfo: ExpectedInfo -> type.classifyExpectedInfo(expectedInfo) }
addLookupElements(null, expectedInfos, classifier) {
factory().assignSmartCompletionPriority(SmartCompletionItemPriority.THIS)
}
@@ -158,7 +158,7 @@ class TypeInstantiationItems(
itemText = "object: " + itemText + "{...}"
lookupString = "object"
allLookupStrings = setOf(lookupString, lookupElement.getLookupString())
insertHandler = InsertHandler<LookupElement> {(context, item) ->
insertHandler = InsertHandler<LookupElement> { context, item ->
val editor = context.getEditor()
val startOffset = context.getStartOffset()
val text = "object: $typeText$constructorParenthesis {}"