Extract JetProperty#hasInitializer() and use it where appropriate
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ public class ConvertMemberToExtension extends BaseIntentionAction {
|
||||
) {
|
||||
JetCallableDeclaration declaration = getTarget(editor, file);
|
||||
if (declaration instanceof JetProperty) {
|
||||
if (((JetProperty) declaration).getInitializer() != null) return false;
|
||||
if (((JetProperty) declaration).hasInitializer()) return false;
|
||||
}
|
||||
return declaration != null
|
||||
&& declaration.getParent() instanceof JetClassBody
|
||||
|
||||
@@ -42,7 +42,7 @@ public class DeclarationUtils {
|
||||
}
|
||||
|
||||
public static boolean checkSplitProperty(@NotNull JetProperty property) {
|
||||
return property.getInitializer() != null && property.isLocal();
|
||||
return property.hasInitializer() && property.isLocal();
|
||||
}
|
||||
|
||||
public static final Predicate<PsiElement> SKIP_DELIMITERS = new Predicate<PsiElement>() {
|
||||
@@ -68,7 +68,7 @@ public class DeclarationUtils {
|
||||
}
|
||||
|
||||
if (property == null) return null;
|
||||
if (property.getInitializer() != null) return null;
|
||||
if (property.hasInitializer()) return null;
|
||||
if (!JetPsiUtil.isOrdinaryAssignment(initializer)) return null;
|
||||
|
||||
JetBinaryExpression assignment = (JetBinaryExpression) initializer;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RemovePartsFromPropertyFix extends JetIntentionAction<JetProperty>
|
||||
}
|
||||
|
||||
private RemovePartsFromPropertyFix(@NotNull JetProperty element) {
|
||||
this(element, element.getInitializer() != null,
|
||||
this(element, element.hasInitializer(),
|
||||
element.getGetter() != null && element.getGetter().getBodyExpression() != null,
|
||||
element.getSetter() != null && element.getSetter().getBodyExpression() != null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user