Drop K(Mutable)Property{0,1,2}Augmented
Also store name in KPropertyImpl, so that calling 'name' on a KProperty instance in the property delegate does not result in unnecessary descriptor computation
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.jvm.internal.*
|
||||
|
||||
internal open class KProperty0Augmented(
|
||||
val reference: PropertyReference0
|
||||
) : KProperty0Impl<Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
|
||||
internal open class KMutableProperty0Augmented(
|
||||
val reference: MutablePropertyReference0
|
||||
) : KMutableProperty0Impl<Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
|
||||
internal open class KProperty1Augmented(
|
||||
val reference: PropertyReference1
|
||||
) : KProperty1Impl<Any?, Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
|
||||
internal open class KMutableProperty1Augmented(
|
||||
val reference: MutablePropertyReference1
|
||||
) : KMutableProperty1Impl<Any?, Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
|
||||
internal open class KProperty2Augmented(
|
||||
val reference: PropertyReference2
|
||||
) : KProperty2Impl<Any?, Any?, Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
|
||||
internal open class KMutableProperty2Augmented(
|
||||
val reference: MutablePropertyReference2
|
||||
) : KMutableProperty2Impl<Any?, Any?, Any?>(reference.owner as KDeclarationContainerImpl, reference.name, reference.signature) {
|
||||
override val name: String get() = reference.name
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import kotlin.reflect.jvm.internal.JvmPropertySignature.*
|
||||
|
||||
internal abstract class KPropertyImpl<out R> private constructor(
|
||||
override val container: KDeclarationContainerImpl,
|
||||
name: String,
|
||||
override val name: String,
|
||||
val signature: String,
|
||||
descriptorInitialValue: PropertyDescriptor?
|
||||
) : KProperty<R>, KCallableImpl<R> {
|
||||
@@ -85,8 +85,6 @@ internal abstract class KPropertyImpl<out R> private constructor(
|
||||
|
||||
override val descriptor: PropertyDescriptor get() = descriptor_()
|
||||
|
||||
override val name: String get() = descriptor.name.asString()
|
||||
|
||||
override val caller: FunctionCaller<*> get() = getter.caller
|
||||
|
||||
override val defaultCaller: FunctionCaller<*>? get() = getter.defaultCaller
|
||||
|
||||
@@ -19,7 +19,6 @@ package kotlin.reflect.jvm.internal;
|
||||
import kotlin.jvm.internal.*;
|
||||
import kotlin.reflect.*;
|
||||
import kotlin.reflect.jvm.ReflectLambdaKt;
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor;
|
||||
|
||||
/**
|
||||
* @suppress
|
||||
@@ -74,31 +73,36 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
||||
|
||||
@Override
|
||||
public KProperty0 property0(PropertyReference0 p) {
|
||||
return new KProperty0Augmented(p);
|
||||
return new KProperty0Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public KMutableProperty0 mutableProperty0(MutablePropertyReference0 p) {
|
||||
return new KMutableProperty0Augmented(p);
|
||||
return new KMutableProperty0Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public KProperty1 property1(PropertyReference1 p) {
|
||||
return new KProperty1Augmented(p);
|
||||
return new KProperty1Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public KMutableProperty1 mutableProperty1(MutablePropertyReference1 p) {
|
||||
return new KMutableProperty1Augmented(p);
|
||||
return new KMutableProperty1Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public KProperty2 property2(PropertyReference2 p) {
|
||||
return new KProperty2Augmented(p);
|
||||
return new KProperty2Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
@Override
|
||||
public KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
||||
return new KMutableProperty2Augmented(p);
|
||||
return new KMutableProperty2Impl(getOwner(p), p.getName(), p.getSignature());
|
||||
}
|
||||
|
||||
private static KDeclarationContainerImpl getOwner(CallableReference reference) {
|
||||
KDeclarationContainer owner = reference.getOwner();
|
||||
return owner instanceof KDeclarationContainerImpl ? ((KDeclarationContainerImpl) owner) : EmptyContainerForLocal.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user