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
@@ -43,7 +43,7 @@ public class PseudocodeVariableDataCollector(
//see KT-4605
instructionDataMergeStrategy as
(Instruction, Collection<Map<VariableDescriptor, D>>) -> Edges<Map<VariableDescriptor, D>>,
{ (from, to, data) -> filterOutVariablesOutOfScope(from, to, data)},
{ from, to, data -> filterOutVariablesOutOfScope(from, to, data)},
Collections.emptyMap<VariableDescriptor, D>())
//see KT-4605
return result as MutableMap<Instruction, Edges<MutableMap<VariableDescriptor, D>>>
@@ -84,4 +84,4 @@ fun JetType.getSubtypesPredicate(): TypePredicate {
private fun JetType.render(): String = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(this)
public fun <T> TypePredicate.expectedTypeFor(keys: Iterable<T>): Map<T, TypePredicate> =
keys.fold(SmartFMap.emptyMap<T, TypePredicate>()) { (map, key) -> map.plus(key, this) }
keys.fold(SmartFMap.emptyMap<T, TypePredicate>()) { map, key -> map.plus(key, this) }
@@ -49,7 +49,7 @@ public object Renderers {
private val LOG = Logger.getInstance(javaClass<Renderers>())
public val TO_STRING: Renderer<Any> = Renderer {
(element) ->
element ->
if (element is DeclarationDescriptor) {
LOG.warn("Diagnostic renderer TO_STRING was used to render an instance of DeclarationDescriptor.\n"
+ "This is usually a bad idea, because descriptors' toString() includes some debug information, "
@@ -67,7 +67,7 @@ public object Renderers {
public val DECLARATION_NAME: Renderer<JetNamedDeclaration> = Renderer { it.getNameAsSafeName().asString() }
public val RENDER_CLASS_OR_OBJECT: Renderer<JetClassOrObject> = Renderer {
(classOrObject: JetClassOrObject) ->
classOrObject: JetClassOrObject ->
val name = if (classOrObject.getName() != null) " '" + classOrObject.getName() + "'" else ""
if (classOrObject is JetClass) "Class" + name else "Object" + name
}
@@ -77,7 +77,7 @@ public object Renderers {
public val RENDER_TYPE: Renderer<JetType> = Renderer { DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(it) }
public val RENDER_POSITION_VARIANCE: Renderer<Variance> = Renderer {
(variance: Variance) ->
variance: Variance ->
when (variance) {
Variance.INVARIANT -> "invariant"
Variance.IN_VARIANCE -> "in"
@@ -86,7 +86,7 @@ public object Renderers {
}
public val AMBIGUOUS_CALLS: Renderer<Collection<ResolvedCall<*>>> = Renderer {
(argument: Collection<ResolvedCall<*>>) ->
argument: Collection<ResolvedCall<*>> ->
val stringBuilder = StringBuilder("\n")
for (call in argument) {
stringBuilder.append(DescriptorRenderer.FQ_NAMES_IN_TYPES.render(call.getResultingDescriptor())).append("\n")
@@ -356,7 +356,7 @@ public object Renderers {
public val RENDER_CONSTRAINT_SYSTEM: Renderer<ConstraintSystem> = Renderer { renderConstraintSystem(it) }
private fun renderTypeBounds(typeBounds: TypeBounds): String {
val renderBound = { (bound: Bound) ->
val renderBound = { bound: Bound ->
val arrow = if (bound.kind == LOWER_BOUND) ">: " else if (bound.kind == UPPER_BOUND) "<: " else ":= "
arrow + RENDER_TYPE.render(bound.constrainingType) + '(' + bound.position + ')'
}
@@ -368,13 +368,13 @@ public fun JetExpression.isFunctionLiteralOutsideParentheses(): Boolean {
}
public fun PsiElement.siblings(forward: Boolean = true, withItself: Boolean = true): Stream<PsiElement> {
val stepFun = if (forward) { (e: PsiElement) -> e.getNextSibling() } else { (e: PsiElement) -> e.getPrevSibling() }
val stepFun = if (forward) { e: PsiElement -> e.getNextSibling() } else { e: PsiElement -> e.getPrevSibling() }
val stream = stream(this, stepFun)
return if (withItself) stream else stream.drop(1)
}
public fun ASTNode.siblings(forward: Boolean = true, withItself: Boolean = true): Stream<ASTNode> {
val stepFun = if (forward) { (node: ASTNode) -> node.getTreeNext() } else { (e: ASTNode) -> e.getTreeNext() }
val stepFun = if (forward) { node: ASTNode -> node.getTreeNext() } else { e: ASTNode -> e.getTreeNext() }
val stream = stream(this, stepFun)
return if (withItself) stream else stream.drop(1)
}
@@ -72,7 +72,7 @@ object DescriptorEquivalenceForOverrides {
if (!ownersEquivalent(a, b, {x, y -> false})) return false
val overridingUtil = OverridingUtil.createWithEqualityAxioms @eq {
(c1, c2): Boolean ->
c1, c2 ->
if (c1 == c2) return@eq true
val d1 = c1.getDeclarationDescriptor()
@@ -81,7 +81,7 @@ private class ExplicitTypeBinding(
jetType.isError() || !sizeIsEqual
}
return psiTypeArguments.indices.map { (index: Int): TypeArgumentBinding<JetTypeElement>? ->
return psiTypeArguments.indices.map { index: Int ->
// todo fix for List<*>
val jetTypeReference = psiTypeArguments[index]
val jetTypeElement = jetTypeReference?.getTypeElement()
@@ -53,7 +53,7 @@ public class LazyAnnotations(
override fun isEmpty() = annotationEntries.isEmpty()
private val annotation = c.storageManager.createMemoizedFunction {
(entry: JetAnnotationEntry) ->
entry: JetAnnotationEntry ->
LazyAnnotationDescriptor(c, entry)
}