Removed obsolete code in 'lookupConstructorExpressionsInClosureIfPresent' method

This commit is contained in:
Michael Bogdanov
2016-07-21 10:51:22 +03:00
parent 5dca4dbc67
commit 55382ba848
6 changed files with 87 additions and 40 deletions
@@ -1309,22 +1309,6 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
specifier.accept(visitor);
}
}
ClassDescriptor superClass = DescriptorUtilsKt.getSuperClassNotAny(descriptor);
if (superClass != null) {
if (superClass.isInner()) {
context.lookupInContext(superClass.getContainingDeclaration(), StackValue.LOCAL_0, state, true);
}
ConstructorDescriptor primaryConstructor = descriptor.getUnsubstitutedPrimaryConstructor();
if (primaryConstructor != null && !isAnonymousObject(descriptor)) {
ResolvedCall<ConstructorDescriptor> delegationCall = getDelegationConstructorCall(bindingContext, primaryConstructor);
KtValueArgumentList argumentList = delegationCall != null ? delegationCall.getCall().getValueArgumentList() : null;
if (argumentList != null) {
argumentList.accept(visitor);
}
}
}
}
private void generateTraitMethods() {
@@ -0,0 +1,17 @@
open class Father(val param: String) {
abstract inner class InClass {
fun work(): String {
return param
}
}
inner class Child(p: String) : Father(p) {
inner class Child2 : Father.InClass {
constructor(): super()
}
}
}
fun box(): String {
return Father("fail").Child("OK").Child2().work()
}
@@ -0,0 +1,17 @@
open class Father(val param: String) {
abstract inner class InClass {
fun work(): String {
return param
}
}
inner class Child(p: String) : Father(p) {
inner class Child2 : Father.InClass() {
}
}
}
fun box(): String {
return Father("fail").Child("OK").Child2().work()
}
@@ -0,0 +1,23 @@
// TARGET_BACKEND: JVM
open class Father(val param: String) {
abstract inner class InClass {
fun work(): String {
return param
}
}
inner class Child(p: String) : Father(p) {
fun test(): InClass {
class Local : Father.InClass() {
}
return Local()
}
}
}
fun box(): String {
return Father("fail").Child("OK").test().work()
}
@@ -7321,18 +7321,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("kt11833_1.kt")
public void testKt11833_1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt11833_1.kt");
doTest(fileName);
}
@TestMetadata("kt11833_2.kt")
public void testKt11833_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt11833_2.kt");
doTest(fileName);
}
@TestMetadata("kt3132.kt")
public void testKt3132() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt3132.kt");
@@ -14347,18 +14335,48 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("innerExtendsInnerViaSecondaryConstuctor.kt")
public void testInnerExtendsInnerViaSecondaryConstuctor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/innerExtendsInnerViaSecondaryConstuctor.kt");
doTest(fileName);
}
@TestMetadata("innerExtendsInnerWithProperOuterCapture.kt")
public void testInnerExtendsInnerWithProperOuterCapture() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/innerExtendsInnerWithProperOuterCapture.kt");
doTest(fileName);
}
@TestMetadata("innerExtendsOuter.kt")
public void testInnerExtendsOuter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/innerExtendsOuter.kt");
doTest(fileName);
}
@TestMetadata("kt11833_1.kt")
public void testKt11833_1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/kt11833_1.kt");
doTest(fileName);
}
@TestMetadata("kt11833_2.kt")
public void testKt11833_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/kt11833_2.kt");
doTest(fileName);
}
@TestMetadata("localClassOuterDiffersFromInnerOuter.kt")
public void testLocalClassOuterDiffersFromInnerOuter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/localClassOuterDiffersFromInnerOuter.kt");
doTest(fileName);
}
@TestMetadata("localExtendsInner.kt")
public void testLocalExtendsInner() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/localExtendsInner.kt");
doTest(fileName);
}
@TestMetadata("localExtendsLocalWithClosure.kt")
public void testLocalExtendsLocalWithClosure() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/superConstructorCall/localExtendsLocalWithClosure.kt");
@@ -107,18 +107,6 @@ public class InnerNestedTestGenerated extends AbstractInnerNestedTest {
doTest(fileName);
}
@TestMetadata("kt11833_1.kt")
public void testKt11833_1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt11833_1.kt");
doTest(fileName);
}
@TestMetadata("kt11833_2.kt")
public void testKt11833_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt11833_2.kt");
doTest(fileName);
}
@TestMetadata("kt3132.kt")
public void testKt3132() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/innerNested/kt3132.kt");