ConvertToForEachLoopIntention - renamed
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
This intention converts a call to the "forEach" function into a for each loop expression.
|
This intention converts a call to the "forEach" function into a for loop.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -785,7 +785,7 @@
|
|||||||
</intentionAction>
|
</intentionAction>
|
||||||
|
|
||||||
<intentionAction>
|
<intentionAction>
|
||||||
<className>org.jetbrains.kotlin.idea.intentions.ConvertToForEachLoopIntention</className>
|
<className>org.jetbrains.kotlin.idea.intentions.ConvertForEachToForLoopIntention</className>
|
||||||
<category>Kotlin</category>
|
<category>Kotlin</category>
|
||||||
</intentionAction>
|
</intentionAction>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
|
|
||||||
public class ConvertToForEachLoopIntention : JetSelfTargetingIntention<JetExpression>(javaClass(), "Replace with a for each loop") {
|
public class ConvertForEachToForLoopIntention : JetSelfTargetingIntention<JetExpression>(javaClass(), "Replace with a for each loop") {
|
||||||
override fun isApplicableTo(element: JetExpression, caretOffset: Int): Boolean {
|
override fun isApplicableTo(element: JetExpression, caretOffset: Int): Boolean {
|
||||||
val data = extractData(element) ?: return false
|
val data = extractData(element) ?: return false
|
||||||
if (data.functionLiteral.getValueParameters().size() > 1) return false
|
if (data.functionLiteral.getValueParameters().size() > 1) return false
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
org.jetbrains.kotlin.idea.intentions.ConvertForEachToForLoopIntention
|
||||||
@@ -1 +0,0 @@
|
|||||||
org.jetbrains.kotlin.idea.intentions.ConvertToForEachLoopIntention
|
|
||||||
@@ -2540,6 +2540,75 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("idea/testData/intentions/convertForEachToForLoop")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
public static class ConvertForEachToForLoop extends AbstractIntentionTest {
|
||||||
|
public void testAllFilesPresentInConvertForEachToForLoop() throws Exception {
|
||||||
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertForEachToForLoop"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("complexReceiver.kt")
|
||||||
|
public void testComplexReceiver() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/complexReceiver.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitFunctionLiteral.kt")
|
||||||
|
public void testExplicitFunctionLiteral() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/explicitFunctionLiteral.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("extraArguments.kt")
|
||||||
|
public void testExtraArguments() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/extraArguments.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("implicitFunctionLiteralParameter.kt")
|
||||||
|
public void testImplicitFunctionLiteralParameter() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/implicitFunctionLiteralParameter.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("infixCall.kt")
|
||||||
|
public void testInfixCall() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/infixCall.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("parenthesizedExpression.kt")
|
||||||
|
public void testParenthesizedExpression() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/parenthesizedExpression.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/simple.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typeArgumentPresent.kt")
|
||||||
|
public void testTypeArgumentPresent() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/typeArgumentPresent.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("userDefined.kt")
|
||||||
|
public void testUserDefined() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/userDefined.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("zeroArguments.kt")
|
||||||
|
public void testZeroArguments() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertForEachToForLoop/zeroArguments.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/intentions/convertFunctionToProperty")
|
@TestMetadata("idea/testData/intentions/convertFunctionToProperty")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
@@ -3533,75 +3602,6 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("idea/testData/intentions/convertToForEachLoop")
|
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
|
||||||
public static class ConvertToForEachLoop extends AbstractIntentionTest {
|
|
||||||
public void testAllFilesPresentInConvertToForEachLoop() throws Exception {
|
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/convertToForEachLoop"), Pattern.compile("^(.+)\\.kt$"), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("complexReceiver.kt")
|
|
||||||
public void testComplexReceiver() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/complexReceiver.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("explicitFunctionLiteral.kt")
|
|
||||||
public void testExplicitFunctionLiteral() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/explicitFunctionLiteral.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("extraArguments.kt")
|
|
||||||
public void testExtraArguments() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/extraArguments.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("implicitFunctionLiteralParameter.kt")
|
|
||||||
public void testImplicitFunctionLiteralParameter() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/implicitFunctionLiteralParameter.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("infixCall.kt")
|
|
||||||
public void testInfixCall() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/infixCall.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("parenthesizedExpression.kt")
|
|
||||||
public void testParenthesizedExpression() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/parenthesizedExpression.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
|
||||||
public void testSimple() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/simple.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("typeArgumentPresent.kt")
|
|
||||||
public void testTypeArgumentPresent() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/typeArgumentPresent.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("userDefined.kt")
|
|
||||||
public void testUserDefined() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/userDefined.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("zeroArguments.kt")
|
|
||||||
public void testZeroArguments() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/intentions/convertToForEachLoop/zeroArguments.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("idea/testData/intentions/convertToStringTemplate")
|
@TestMetadata("idea/testData/intentions/convertToStringTemplate")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user