Added 'isInline' implementation to property accessor descriptors
This commit is contained in:
+2
-2
@@ -112,7 +112,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (getter != null) {
|
||||
newGetter = new PropertyGetterDescriptorImpl(
|
||||
enhanced, getter.getAnnotations(), getter.getModality(), getter.getVisibility(),
|
||||
getter.isDefault(), getter.isExternal(), getKind(), getter, getter.getSource()
|
||||
getter.isDefault(), getter.isExternal(), getter.isInline(), getKind(), getter, getter.getSource()
|
||||
);
|
||||
newGetter.setInitialSignatureDescriptor(getter.getInitialSignatureDescriptor());
|
||||
newGetter.initialize(enhancedReturnType);
|
||||
@@ -123,7 +123,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
||||
if (setter != null) {
|
||||
newSetter = new PropertySetterDescriptorImpl(
|
||||
enhanced, setter.getAnnotations(), setter.getModality(), setter.getVisibility(),
|
||||
setter.isDefault(), setter.isExternal(), getKind(), setter, setter.getSource()
|
||||
setter.isDefault(), setter.isExternal(), setter.isInline(), getKind(), setter, setter.getSource()
|
||||
);
|
||||
newSetter.setInitialSignatureDescriptor(newSetter.getInitialSignatureDescriptor());
|
||||
newSetter.initialize(setter.getValueParameters().get(0));
|
||||
|
||||
+2
-2
@@ -444,7 +444,7 @@ class LazyJavaClassMemberScope(
|
||||
|
||||
val getter = DescriptorFactory.createGetter(
|
||||
propertyDescriptor, getterMethod.annotations, /* isDefault = */false,
|
||||
/* isExternal = */ false, getterMethod.source
|
||||
/* isExternal = */ false, /* isInline = */ false, getterMethod.source
|
||||
).apply {
|
||||
initialSignatureDescriptor = getterMethod
|
||||
initialize(propertyDescriptor.type)
|
||||
@@ -452,7 +452,7 @@ class LazyJavaClassMemberScope(
|
||||
|
||||
val setter = setterMethod?.let { setterMethod ->
|
||||
DescriptorFactory.createSetter(propertyDescriptor, setterMethod.annotations, /* isDefault = */false,
|
||||
/* isExternal = */ false, setterMethod.visibility, setterMethod.source
|
||||
/* isExternal = */ false, /* isInline = */ false, setterMethod.visibility, setterMethod.source
|
||||
).apply {
|
||||
initialSignatureDescriptor = setterMethod
|
||||
}
|
||||
|
||||
+4
-1
@@ -33,6 +33,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
private final boolean isExternal;
|
||||
private final Modality modality;
|
||||
private final PropertyDescriptor correspondingProperty;
|
||||
private final boolean isInline;
|
||||
private final Kind kind;
|
||||
private Visibility visibility;
|
||||
@Nullable
|
||||
@@ -46,6 +47,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
@NotNull Name name,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
Kind kind,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
@@ -55,6 +57,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
this.correspondingProperty = correspondingProperty;
|
||||
this.isDefault = isDefault;
|
||||
this.isExternal = isExternal;
|
||||
this.isInline = isInline;
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
||||
|
||||
@Override
|
||||
public boolean isInline() {
|
||||
return false;
|
||||
return isInline;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -260,7 +260,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
|
||||
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
||||
substitutedDescriptor, getter.getAnnotations(), newModality, normalizeVisibility(getter.getVisibility(), kind),
|
||||
getter.isDefault(), getter.isExternal(), kind, original == null ? null : original.getGetter(),
|
||||
getter.isDefault(), getter.isExternal(), getter.isInline(), kind, original == null ? null : original.getGetter(),
|
||||
SourceElement.NO_SOURCE
|
||||
);
|
||||
if (newGetter != null) {
|
||||
@@ -270,7 +270,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
}
|
||||
PropertySetterDescriptorImpl newSetter = setter == null ? null : new PropertySetterDescriptorImpl(
|
||||
substitutedDescriptor, setter.getAnnotations(), newModality, normalizeVisibility(setter.getVisibility(), kind),
|
||||
setter.isDefault(), setter.isExternal(), kind, original == null ? null : original.getSetter(),
|
||||
setter.isDefault(), setter.isExternal(), setter.isInline(), kind, original == null ? null : original.getSetter(),
|
||||
SourceElement.NO_SOURCE
|
||||
);
|
||||
if (newSetter != null) {
|
||||
|
||||
+2
-1
@@ -40,12 +40,13 @@ public class PropertyGetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
@NotNull Visibility visibility,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
@NotNull Kind kind,
|
||||
@Nullable PropertyGetterDescriptor original,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<get-" + correspondingProperty.getName() + ">"),
|
||||
isDefault, isExternal, kind, source);
|
||||
isDefault, isExternal, isInline, kind, source);
|
||||
this.original = original != null ? original : this;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -42,12 +42,13 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
@NotNull Visibility visibility,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
@NotNull Kind kind,
|
||||
@Nullable PropertySetterDescriptor original,
|
||||
@NotNull SourceElement source
|
||||
) {
|
||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<set-" + correspondingProperty.getName() + ">"),
|
||||
isDefault, isExternal, kind, source);
|
||||
isDefault, isExternal, isInline, kind, source);
|
||||
this.original = original != null ? original : this;
|
||||
}
|
||||
|
||||
@@ -107,4 +108,5 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
||||
public PropertySetterDescriptor getOriginal() {
|
||||
return this.original;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, true, false, propertyDescriptor.getSource());
|
||||
return createSetter(propertyDescriptor, annotations, true, false, false, propertyDescriptor.getSource());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -57,9 +57,10 @@ public class DescriptorFactory {
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
@NotNull SourceElement sourceElement
|
||||
) {
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getVisibility(), sourceElement);
|
||||
return createSetter(propertyDescriptor, annotations, isDefault, isExternal, isInline, propertyDescriptor.getVisibility(), sourceElement);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -68,12 +69,13 @@ public class DescriptorFactory {
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
@NotNull Visibility visibility,
|
||||
@NotNull SourceElement sourceElement
|
||||
) {
|
||||
PropertySetterDescriptorImpl setterDescriptor = new PropertySetterDescriptorImpl(
|
||||
propertyDescriptor, annotations, propertyDescriptor.getModality(), visibility, isDefault, isExternal,
|
||||
CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement
|
||||
isInline, CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement
|
||||
);
|
||||
setterDescriptor.initializeDefault();
|
||||
return setterDescriptor;
|
||||
@@ -84,17 +86,7 @@ public class DescriptorFactory {
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations
|
||||
) {
|
||||
return createGetter(propertyDescriptor, annotations, true, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertyGetterDescriptorImpl createGetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal
|
||||
) {
|
||||
return createGetter(propertyDescriptor, annotations, isDefault, isExternal, propertyDescriptor.getSource());
|
||||
return createGetter(propertyDescriptor, annotations, true, false, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -103,11 +95,23 @@ public class DescriptorFactory {
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline
|
||||
) {
|
||||
return createGetter(propertyDescriptor, annotations, isDefault, isExternal, isInline, propertyDescriptor.getSource());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PropertyGetterDescriptorImpl createGetter(
|
||||
@NotNull PropertyDescriptor propertyDescriptor,
|
||||
@NotNull Annotations annotations,
|
||||
boolean isDefault,
|
||||
boolean isExternal,
|
||||
boolean isInline,
|
||||
@NotNull SourceElement sourceElement
|
||||
) {
|
||||
return new PropertyGetterDescriptorImpl(
|
||||
propertyDescriptor, annotations, propertyDescriptor.getModality(), propertyDescriptor.getVisibility(),
|
||||
isDefault, isExternal, CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement
|
||||
isDefault, isExternal, isInline, CallableMemberDescriptor.Kind.DECLARATION, null, sourceElement
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ message Property {
|
||||
Modality
|
||||
isNotDefault
|
||||
isExternal
|
||||
isInline
|
||||
*/
|
||||
optional int32 getter_flags = 7 /* absent => same as property */;
|
||||
optional int32 setter_flags = 8 /* absent => same as property */;
|
||||
|
||||
@@ -73,6 +73,7 @@ public class Flags {
|
||||
|
||||
public static final BooleanFlagField IS_NOT_DEFAULT = FlagField.booleanAfter(MODALITY);
|
||||
public static final BooleanFlagField IS_EXTERNAL_ACCESSOR = FlagField.booleanAfter(IS_NOT_DEFAULT);
|
||||
public static final BooleanFlagField IS_INLINE_ACCESSOR = FlagField.booleanAfter(IS_EXTERNAL_ACCESSOR);
|
||||
|
||||
// ---
|
||||
|
||||
@@ -180,13 +181,15 @@ public class Flags {
|
||||
@NotNull Visibility visibility,
|
||||
@NotNull Modality modality,
|
||||
boolean isNotDefault,
|
||||
boolean isExternal
|
||||
boolean isExternal,
|
||||
boolean isInlineAccessor
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| MODALITY.toFlags(modality(modality))
|
||||
| VISIBILITY.toFlags(visibility(visibility))
|
||||
| IS_NOT_DEFAULT.toFlags(isNotDefault)
|
||||
| IS_EXTERNAL_ACCESSOR.toFlags(isExternal)
|
||||
| IS_INLINE_ACCESSOR.toFlags(isInlineAccessor)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -69,6 +69,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val getterFlags = proto.getterFlags
|
||||
val isNotDefault = proto.hasGetterFlags() && Flags.IS_NOT_DEFAULT.get(getterFlags)
|
||||
val isExternal = proto.hasGetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(getterFlags)
|
||||
val isInline = proto.hasGetterFlags() && Flags.IS_INLINE_ACCESSOR.get(getterFlags)
|
||||
val getter = if (isNotDefault) {
|
||||
PropertyGetterDescriptorImpl(
|
||||
property,
|
||||
@@ -77,6 +78,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Deserialization.visibility(Flags.VISIBILITY.get(getterFlags)),
|
||||
/* isDefault = */ !isNotDefault,
|
||||
/* isExternal = */ isExternal,
|
||||
isInline,
|
||||
property.kind, null, SourceElement.NO_SOURCE
|
||||
)
|
||||
}
|
||||
@@ -94,6 +96,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
val setterFlags = proto.setterFlags
|
||||
val isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags)
|
||||
val isExternal = proto.hasSetterFlags() && Flags.IS_EXTERNAL_ACCESSOR.get(setterFlags)
|
||||
val isInline = proto.hasGetterFlags() && Flags.IS_INLINE_ACCESSOR.get(setterFlags)
|
||||
if (isNotDefault) {
|
||||
val setter = PropertySetterDescriptorImpl(
|
||||
property,
|
||||
@@ -102,6 +105,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Deserialization.visibility(Flags.VISIBILITY.get(setterFlags)),
|
||||
/* isDefault = */ !isNotDefault,
|
||||
/* isExternal = */ isExternal,
|
||||
isInline,
|
||||
property.kind, null, SourceElement.NO_SOURCE
|
||||
)
|
||||
val setterLocal = local.childContext(setter, listOf())
|
||||
|
||||
Reference in New Issue
Block a user