Control-Flow: Assign pseudo-values to local functions (except those

declared directly in the block)
This commit is contained in:
Alexey Sedunov
2015-04-20 14:58:41 +03:00
parent 5b1906fb13
commit d815634233
16 changed files with 388 additions and 9 deletions
@@ -102,7 +102,10 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironment {
String label;
assert (correspondingElement instanceof JetNamedDeclaration || correspondingElement instanceof JetPropertyAccessor) :
"Unexpected element class is pseudocode: " + correspondingElement.getClass();
if (correspondingElement instanceof JetFunctionLiteral) {
boolean isAnonymousFunction =
correspondingElement instanceof JetFunctionLiteral
|| (correspondingElement instanceof JetNamedFunction && correspondingElement.getName() == null);
if (isAnonymousFunction) {
label = "anonymous_" + i++;
}
else if (correspondingElement instanceof JetNamedDeclaration) {
@@ -345,12 +345,30 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/functions"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("anonymousFunctionInBlock.kt")
public void testAnonymousFunctionInBlock() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/anonymousFunctionInBlock.kt");
doTest(fileName);
}
@TestMetadata("FailFunction.kt")
public void testFailFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/FailFunction.kt");
doTest(fileName);
}
@TestMetadata("functionAsExpression.kt")
public void testFunctionAsExpression() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/functionAsExpression.kt");
doTest(fileName);
}
@TestMetadata("namedFunctionInBlock.kt")
public void testNamedFunctionInBlock() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/namedFunctionInBlock.kt");
doTest(fileName);
}
@TestMetadata("typeParameter.kt")
public void testTypeParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/typeParameter.kt");
@@ -347,12 +347,30 @@ public class PseudoValueTestGenerated extends AbstractPseudoValueTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/declarations/functions"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("anonymousFunctionInBlock.kt")
public void testAnonymousFunctionInBlock() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/anonymousFunctionInBlock.kt");
doTest(fileName);
}
@TestMetadata("FailFunction.kt")
public void testFailFunction() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/FailFunction.kt");
doTest(fileName);
}
@TestMetadata("functionAsExpression.kt")
public void testFunctionAsExpression() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/functionAsExpression.kt");
doTest(fileName);
}
@TestMetadata("namedFunctionInBlock.kt")
public void testNamedFunctionInBlock() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/namedFunctionInBlock.kt");
doTest(fileName);
}
@TestMetadata("typeParameter.kt")
public void testTypeParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/declarations/functions/typeParameter.kt");