From 7ebf001d256c18bed9c133cdc93b65ff0e69c2a2 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 16 Aug 2016 17:20:21 +0300 Subject: [PATCH] Moved class --- .../LoopToCallChainIntention.kt | 1 + .../intentions/loopToCallChain/interfaces.kt | 11 ------ .../loopToCallChain/matchAndConvert.kt | 5 +-- .../sequence/AsSequenceTransformation.kt | 34 +++++++++++++++++++ 4 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/sequence/AsSequenceTransformation.kt diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/LoopToCallChainIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/LoopToCallChainIntention.kt index f12e70b4a15..0c6502e441b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/LoopToCallChainIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/LoopToCallChainIntention.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.idea.core.moveCaret import org.jetbrains.kotlin.idea.inspections.IntentionBasedInspection import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention +import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.AsSequenceTransformation import org.jetbrains.kotlin.psi.KtForExpression import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.psiUtil.startOffset diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/interfaces.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/interfaces.kt index c10f5c8ee14..05c919bf7d1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/interfaces.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/interfaces.kt @@ -222,14 +222,3 @@ class CommentSavingRangeHolder(range: PsiChildRange) { private fun PsiElement.siblingsBefore() = if (prevSibling != null) PsiChildRange(parent.firstChild, prevSibling) else PsiChildRange.EMPTY } -class AsSequenceTransformation(override val loop: KtForExpression) : SequenceTransformation { - override val presentation: String - get() = "asSequence()" - - override val affectsIndex: Boolean - get() = false - - override fun generateCode(chainedCallGenerator: ChainedCallGenerator): KtExpression { - return chainedCallGenerator.generate("asSequence()") - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/matchAndConvert.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/matchAndConvert.kt index a3e98bb32b9..9e953689ada 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/matchAndConvert.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/matchAndConvert.kt @@ -25,10 +25,7 @@ import org.jetbrains.kotlin.idea.analysis.analyzeInContext import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.intentions.loopToCallChain.result.* -import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.FilterTransformation -import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.FlatMapTransformation -import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.IntroduceIndexMatcher -import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.MapTransformation +import org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence.* import org.jetbrains.kotlin.idea.project.builtIns import org.jetbrains.kotlin.idea.util.CommentSaver import org.jetbrains.kotlin.idea.util.getResolutionScope diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/sequence/AsSequenceTransformation.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/sequence/AsSequenceTransformation.kt new file mode 100644 index 00000000000..42c694e9b70 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/loopToCallChain/sequence/AsSequenceTransformation.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.intentions.loopToCallChain.sequence + +import org.jetbrains.kotlin.idea.intentions.loopToCallChain.ChainedCallGenerator +import org.jetbrains.kotlin.idea.intentions.loopToCallChain.SequenceTransformation +import org.jetbrains.kotlin.psi.KtExpression +import org.jetbrains.kotlin.psi.KtForExpression + +class AsSequenceTransformation(override val loop: KtForExpression) : SequenceTransformation { + override val presentation: String + get() = "asSequence()" + + override val affectsIndex: Boolean + get() = false + + override fun generateCode(chainedCallGenerator: ChainedCallGenerator): KtExpression { + return chainedCallGenerator.generate("asSequence()") + } +} \ No newline at end of file