[groovy] push #getTextSkipWhiteSpaceAndComments() down to GrCodeReferenceElementImpl

This commit is contained in:
Daniil Ovchinnikov
2018-10-02 19:49:43 +03:00
parent 8f13e965b1
commit 87a6cff826
2 changed files with 16 additions and 10 deletions
@@ -22,7 +22,6 @@ public abstract class GrReferenceElementImpl<Q extends PsiElement> extends Groov
private static final String DUMMY_FQN = "05ab655a-0e15-4f35-909d-9dff5e757f63";
private volatile String myQualifiedReferenceName = DUMMY_FQN;
private volatile String myCachedTextSkipWhiteSpaceAndComments;
public GrReferenceElementImpl(@NotNull ASTNode node) {
super(node);
@@ -31,7 +30,6 @@ public abstract class GrReferenceElementImpl<Q extends PsiElement> extends Groov
@Override
public void subtreeChanged() {
myQualifiedReferenceName = DUMMY_FQN;
myCachedTextSkipWhiteSpaceAndComments = null;
super.subtreeChanged();
}
@@ -175,14 +173,6 @@ public abstract class GrReferenceElementImpl<Q extends PsiElement> extends Groov
PsiImplUtil.setQualifier(this, newQualifier);
}
public String getTextSkipWhiteSpaceAndComments() {
String whiteSpaceAndComments = myCachedTextSkipWhiteSpaceAndComments;
if (whiteSpaceAndComments == null) {
myCachedTextSkipWhiteSpaceAndComments = whiteSpaceAndComments = PsiImplUtil.getTextSkipWhiteSpaceAndComments(getNode());
}
return whiteSpaceAndComments;
}
@Override
public boolean isQualified() {
return getQualifier() != null;
@@ -39,6 +39,22 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl<GrCodeRef
super(node);
}
private volatile String myCachedTextSkipWhiteSpaceAndComments;
@Override
public void subtreeChanged() {
myCachedTextSkipWhiteSpaceAndComments = null;
super.subtreeChanged();
}
private String getTextSkipWhiteSpaceAndComments() {
String whiteSpaceAndComments = myCachedTextSkipWhiteSpaceAndComments;
if (whiteSpaceAndComments == null) {
myCachedTextSkipWhiteSpaceAndComments = whiteSpaceAndComments = PsiImplUtil.getTextSkipWhiteSpaceAndComments(getNode());
}
return whiteSpaceAndComments;
}
@Override
public PsiReference getReference() {
return this;