Introduce PropertyDescriptor.isDelegated, write new flag to metadata
#KT-8384 In Progress
This commit is contained in:
@@ -20013,6 +20013,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
boolean hasFlags();
|
boolean hasFlags();
|
||||||
@@ -20030,6 +20032,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
int getFlags();
|
int getFlags();
|
||||||
@@ -20385,6 +20389,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public boolean hasFlags() {
|
public boolean hasFlags() {
|
||||||
@@ -20404,6 +20410,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public int getFlags() {
|
public int getFlags() {
|
||||||
@@ -21201,6 +21209,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public boolean hasFlags() {
|
public boolean hasFlags() {
|
||||||
@@ -21220,6 +21230,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public int getFlags() {
|
public int getFlags() {
|
||||||
@@ -21239,6 +21251,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Builder setFlags(int value) {
|
public Builder setFlags(int value) {
|
||||||
@@ -21261,6 +21275,8 @@ public final class DebugProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Builder clearFlags() {
|
public Builder clearFlags() {
|
||||||
|
|||||||
+2
-3
@@ -76,9 +76,8 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
|||||||
boolean setterAccessorRequired
|
boolean setterAccessorRequired
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||||
original.isVar(), Name.identifier("access$" + nameSuffix),
|
original.isVar(), Name.identifier("access$" + nameSuffix), Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||||
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
false, false, false, false, false, false);
|
||||||
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false);
|
|
||||||
|
|
||||||
this.calleeDescriptor = original;
|
this.calleeDescriptor = original;
|
||||||
this.superCallTarget = superCallTarget;
|
this.superCallTarget = superCallTarget;
|
||||||
|
|||||||
+2
-1
@@ -280,7 +280,8 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
source: SourceElement
|
source: SourceElement
|
||||||
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false
|
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false,
|
||||||
|
/* isDelegated = */ false
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override var getMethod: FunctionDescriptor by Delegates.notNull()
|
override var getMethod: FunctionDescriptor by Delegates.notNull()
|
||||||
|
|||||||
+3
@@ -83,6 +83,9 @@ public class LocalVariableDescriptor extends VariableDescriptorWithInitializerIm
|
|||||||
return setter;
|
return setter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This override is not deprecated because local variables can only come from sources,
|
||||||
|
// and we can be sure that they won't be recompiled independently
|
||||||
|
@Override
|
||||||
public boolean isDelegated() {
|
public boolean isDelegated() {
|
||||||
return isDelegated;
|
return isDelegated;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -833,7 +833,8 @@ public class DescriptorResolver {
|
|||||||
modifierList != null && modifierList.hasModifier(KtTokens.HEADER_KEYWORD) ||
|
modifierList != null && modifierList.hasModifier(KtTokens.HEADER_KEYWORD) ||
|
||||||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isHeader(),
|
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isHeader(),
|
||||||
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
||||||
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD)
|
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD),
|
||||||
|
property.hasDelegate()
|
||||||
);
|
);
|
||||||
wrapper.setDescriptor(propertyDescriptor);
|
wrapper.setDescriptor(propertyDescriptor);
|
||||||
|
|
||||||
@@ -1161,11 +1162,12 @@ public class DescriptorResolver {
|
|||||||
name,
|
name,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION,
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
KotlinSourceElementKt.toSourceElement(parameter),
|
KotlinSourceElementKt.toSourceElement(parameter),
|
||||||
/* lateInit = */ false,
|
false,
|
||||||
/* isConst = */ false,
|
false,
|
||||||
/* isHeader = */ classDescriptor.isHeader(),
|
classDescriptor.isHeader(),
|
||||||
/* isImpl = */ modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
|
||||||
/* isExternal = */ false
|
false,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
propertyWrapper.setDescriptor(propertyDescriptor);
|
propertyWrapper.setDescriptor(propertyDescriptor);
|
||||||
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ class LocalVariableResolver(
|
|||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isHeader = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false,
|
||||||
|
variable is KtProperty && variable.hasDelegate()
|
||||||
)
|
)
|
||||||
// For a local variable the type must not be deferred
|
// For a local variable the type must not be deferred
|
||||||
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
type = variableTypeAndInitializerResolver.resolveType(propertyDescriptor, scope, variable, dataFlowInfo, trace, local = true)
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
|||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isHeader = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false,
|
||||||
|
/* isDelegated = */ false
|
||||||
)
|
)
|
||||||
propertyDescriptor.setType(
|
propertyDescriptor.setType(
|
||||||
dynamicType,
|
dynamicType,
|
||||||
@@ -230,4 +231,3 @@ fun DeclarationDescriptor.isDynamic(): Boolean {
|
|||||||
val dispatchReceiverParameter = dispatchReceiverParameter
|
val dispatchReceiverParameter = dispatchReceiverParameter
|
||||||
return dispatchReceiverParameter != null && dispatchReceiverParameter.type.isDynamic()
|
return dispatchReceiverParameter != null && dispatchReceiverParameter.type.isDynamic()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ interface JvmDescriptorWithExtraFlags {
|
|||||||
val extraFlags: Int
|
val extraFlags: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
class JvmPropertyDescriptorImpl(
|
class JvmPropertyDescriptorImpl private constructor(
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: DeclarationDescriptor,
|
||||||
original: PropertyDescriptor?,
|
original: PropertyDescriptor?,
|
||||||
annotations: Annotations,
|
annotations: Annotations,
|
||||||
@@ -44,7 +44,7 @@ class JvmPropertyDescriptorImpl(
|
|||||||
isImpl: Boolean
|
isImpl: Boolean
|
||||||
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar,
|
containingDeclaration, original, annotations, modality, visibility, isVar,
|
||||||
name, kind, source, isLateInit, isConst, isHeader, isImpl, /* isExternal = */ false
|
name, kind, source, isLateInit, isConst, isHeader, isImpl, /* isExternal = */ false, false
|
||||||
) {
|
) {
|
||||||
override fun createSubstitutedCopy(
|
override fun createSubstitutedCopy(
|
||||||
newOwner: DeclarationDescriptor,
|
newOwner: DeclarationDescriptor,
|
||||||
|
|||||||
+2
-2
@@ -54,7 +54,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
|||||||
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
|||||||
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(
|
).initialize(
|
||||||
type = builtIns.anyType,
|
type = builtIns.anyType,
|
||||||
dispatchReceiverParameter = genericRefClass.thisAsReceiverParameter
|
dispatchReceiverParameter = genericRefClass.thisAsReceiverParameter
|
||||||
|
|||||||
+1
-1
@@ -129,7 +129,7 @@ class SpecialDescriptorsFactory(
|
|||||||
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
||||||
Name.identifier("INSTANCE"),
|
Name.identifier("INSTANCE"),
|
||||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||||
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false
|
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(objectDescriptor.defaultType)
|
).initialize(objectDescriptor.defaultType)
|
||||||
|
|
||||||
return instanceFieldDescriptor
|
return instanceFieldDescriptor
|
||||||
|
|||||||
+1
@@ -116,6 +116,7 @@ class AssignmentGenerator(statementGenerator: StatementGenerator) : StatementGen
|
|||||||
|
|
||||||
}
|
}
|
||||||
is LocalVariableDescriptor ->
|
is LocalVariableDescriptor ->
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (descriptor.isDelegated)
|
if (descriptor.isDelegated)
|
||||||
DelegatedLocalPropertyLValue(ktLeft.startOffset, ktLeft.endOffset, descriptor, origin)
|
DelegatedLocalPropertyLValue(ktLeft.startOffset, ktLeft.endOffset, descriptor, origin)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ package org.jetbrains.kotlin.psi2ir.generators
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.*
|
import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||||
import org.jetbrains.kotlin.psi.KtElement
|
import org.jetbrains.kotlin.psi.KtElement
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||||
@@ -51,6 +53,7 @@ class CallGenerator(statementGenerator: StatementGenerator): StatementGeneratorE
|
|||||||
descriptor: VariableDescriptor,
|
descriptor: VariableDescriptor,
|
||||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||||
origin: IrStatementOrigin? = null) =
|
origin: IrStatementOrigin? = null) =
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (descriptor is LocalVariableDescriptor && descriptor.isDelegated)
|
if (descriptor is LocalVariableDescriptor && descriptor.isDelegated)
|
||||||
IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, typeArguments, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY)
|
IrCallImpl(startOffset, endOffset, descriptor.type, descriptor.getter!!, typeArguments, origin ?: IrStatementOrigin.GET_LOCAL_PROPERTY)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ abstract class IrDelegateDescriptorBase(
|
|||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isHeader = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false,
|
||||||
|
/* isDelegated = */ true
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
setOutType(delegateType)
|
setOutType(delegateType)
|
||||||
|
|||||||
+2
-1
@@ -188,7 +188,8 @@ class DescriptorSerializer private constructor(
|
|||||||
|
|
||||||
val flags = Flags.getPropertyFlags(
|
val flags = Flags.getPropertyFlags(
|
||||||
hasAnnotations, descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isVar,
|
hasAnnotations, descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isVar,
|
||||||
hasGetter, hasSetter, hasConstant, isConst, lateInit, descriptor.isExternal
|
hasGetter, hasSetter, hasConstant, isConst, lateInit, descriptor.isExternal,
|
||||||
|
@Suppress("DEPRECATION") descriptor.isDelegated
|
||||||
)
|
)
|
||||||
if (flags != builder.flags) {
|
if (flags != builder.flags) {
|
||||||
builder.flags = flags
|
builder.flags = flags
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ import java.util.List;
|
|||||||
public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements JavaCallableMemberDescriptor {
|
public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements JavaCallableMemberDescriptor {
|
||||||
private final boolean isStaticFinal;
|
private final boolean isStaticFinal;
|
||||||
|
|
||||||
protected JavaPropertyDescriptor(
|
private JavaPropertyDescriptor(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Modality modality,
|
@NotNull Modality modality,
|
||||||
@@ -46,7 +46,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
|||||||
boolean isStaticFinal
|
boolean isStaticFinal
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
super(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false);
|
false, false, false, false, false, false);
|
||||||
|
|
||||||
this.isStaticFinal = isStaticFinal;
|
this.isStaticFinal = isStaticFinal;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-3
@@ -16,7 +16,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.descriptors
|
package org.jetbrains.kotlin.descriptors
|
||||||
|
|
||||||
public interface VariableDescriptorWithAccessors : VariableDescriptor {
|
interface VariableDescriptorWithAccessors : VariableDescriptor {
|
||||||
public val getter: VariableAccessorDescriptor?
|
val getter: VariableAccessorDescriptor?
|
||||||
public val setter: VariableAccessorDescriptor?
|
|
||||||
|
val setter: VariableAccessorDescriptor?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Please be careful with this method. Depending on the fact that a property is delegated may be dangerous in the compiler.
|
||||||
|
* Whether or not a property is delegated is neither the API or the ABI of that property, and one should be able to recompile a library
|
||||||
|
* in a way that makes some non-delegated properties delegated or vice versa, without any problems at compilation time or at runtime.
|
||||||
|
*
|
||||||
|
* This flag is needed for reflection however, that's why it's serialized to metadata and is exposed in this interface.
|
||||||
|
*/
|
||||||
|
@Deprecated("Do not call this method in the compiler front-end.")
|
||||||
|
val isDelegated: Boolean
|
||||||
}
|
}
|
||||||
+13
-4
@@ -47,6 +47,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
private final boolean isHeader;
|
private final boolean isHeader;
|
||||||
private final boolean isImpl;
|
private final boolean isImpl;
|
||||||
private final boolean isExternal;
|
private final boolean isExternal;
|
||||||
|
private final boolean isDelegated;
|
||||||
|
|
||||||
private ReceiverParameterDescriptor dispatchReceiverParameter;
|
private ReceiverParameterDescriptor dispatchReceiverParameter;
|
||||||
private ReceiverParameterDescriptor extensionReceiverParameter;
|
private ReceiverParameterDescriptor extensionReceiverParameter;
|
||||||
@@ -69,7 +70,8 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean isHeader,
|
boolean isHeader,
|
||||||
boolean isImpl,
|
boolean isImpl,
|
||||||
boolean isExternal
|
boolean isExternal,
|
||||||
|
boolean isDelegated
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name, null, isVar, source);
|
super(containingDeclaration, annotations, name, null, isVar, source);
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
@@ -81,6 +83,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
this.isHeader = isHeader;
|
this.isHeader = isHeader;
|
||||||
this.isImpl = isImpl;
|
this.isImpl = isImpl;
|
||||||
this.isExternal = isExternal;
|
this.isExternal = isExternal;
|
||||||
|
this.isDelegated = isDelegated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -97,11 +100,12 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean isHeader,
|
boolean isHeader,
|
||||||
boolean isImpl,
|
boolean isImpl,
|
||||||
boolean isExternal
|
boolean isExternal,
|
||||||
|
boolean isDelegated
|
||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
||||||
modality, visibility, isVar, name, kind, source, lateInit, isConst,
|
modality, visibility, isVar, name, kind, source, lateInit, isConst,
|
||||||
isHeader, isImpl, isExternal);
|
isHeader, isImpl, isExternal, isDelegated);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(
|
public void setType(
|
||||||
@@ -209,6 +213,11 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
return isExternal;
|
return isExternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDelegated() {
|
||||||
|
return isDelegated;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<PropertyAccessorDescriptor> getAccessors() {
|
public List<PropertyAccessorDescriptor> getAccessors() {
|
||||||
@@ -353,7 +362,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(
|
return new PropertyDescriptorImpl(
|
||||||
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), getName(), kind, SourceElement.NO_SOURCE,
|
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), getName(), kind, SourceElement.NO_SOURCE,
|
||||||
isLateInit(), isConst(), isHeader(), isImpl(), isExternal()
|
isLateInit(), isConst(), isHeader(), isImpl(), isExternal(), isDelegated()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -379,11 +379,7 @@ public class ErrorUtils {
|
|||||||
Name.special("<ERROR PROPERTY>"),
|
Name.special("<ERROR PROPERTY>"),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION,
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
SourceElement.NO_SOURCE,
|
SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false,
|
false, false, false, false, false, false
|
||||||
/* isConst = */ false,
|
|
||||||
/* isHeader = */ false,
|
|
||||||
/* isImpl = */ false,
|
|
||||||
/* isExternal = */ false
|
|
||||||
);
|
);
|
||||||
descriptor.setType(ERROR_PROPERTY_TYPE,
|
descriptor.setType(ERROR_PROPERTY_TYPE,
|
||||||
Collections.<TypeParameterDescriptor>emptyList(),
|
Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
|
|||||||
@@ -301,6 +301,8 @@ message Property {
|
|||||||
isConst
|
isConst
|
||||||
lateinit
|
lateinit
|
||||||
hasConstant
|
hasConstant
|
||||||
|
isExternal
|
||||||
|
isDelegated
|
||||||
*/
|
*/
|
||||||
optional int32 flags = 11 [default = 518 /* public (6) final property with getter (512) */];
|
optional int32 flags = 11 [default = 518 /* public (6) final property with getter (512) */];
|
||||||
optional int32 old_flags = 1 [default = 2054];
|
optional int32 old_flags = 1 [default = 2054];
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.protobuf.Internal;
|
import org.jetbrains.kotlin.protobuf.Internal;
|
||||||
import org.jetbrains.kotlin.types.KotlinType;
|
|
||||||
|
|
||||||
public class Flags {
|
public class Flags {
|
||||||
private Flags() {}
|
private Flags() {}
|
||||||
@@ -67,6 +66,7 @@ public class Flags {
|
|||||||
public static final BooleanFlagField IS_LATEINIT = FlagField.booleanAfter(IS_CONST);
|
public static final BooleanFlagField IS_LATEINIT = FlagField.booleanAfter(IS_CONST);
|
||||||
public static final BooleanFlagField HAS_CONSTANT = FlagField.booleanAfter(IS_LATEINIT);
|
public static final BooleanFlagField HAS_CONSTANT = FlagField.booleanAfter(IS_LATEINIT);
|
||||||
public static final BooleanFlagField IS_EXTERNAL_PROPERTY = FlagField.booleanAfter(HAS_CONSTANT);
|
public static final BooleanFlagField IS_EXTERNAL_PROPERTY = FlagField.booleanAfter(HAS_CONSTANT);
|
||||||
|
public static final BooleanFlagField IS_DELEGATED = FlagField.booleanAfter(IS_EXTERNAL_PROPERTY);
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
|
|
||||||
@@ -173,7 +173,8 @@ public class Flags {
|
|||||||
boolean hasConstant,
|
boolean hasConstant,
|
||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean lateInit,
|
boolean lateInit,
|
||||||
boolean isExternal
|
boolean isExternal,
|
||||||
|
boolean isDelegated
|
||||||
) {
|
) {
|
||||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||||
| VISIBILITY.toFlags(visibility(visibility))
|
| VISIBILITY.toFlags(visibility(visibility))
|
||||||
@@ -186,6 +187,7 @@ public class Flags {
|
|||||||
| IS_LATEINIT.toFlags(lateInit)
|
| IS_LATEINIT.toFlags(lateInit)
|
||||||
| HAS_CONSTANT.toFlags(hasConstant)
|
| HAS_CONSTANT.toFlags(hasConstant)
|
||||||
| IS_EXTERNAL_PROPERTY.toFlags(isExternal)
|
| IS_EXTERNAL_PROPERTY.toFlags(isExternal)
|
||||||
|
| IS_DELEGATED.toFlags(isDelegated)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15322,6 +15322,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
boolean hasFlags();
|
boolean hasFlags();
|
||||||
@@ -15339,6 +15341,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
int getFlags();
|
int getFlags();
|
||||||
@@ -15664,6 +15668,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public boolean hasFlags() {
|
public boolean hasFlags() {
|
||||||
@@ -15683,6 +15689,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public int getFlags() {
|
public int getFlags() {
|
||||||
@@ -16371,6 +16379,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public boolean hasFlags() {
|
public boolean hasFlags() {
|
||||||
@@ -16390,6 +16400,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public int getFlags() {
|
public int getFlags() {
|
||||||
@@ -16409,6 +16421,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Builder setFlags(int value) {
|
public Builder setFlags(int value) {
|
||||||
@@ -16431,6 +16445,8 @@ public final class ProtoBuf {
|
|||||||
*isConst
|
*isConst
|
||||||
*lateinit
|
*lateinit
|
||||||
*hasConstant
|
*hasConstant
|
||||||
|
*isExternal
|
||||||
|
*isDelegated
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public Builder clearFlags() {
|
public Builder clearFlags() {
|
||||||
|
|||||||
+1
@@ -47,6 +47,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
Flags.IS_LATEINIT.get(flags),
|
Flags.IS_LATEINIT.get(flags),
|
||||||
Flags.IS_CONST.get(flags),
|
Flags.IS_CONST.get(flags),
|
||||||
Flags.IS_EXTERNAL_PROPERTY.get(flags),
|
Flags.IS_EXTERNAL_PROPERTY.get(flags),
|
||||||
|
Flags.IS_DELEGATED.get(flags),
|
||||||
proto,
|
proto,
|
||||||
c.nameResolver,
|
c.nameResolver,
|
||||||
c.typeTable,
|
c.typeTable,
|
||||||
|
|||||||
+3
-1
@@ -105,6 +105,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
isLateInit: Boolean,
|
isLateInit: Boolean,
|
||||||
isConst: Boolean,
|
isConst: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
|
isDelegated: Boolean,
|
||||||
override val proto: ProtoBuf.Property,
|
override val proto: ProtoBuf.Property,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
@@ -113,7 +114,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
) : DeserializedCallableMemberDescriptor,
|
) : DeserializedCallableMemberDescriptor,
|
||||||
PropertyDescriptorImpl(containingDeclaration, original, annotations,
|
PropertyDescriptorImpl(containingDeclaration, original, annotations,
|
||||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false,
|
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false,
|
||||||
isExternal) {
|
isExternal, isDelegated) {
|
||||||
|
|
||||||
override fun createSubstitutedCopy(
|
override fun createSubstitutedCopy(
|
||||||
newOwner: DeclarationDescriptor,
|
newOwner: DeclarationDescriptor,
|
||||||
@@ -124,6 +125,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
): PropertyDescriptorImpl {
|
): PropertyDescriptorImpl {
|
||||||
return DeserializedPropertyDescriptor(
|
return DeserializedPropertyDescriptor(
|
||||||
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst, isExternal,
|
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst, isExternal,
|
||||||
|
@Suppress("DEPRECATION") isDelegated,
|
||||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -105,7 +105,8 @@ private fun genProperty(
|
|||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isHeader = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false
|
/* isExternal = */ false,
|
||||||
|
/* isDelegated = */ false
|
||||||
) {
|
) {
|
||||||
override val errorType = errorType
|
override val errorType = errorType
|
||||||
override val cacheView = cacheView
|
override val cacheView = cacheView
|
||||||
|
|||||||
Reference in New Issue
Block a user