Extract JetProperty#hasDelegateExpressionOrInitializer() and use it where appropriate
This commit is contained in:
@@ -248,8 +248,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
}
|
||||
|
||||
private boolean shouldInitializeProperty(@NotNull JetProperty property) {
|
||||
JetExpression initializer = property.getDelegateExpressionOrInitializer();
|
||||
if (initializer == null) return false;
|
||||
if (!property.hasDelegateExpressionOrInitializer()) return false;
|
||||
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) bindingContext.get(VARIABLE, property);
|
||||
assert propertyDescriptor != null;
|
||||
|
||||
@@ -166,6 +166,10 @@ public class JetProperty extends JetTypeParameterListOwnerStub<PsiJetPropertyStu
|
||||
return PsiTreeUtil.getNextSiblingOfType(findChildByType(EQ), JetExpression.class);
|
||||
}
|
||||
|
||||
public boolean hasDelegateExpressionOrInitializer() {
|
||||
return getDelegateExpressionOrInitializer() != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public JetExpression getDelegateExpressionOrInitializer() {
|
||||
JetExpression expression = getDelegateExpression();
|
||||
|
||||
@@ -417,7 +417,7 @@ public class DeclarationsChecker {
|
||||
(setter != null && setter.hasBody());
|
||||
|
||||
if (propertyDescriptor.getModality() == Modality.ABSTRACT) {
|
||||
if (property.getDelegateExpressionOrInitializer() == null && property.getTypeRef() == null) {
|
||||
if (!property.hasDelegateExpressionOrInitializer() && property.getTypeRef() == null) {
|
||||
trace.report(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER.on(property));
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -959,7 +959,7 @@ public class DescriptorResolver {
|
||||
|
||||
/*package*/
|
||||
static boolean hasBody(JetProperty property) {
|
||||
boolean hasBody = property.getDelegateExpressionOrInitializer() != null;
|
||||
boolean hasBody = property.hasDelegateExpressionOrInitializer();
|
||||
if (!hasBody) {
|
||||
JetPropertyAccessor getter = property.getGetter();
|
||||
if (getter != null && getter.hasBody()) {
|
||||
|
||||
Reference in New Issue
Block a user