stop calling propertyDelegated() method

This commit is contained in:
Dmitry Jemerov
2015-10-09 13:10:45 +02:00
parent 457e40a0b8
commit ead19076d7
17 changed files with 0 additions and 330 deletions
@@ -39,7 +39,6 @@ import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.BindingTrace;
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage;
@@ -62,7 +61,6 @@ import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYN
import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE;
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.OtherOrigin;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.DiagnosticsPackage.TraitImpl;
import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN;
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
@@ -366,16 +364,6 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
StackValue.Property propValue = codegen.intermediateValueForProperty(propertyDescriptor, true, null, true, StackValue.LOCAL_0);
propValue.store(codegen.gen(initializer), codegen.v);
ResolvedCall<FunctionDescriptor> pdResolvedCall =
bindingContext.get(BindingContext.DELEGATED_PROPERTY_PD_RESOLVED_CALL, propertyDescriptor);
if (pdResolvedCall != null) {
int index = PropertyCodegen.indexOfDelegatedProperty(property);
StackValue lastValue = PropertyCodegen.invokeDelegatedPropertyConventionMethod(
propertyDescriptor, codegen, typeMapper, pdResolvedCall, index, 0
);
lastValue.put(Type.VOID_TYPE, codegen.v);
}
}
private boolean shouldInitializeProperty(@NotNull JetProperty property) {
@@ -1,11 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata, s: String = "is OK") { name = "${p.name} $s" }
}
val prop by Delegate()
fun box(): String {
return if (prop == "prop is OK") "OK" else "fail";
}
@@ -1,13 +0,0 @@
class A {
val prop: String by Delegate()
inner class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,14 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
class A {
val p = Delegate()
val prop by p
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,15 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
fun foo() = Delegate()
class A {
val prop by foo()
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,15 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
val p = Delegate()
class A {
val prop by p
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,14 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: A, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
val A.prop by Delegate()
class A {
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,20 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: F.A, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
class F {
val A.prop by Delegate()
class A {
}
fun foo(): String {
return A().prop
}
}
fun box(): String {
return if (F().foo() == "prop") "OK" else "fail"
}
@@ -1,17 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
interface A {
val prop: String
}
class AImpl: A {
override val prop by Delegate()
}
fun box(): String {
return if(AImpl().prop == "prop") "OK" else "fail"
}
@@ -1,17 +0,0 @@
class Delegate {
var inner = "OK"
fun getValue(t: Any?, p: PropertyMetadata): String = inner
private fun propertyDelegated(p: PropertyMetadata) { inner = "fail" }
fun propertyDelegated() { inner = "fail" }
fun propertyDelegated(a: Int) { inner = "fail" }
fun propertyDelegated(a: String) { inner = "fail" }
fun propertyDelegated(p: PropertyMetadata, a: Int) { inner = "fail" }
fun <T> propertyDelegated(p: PropertyMetadata, s: String = "") { inner = "fail" }
}
val prop by Delegate()
fun box(): String {
return prop
}
@@ -1,14 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
}
fun Delegate.propertyDelegated(p: PropertyMetadata) { name = p.name }
class A {
val prop by Delegate()
}
fun box(): String {
return if (A().prop == "prop") "OK" else "fail"
}
@@ -1,17 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
class A {
private val prop by Delegate()
fun test(): String {
return if (prop == "prop") "OK" else "fail"
}
}
fun box(): String {
return A().test()
}
@@ -1,11 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
val prop by Delegate()
fun box(): String {
return if (prop == "prop") "OK" else "fail"
}
@@ -1,14 +0,0 @@
class Delegate {
var count = 0
fun getValue(t: Any?, p: PropertyMetadata) {}
fun propertyDelegated(vararg p: PropertyMetadata) { count++ }
}
val delegate = Delegate()
val prop1 by delegate
val prop2 by delegate
fun box(): String {
return if(delegate.count == 2) "OK" else "fail"
}
@@ -1,16 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(p: PropertyMetadata) { name = p.name }
}
class A {
inner class B {
val prop by Delegate()
}
}
fun box(): String {
val p = A().B().prop
return if(p == "prop") "OK" else "fail"
}
@@ -1,11 +0,0 @@
class Delegate {
var name = ""
fun getValue(t: Any?, p: PropertyMetadata): String = name
fun propertyDelegated(vararg p: PropertyMetadata) { name = p[0].name }
}
val prop by Delegate()
fun box(): String {
return if (prop == "prop") "OK" else "fail"
}
@@ -3018,105 +3018,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/vararg.kt");
doTest(fileName);
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class PropertyDelegatedMethod extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInPropertyDelegatedMethod() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("defaultArgs.kt")
public void testDefaultArgs() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/defaultArgs.kt");
doTest(fileName);
}
@TestMetadata("delegateAsInnerClass.kt")
public void testDelegateAsInnerClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateAsInnerClass.kt");
doTest(fileName);
}
@TestMetadata("delegateByOtherProperty.kt")
public void testDelegateByOtherProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateByOtherProperty.kt");
doTest(fileName);
}
@TestMetadata("delegateByTopLevelFun.kt")
public void testDelegateByTopLevelFun() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateByTopLevelFun.kt");
doTest(fileName);
}
@TestMetadata("delegateByTopLevelProperty.kt")
public void testDelegateByTopLevelProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateByTopLevelProperty.kt");
doTest(fileName);
}
@TestMetadata("delegateForExtProperty.kt")
public void testDelegateForExtProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateForExtProperty.kt");
doTest(fileName);
}
@TestMetadata("delegateForExtPropertyInClass.kt")
public void testDelegateForExtPropertyInClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/delegateForExtPropertyInClass.kt");
doTest(fileName);
}
@TestMetadata("inTrait.kt")
public void testInTrait() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/inTrait.kt");
doTest(fileName);
}
@TestMetadata("noneApplicable.kt")
public void testNoneApplicable() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/noneApplicable.kt");
doTest(fileName);
}
@TestMetadata("pdAsExtensionFun.kt")
public void testPdAsExtensionFun() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/pdAsExtensionFun.kt");
doTest(fileName);
}
@TestMetadata("privateProperty.kt")
public void testPrivateProperty() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/privateProperty.kt");
doTest(fileName);
}
@TestMetadata("topLevel.kt")
public void testTopLevel() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/topLevel.kt");
doTest(fileName);
}
@TestMetadata("twoPropsByOneDelegate.kt")
public void testTwoPropsByOneDelegate() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/twoPropsByOneDelegate.kt");
doTest(fileName);
}
@TestMetadata("valInInnerClass.kt")
public void testValInInnerClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/valInInnerClass.kt");
doTest(fileName);
}
@TestMetadata("vararg.kt")
public void testVararg() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/vararg.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/codegen/box/diagnostics")