Use stubs in KtProperty for getDelegate() and getDelegateExpression()
This commit is contained in:
@@ -37,7 +37,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.KtNodeTypes.PROPERTY_DELEGATE;
|
import static org.jetbrains.kotlin.KtNodeTypes.PROPERTY_DELEGATE;
|
||||||
import static org.jetbrains.kotlin.lexer.KtTokens.*;
|
import static org.jetbrains.kotlin.lexer.KtTokens.EQ;
|
||||||
|
|
||||||
public class KtProperty extends KtTypeParameterListOwnerStub<KotlinPropertyStub>
|
public class KtProperty extends KtTypeParameterListOwnerStub<KotlinPropertyStub>
|
||||||
implements KtVariableDeclaration, PsiModifiableCodeBlock {
|
implements KtVariableDeclaration, PsiModifiableCodeBlock {
|
||||||
@@ -195,11 +195,17 @@ public class KtProperty extends KtTypeParameterListOwnerStub<KotlinPropertyStub>
|
|||||||
if (stub != null) {
|
if (stub != null) {
|
||||||
return stub.hasDelegate();
|
return stub.hasDelegate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDelegate() != null;
|
return getDelegate() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public KtPropertyDelegate getDelegate() {
|
public KtPropertyDelegate getDelegate() {
|
||||||
|
KotlinPropertyStub stub = getStub();
|
||||||
|
if (stub != null && !stub.hasDelegate()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (KtPropertyDelegate) findChildByType(PROPERTY_DELEGATE);
|
return (KtPropertyDelegate) findChildByType(PROPERTY_DELEGATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,15 +214,22 @@ public class KtProperty extends KtTypeParameterListOwnerStub<KotlinPropertyStub>
|
|||||||
if (stub != null) {
|
if (stub != null) {
|
||||||
return stub.hasDelegateExpression();
|
return stub.hasDelegateExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDelegateExpression() != null;
|
return getDelegateExpression() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public KtExpression getDelegateExpression() {
|
public KtExpression getDelegateExpression() {
|
||||||
|
KotlinPropertyStub stub = getStub();
|
||||||
|
if (stub != null && !stub.hasDelegateExpression()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
KtPropertyDelegate delegate = getDelegate();
|
KtPropertyDelegate delegate = getDelegate();
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
return delegate.getExpression();
|
return delegate.getExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user