Fixed JetSimpleNameReference.getElement(): now it returns expression, not identifier leaf element.
Without it, replacing reference.getElement() with another expression created invalid PSI.
This commit is contained in:
+5
-6
@@ -80,10 +80,9 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
|||||||
|
|
||||||
for (PsiReference reference : ReferencesSearch.search(functionPsi, functionPsi.getUseScope())) {
|
for (PsiReference reference : ReferencesSearch.search(functionPsi, functionPsi.getUseScope())) {
|
||||||
PsiElement element = reference.getElement();
|
PsiElement element = reference.getElement();
|
||||||
PsiElement parent = element.getParent();
|
|
||||||
|
|
||||||
if (parent instanceof JetReferenceExpression) {
|
if (element instanceof JetReferenceExpression) {
|
||||||
parent = parent.getParent();
|
PsiElement parent = element.getParent();
|
||||||
|
|
||||||
if (parent instanceof JetCallExpression)
|
if (parent instanceof JetCallExpression)
|
||||||
result.add(new JetFunctionCallUsage((JetCallExpression) parent, functionPsi, isInherited));
|
result.add(new JetFunctionCallUsage((JetCallExpression) parent, functionPsi, isInherited));
|
||||||
@@ -114,9 +113,9 @@ public class JetChangeSignatureUsageProcessor implements ChangeSignatureUsagePro
|
|||||||
for (PsiReference reference : ReferencesSearch.search(oldParam, oldParam.getUseScope())) {
|
for (PsiReference reference : ReferencesSearch.search(oldParam, oldParam.getUseScope())) {
|
||||||
PsiElement element = reference.getElement();
|
PsiElement element = reference.getElement();
|
||||||
|
|
||||||
if (element.getParent() instanceof JetSimpleNameExpression &&
|
if (element instanceof JetSimpleNameExpression &&
|
||||||
!(element.getParent().getParent() instanceof JetValueArgumentName)) // Usages in named arguments of the calls usage will be changed when the function call is changed
|
!(element.getParent() instanceof JetValueArgumentName)) // Usages in named arguments of the calls usage will be changed when the function call is changed
|
||||||
result.add(new JetParameterUsage((JetSimpleNameExpression) element.getParent(), parameterInfo, functionPsi, isInherited));
|
result.add(new JetParameterUsage((JetSimpleNameExpression) element, parameterInfo, functionPsi, isInherited));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,6 @@ public class JetSimpleNameReference extends JetPsiReference {
|
|||||||
myExpression = jetSimpleNameExpression;
|
myExpression = jetSimpleNameExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public PsiElement getElement() {
|
|
||||||
return myExpression.getReferencedNameElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JetSimpleNameExpression getExpression() {
|
public JetSimpleNameExpression getExpression() {
|
||||||
return myExpression;
|
return myExpression;
|
||||||
|
|||||||
Reference in New Issue
Block a user