Data Outflow: Allow for-loop variables
#KT-19018 Fixed
This commit is contained in:
@@ -113,9 +113,7 @@ private fun KtDeclaration.processVariableAccesses(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KtParameter.canProcess(): Boolean {
|
private fun KtParameter.canProcess() = !isVarArg
|
||||||
return !(isLoopParameter || isVarArg)
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class Slicer(
|
abstract class Slicer(
|
||||||
protected val element: KtExpression,
|
protected val element: KtExpression,
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
// FLOW: OUT
|
||||||
|
|
||||||
|
fun f1(param: String) {}
|
||||||
|
|
||||||
|
fun f4(list: List<String>) {
|
||||||
|
for (<caret>s in list)
|
||||||
|
if (s.isNotEmpty())
|
||||||
|
f1(s)
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
6 for (<bold>s</bold> in list)
|
||||||
|
7 if (<bold>s</bold>.isNotEmpty())
|
||||||
|
8 f1(<bold>s</bold>)
|
||||||
|
3 fun f1(<bold>param: String</bold>) {}
|
||||||
@@ -378,6 +378,12 @@ public class SlicerTestGenerated extends AbstractSlicerTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("outflow/forVariable.kt")
|
||||||
|
public void testOutflow_ForVariable() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/slicer/outflow/forVariable.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("outflow/funBodyExpression.kt")
|
@TestMetadata("outflow/funBodyExpression.kt")
|
||||||
public void testOutflow_FunBodyExpression() throws Exception {
|
public void testOutflow_FunBodyExpression() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/slicer/outflow/funBodyExpression.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/slicer/outflow/funBodyExpression.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user