Deprecated _tmp functions replaced by library ones

This commit is contained in:
Andrey Breslav
2014-04-29 15:46:11 +04:00
parent 4181bcc319
commit 19719f9747
11 changed files with 13 additions and 104 deletions
@@ -60,8 +60,6 @@ import org.jetbrains.jet.lang.psi.JetTypeReference
import com.intellij.util.containers.ContainerUtil
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils
import org.jetbrains.jet.plugin.imports.*
import org.jetbrains.jet.lang.descriptors.PackageViewDescriptor
import org.jetbrains.jet.utils.*
//NOTE: this class is based on CopyPasteReferenceProcessor and JavaCopyPasteReferenceProcessor
public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<ReferenceTransferableData?> {
@@ -358,7 +356,7 @@ private val ReferenceData.fqName: FqName
private fun zip(first: IntArray, second: IntArray): Iterable<Pair<Int, Int>> {
assert(first.size == second.size)
return first.toList().zip_tmp(second.toList())
return first.zip(second.toList())
}
private fun PsiElement.isInCopiedArea(fileCopiedFrom: JetFile, startOffsets: IntArray, endOffsets: IntArray): Boolean {
@@ -31,7 +31,6 @@ import org.jetbrains.jet.lang.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.jet.lang.resolve.BindingContextUtils
import org.jetbrains.jet.plugin.references.JetReference
import org.jetbrains.jet.lang.descriptors.VariableDescriptor
import org.jetbrains.jet.utils.firstOrNull_tmp
public class ReplaceExplicitFunctionLiteralParamWithItIntention() : PsiElementBaseIntentionAction() {
override fun invoke(project: Project, editor: Editor, element: PsiElement) {
@@ -75,7 +74,7 @@ public class ReplaceExplicitFunctionLiteralParamWithItIntention() : PsiElementBa
}
is JetSimpleNameExpression -> {
val reference = expression.getReference() as JetReference?
val variableDescriptor = reference?.resolveToDescriptors()?.firstOrNull_tmp() as? VariableDescriptor?
val variableDescriptor = reference?.resolveToDescriptors()?.firstOrNull() as? VariableDescriptor?
if (variableDescriptor != null) {
val containingDescriptor = variableDescriptor.getContainingDeclaration()
if (containingDescriptor is AnonymousFunctionDescriptor) {
@@ -33,7 +33,6 @@ import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor
import org.jetbrains.jet.lang.resolve.BindingContextUtils
import org.jetbrains.jet.lang.psi.JetFunctionLiteral
import org.jetbrains.jet.plugin.references.JetReference
import org.jetbrains.jet.utils.firstOrNull_tmp
public class ReplaceItWithExplicitFunctionLiteralParamIntention() : PsiElementBaseIntentionAction() {
override fun invoke(project: Project, editor: Editor, element: PsiElement) {
@@ -64,7 +63,7 @@ public class ReplaceItWithExplicitFunctionLiteralParamIntention() : PsiElementBa
val bindingContext = AnalyzerFacadeWithCache.getContextForElement(simpleNameExpression)
val reference = simpleNameExpression.getReference() as JetReference?
val simpleNameTarget = reference?.resolveToDescriptors()?.firstOrNull_tmp() as? ValueParameterDescriptor?
val simpleNameTarget = reference?.resolveToDescriptors()?.firstOrNull() as? ValueParameterDescriptor?
if (simpleNameTarget == null || bindingContext.get(BindingContext.AUTO_CREATED_IT, simpleNameTarget) != true) {
return false
}
@@ -329,7 +329,7 @@ public fun JetWhenExpression.canMergeWithNext(): Boolean {
val conditions1 = e1.getConditions().toList()
val conditions2 = e2.getConditions().toList()
return conditions1.size == conditions2.size &&
(conditions1 zip_tmp conditions2).all { pair -> JetPsiMatcher.checkElementMatch(pair.first, pair.second)}
(conditions1 zip conditions2).all { pair -> JetPsiMatcher.checkElementMatch(pair.first, pair.second)}
}
fun JetWhenEntry.declarationNames(): Set<String> =
@@ -354,7 +354,7 @@ public fun JetWhenExpression.canMergeWithNext(): Boolean {
val entries1 = getEntries()
val entries2 = sibling.getEntries()
return entries1.size == entries2.size && (entries1 zip_tmp entries2).all { pair ->
return entries1.size == entries2.size && (entries1 zip entries2).all { pair ->
checkConditions(pair.first, pair.second) && checkBodies(pair.first, pair.second)
}
}
@@ -374,7 +374,7 @@ public fun JetWhenExpression.mergeWithNext() {
}
val sibling = PsiTreeUtil.skipSiblingsForward(this, javaClass<PsiWhiteSpace>()) as JetWhenExpression
for ((entry1, entry2) in getEntries() zip_tmp sibling.getEntries()) {
for ((entry1, entry2) in getEntries() zip sibling.getEntries()) {
entry1.getExpression() mergeWith entry2.getExpression()
}
@@ -31,7 +31,7 @@ public object JetPsiPrecedences {
private val precedence: Map<IElementType, Int>
{
val builder = HashMap<IElementType, Int>()
for ((i, record) in JetExpressionParsing.Precedence.values().withIndices_tmp()) {
for ((i, record) in JetExpressionParsing.Precedence.values().withIndices()) {
for (elementType in record.getOperations().getTypes()) {
builder[elementType] = i
}