Extension callables index and its use in completion

This commit is contained in:
Valentin Kipyatkov
2015-03-30 22:45:14 +03:00
parent 546af84435
commit 5ba5618718
15 changed files with 245 additions and 75 deletions
@@ -98,7 +98,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<KotlinPropertyStu
public JetTypeReference getReceiverTypeReference() {
KotlinPropertyStub stub = getStub();
if (stub != null) {
if (!stub.hasReceiverTypeRef()) {
if (!stub.isExtension()) {
return null;
}
else {
@@ -134,7 +134,7 @@ public class JetProperty extends JetTypeParameterListOwnerStub<KotlinPropertyStu
}
else {
List<JetTypeReference> typeReferences = getStubOrPsiChildrenAsList(JetStubElementTypes.TYPE_REFERENCE);
int returnTypeRefPositionInPsi = stub.hasReceiverTypeRef() ? 1 : 0;
int returnTypeRefPositionInPsi = stub.isExtension() ? 1 : 0;
if (typeReferences.size() <= returnTypeRefPositionInPsi) {
LOG.error("Invalid stub structure built for property:\n" + getText());
return null;
@@ -56,13 +56,10 @@ public trait KotlinAnnotationEntryStub : StubElement<JetAnnotationEntry> {
public fun hasValueArguments(): Boolean
}
public trait KotlinFunctionStub : KotlinStubWithFqName<JetNamedFunction> {
public fun isTopLevel(): Boolean
public fun isExtension(): Boolean
public trait KotlinFunctionStub : KotlinCallableStubBase<JetNamedFunction> {
public fun hasBlockBody(): Boolean
public fun hasBody(): Boolean
public fun hasTypeParameterListBeforeFunctionName(): Boolean
public fun isProbablyNothingType(): Boolean
}
public trait KotlinImportDirectiveStub : StubElement<JetImportDirective> {
@@ -92,14 +89,17 @@ public trait KotlinPropertyAccessorStub : StubElement<JetPropertyAccessor> {
public fun hasBlockBody(): Boolean
}
public trait KotlinPropertyStub : KotlinStubWithFqName<JetProperty> {
public trait KotlinPropertyStub : KotlinCallableStubBase<JetProperty> {
public fun isVar(): Boolean
public fun isTopLevel(): Boolean
public fun hasDelegate(): Boolean
public fun hasDelegateExpression(): Boolean
public fun hasInitializer(): Boolean
public fun hasReceiverTypeRef(): Boolean
public fun hasReturnTypeRef(): Boolean
}
public trait KotlinCallableStubBase<TDeclaration: JetCallableDeclaration> : KotlinStubWithFqName<TDeclaration> {
public fun isTopLevel(): Boolean
public fun isExtension(): Boolean
public fun isProbablyNothingType(): Boolean
}
@@ -61,7 +61,7 @@ public class JetPropertyElementType extends JetStubElementType<KotlinPropertyStu
dataStream.writeBoolean(stub.hasDelegate());
dataStream.writeBoolean(stub.hasDelegateExpression());
dataStream.writeBoolean(stub.hasInitializer());
dataStream.writeBoolean(stub.hasReceiverTypeRef());
dataStream.writeBoolean(stub.isExtension());
dataStream.writeBoolean(stub.hasReturnTypeRef());
dataStream.writeBoolean(stub.isProbablyNothingType());
@@ -32,7 +32,7 @@ public class KotlinPropertyStubImpl(
private val hasDelegate: Boolean,
private val hasDelegateExpression: Boolean,
private val hasInitializer: Boolean,
private val hasReceiverTypeRef: Boolean,
private val isExtension: Boolean,
private val hasReturnTypeRef: Boolean,
private val isProbablyNothingType: Boolean,
private val fqName: FqName?
@@ -53,7 +53,7 @@ public class KotlinPropertyStubImpl(
override fun hasDelegate() = hasDelegate
override fun hasDelegateExpression() = hasDelegateExpression
override fun hasInitializer() = hasInitializer
override fun hasReceiverTypeRef() = hasReceiverTypeRef
override fun isExtension() = isExtension
override fun hasReturnTypeRef() = hasReturnTypeRef
override fun getName() = StringRef.toString(name)
override fun isProbablyNothingType() = isProbablyNothingType