diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtProperty.java b/compiler/psi/src/org/jetbrains/kotlin/psi/KtProperty.java index f7ef979e03a..8b048c35e05 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtProperty.java +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtProperty.java @@ -37,7 +37,7 @@ import java.util.Collections; import java.util.List; 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 implements KtVariableDeclaration, PsiModifiableCodeBlock { @@ -195,11 +195,17 @@ public class KtProperty extends KtTypeParameterListOwnerStub if (stub != null) { return stub.hasDelegate(); } + return getDelegate() != null; } @Nullable public KtPropertyDelegate getDelegate() { + KotlinPropertyStub stub = getStub(); + if (stub != null && !stub.hasDelegate()) { + return null; + } + return (KtPropertyDelegate) findChildByType(PROPERTY_DELEGATE); } @@ -208,15 +214,22 @@ public class KtProperty extends KtTypeParameterListOwnerStub if (stub != null) { return stub.hasDelegateExpression(); } + return getDelegateExpression() != null; } @Nullable public KtExpression getDelegateExpression() { + KotlinPropertyStub stub = getStub(); + if (stub != null && !stub.hasDelegateExpression()) { + return null; + } + KtPropertyDelegate delegate = getDelegate(); if (delegate != null) { return delegate.getExpression(); } + return null; }