Modify various usages of old PSI structure of primary ctor
This commit is contained in:
@@ -671,8 +671,10 @@ public class JetFlowInformationProvider {
|
||||
return;
|
||||
}
|
||||
report(Errors.UNUSED_PARAMETER.on((JetParameter) element, variableDescriptor), ctxt);
|
||||
} else if (owner instanceof JetClass) {
|
||||
if (!((JetParameter) element).hasValOrVarNode() && !((JetClass) owner).isAnnotation()) {
|
||||
}
|
||||
else if (owner instanceof JetPrimaryConstructor) {
|
||||
if (!((JetParameter) element).hasValOrVarNode() &&
|
||||
!((JetPrimaryConstructor) owner).getContainingClass().isAnnotation()) {
|
||||
report(Errors.UNUSED_PARAMETER.on((JetParameter) element, variableDescriptor), ctxt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,8 +309,8 @@ public class JetPsiFactory(private val project: Project) {
|
||||
return importDirective.getParent() as JetImportList
|
||||
}
|
||||
|
||||
public fun createPrimaryConstructor(): PsiElement {
|
||||
return createClass("class A()").findElementAt(7)!!.getParent()!!
|
||||
public fun createPrimaryConstructor(): JetPrimaryConstructor {
|
||||
return createClass("class A()").getPrimaryConstructor()!!
|
||||
}
|
||||
|
||||
public fun createClassLabel(labelName: String): JetSimpleNameExpression {
|
||||
|
||||
@@ -451,9 +451,9 @@ public class JetPsiUtil {
|
||||
@Nullable
|
||||
public static JetClass getClassIfParameterIsProperty(@NotNull JetParameter jetParameter) {
|
||||
if (jetParameter.hasValOrVarNode()) {
|
||||
PsiElement parent = jetParameter.getParent();
|
||||
if (parent instanceof JetParameterList && parent.getParent() instanceof JetClass) {
|
||||
return (JetClass) parent.getParent();
|
||||
PsiElement grandParent = jetParameter.getParent().getParent();
|
||||
if (grandParent instanceof JetPrimaryConstructor) {
|
||||
return ((JetPrimaryConstructor) grandParent).getContainingClassOrNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -141,8 +141,8 @@ public class LazyDeclarationResolver {
|
||||
@Override
|
||||
public DeclarationDescriptor visitParameter(@NotNull JetParameter parameter, Void data) {
|
||||
PsiElement grandFather = parameter.getParent().getParent();
|
||||
if (grandFather instanceof JetClass) {
|
||||
JetClass jetClass = (JetClass) grandFather;
|
||||
if (grandFather instanceof JetPrimaryConstructor) {
|
||||
JetClass jetClass = ((JetPrimaryConstructor) grandFather).getContainingClass();
|
||||
// This is a primary constructor parameter
|
||||
ClassDescriptor classDescriptor = getClassDescriptor(jetClass);
|
||||
if (parameter.hasValOrVarNode()) {
|
||||
|
||||
Reference in New Issue
Block a user