PSI: Extract JetConstructor class

This commit is contained in:
Alexey Sedunov
2015-06-04 15:54:31 +03:00
parent 64ae0c0036
commit 034af9e7f2
7 changed files with 222 additions and 182 deletions
@@ -39,7 +39,7 @@ public class SpecifyTypeExplicitlyIntention : JetSelfTargetingIntention<JetCalla
override fun isApplicableTo(element: JetCallableDeclaration, caretOffset: Int): Boolean {
if (element.getContainingFile() is JetCodeFragment) return false
if (element is JetFunctionLiteral) return false // TODO: should JetFunctionLiteral be JetCallableDeclaration at all?
if (element is JetPrimaryConstructor || element is JetSecondaryConstructor) return false // TODO: base class?
if (element is JetConstructor<*>) return false
if (element.getTypeReference() != null) return false
if (getTypeForDeclaration(element).isError() || hasPublicMemberDiagnostic(element)) return false
@@ -40,7 +40,7 @@ public class ChangeParameterTypeFix extends JetIntentionAction<JetParameter> {
super(element);
this.type = type;
JetNamedDeclaration declaration = PsiTreeUtil.getParentOfType(element, JetNamedDeclaration.class);
isPrimaryConstructorParameter = declaration instanceof JetClass;
isPrimaryConstructorParameter = declaration instanceof JetPrimaryConstructor;
FqName declarationFQName = declaration == null ? null : declaration.getFqName();
containingDeclarationName = declarationFQName == null ? declaration.getName() : declarationFQName.asString();
}