Make PropertyAccessorDescriptor#hasBody a front-end utility
This commit is contained in:
committed by
Alexander Udalov
parent
ae14d185eb
commit
4553afbd0c
+3
-7
@@ -33,7 +33,7 @@ import java.util.Collections;
|
||||
public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implements AccessorForCallableDescriptor<PropertyDescriptor> {
|
||||
private final PropertyDescriptor calleeDescriptor;
|
||||
private final ClassDescriptor superCallTarget;
|
||||
@NotNull private final String nameSuffix;
|
||||
private final String nameSuffix;
|
||||
private final boolean withSyntheticGetterAccessor;
|
||||
private final boolean withSyntheticSetterAccessor;
|
||||
|
||||
@@ -95,9 +95,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
||||
public static class Getter extends PropertyGetterDescriptorImpl implements AccessorForCallableDescriptor<PropertyGetterDescriptor> {
|
||||
public Getter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||
false, false,
|
||||
/* isExternal = */ false,
|
||||
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
/* isDefault = */ false, /* isExternal = */ false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
initialize(property.getType());
|
||||
}
|
||||
|
||||
@@ -119,9 +117,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
|
||||
public static class Setter extends PropertySetterDescriptorImpl implements AccessorForCallableDescriptor<PropertySetterDescriptor>{
|
||||
public Setter(AccessorForPropertyDescriptor property) {
|
||||
super(property, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
|
||||
false, false,
|
||||
/* isExternal = */ false,
|
||||
Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
/* isDefault = */ false, /* isExternal = */ false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||
initializeDefault();
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class JvmCodegenUtil {
|
||||
if (accessor == null) return true;
|
||||
|
||||
// If the accessor is non-default (i.e. it has some code) we should call that accessor and not use direct access
|
||||
if (accessor.hasBody()) return false;
|
||||
if (DescriptorPsiUtilsKt.hasBody(accessor)) return false;
|
||||
|
||||
// If the accessor is private or final, it can't be overridden in the subclass and thus we can use direct access
|
||||
return Visibilities.isPrivate(property.getVisibility()) || accessor.getModality() == FINAL;
|
||||
|
||||
Reference in New Issue
Block a user