Renamed methods in MemberScope from getSmth to getContributedSmth

This commit is contained in:
Stanislav Erokhin
2015-11-04 14:46:59 +03:00
parent 6f9d9759ce
commit 2c3f58eeb7
104 changed files with 289 additions and 288 deletions
@@ -37,7 +37,7 @@ import java.util.*
public object SamConversionResolverImpl : SamConversionResolver {
override fun resolveSamConstructor(name: Name, scope: MemberScope, location: LookupLocation): SamConstructorDescriptor? {
val classifier = scope.getClassifier(name, location) as? LazyJavaClassDescriptor ?: return null
val classifier = scope.getContributedClassifier(name, location) as? LazyJavaClassDescriptor ?: return null
if (classifier.getFunctionTypeForSamInterface() == null) return null
return SingleAbstractMethodUtils.createSamConstructorFunction(scope.getContainingDeclaration(), classifier)
}
@@ -305,7 +305,7 @@ public class SignaturesPropagationData {
Name name = method.getName();
JvmMethodSignature autoSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(autoMethodDescriptor);
for (KotlinType supertype : containingClass.getTypeConstructor().getSupertypes()) {
Collection<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS);
Collection<FunctionDescriptor> superFunctionCandidates = supertype.getMemberScope().getContributedFunctions(name, NoLookupLocation.WHEN_GET_SUPER_MEMBERS);
for (FunctionDescriptor candidate : superFunctionCandidates) {
JvmMethodSignature candidateSignature = SIGNATURE_MAPPER.mapToJvmMethodSignature(candidate);
if (KotlinToJvmSignatureMapperKt.erasedSignaturesEqualIgnoringReturnTypes(autoSignature, candidateSignature)) {
@@ -51,7 +51,7 @@ private val DEFAULT_IMPORTS_FOR_JVM = ArrayList<ImportPath>().apply {
add(ImportPath("kotlin.io.*"))
fun addAllClassifiersFromScope(scope: MemberScope) {
for (descriptor in scope.getDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.ALL_NAME_FILTER)) {
for (descriptor in scope.getContributedDescriptors(DescriptorKindFilter.CLASSIFIERS, MemberScope.ALL_NAME_FILTER)) {
add(ImportPath(DescriptorUtils.getFqNameSafe(descriptor), false))
}
}
@@ -111,14 +111,14 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
val possibleGetMethodNames = possibleGetMethodNames(name)
val getMethod = possibleGetMethodNames
.flatMap { memberScope.getFunctions(it, NoLookupLocation.FROM_SYNTHETIC_SCOPE) }
.flatMap { memberScope.getContributedFunctions(it, NoLookupLocation.FROM_SYNTHETIC_SCOPE) }
.singleOrNull {
isGoodGetMethod(it) && it.hasJavaOriginInHierarchy()
} ?: return result(null, possibleGetMethodNames)
val setMethodName = setMethodName(getMethod.name)
val setMethod = memberScope.getFunctions(setMethodName, NoLookupLocation.FROM_SYNTHETIC_SCOPE)
val setMethod = memberScope.getContributedFunctions(setMethodName, NoLookupLocation.FROM_SYNTHETIC_SCOPE)
.singleOrNull { isGoodSetMethod(it, getMethod) }
val propertyType = getMethod.returnType!!
@@ -203,7 +203,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
val classifier = type.declarationDescriptor
if (classifier is ClassDescriptor) {
for (descriptor in classifier.getUnsubstitutedMemberScope().getDescriptors(DescriptorKindFilter.FUNCTIONS)) {
for (descriptor in classifier.getUnsubstitutedMemberScope().getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)) {
if (descriptor is FunctionDescriptor) {
val propertyName = SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(descriptor.getName()) ?: continue
addIfNotNull(syntheticPropertyInClass(Pair(classifier, propertyName)).descriptor)
@@ -57,7 +57,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
override fun getContributedSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>, name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
var result: SmartList<FunctionDescriptor>? = null
for (type in receiverTypes) {
for (function in type.memberScope.getFunctions(name, location)) {
for (function in type.memberScope.getContributedFunctions(name, location)) {
val extension = extensionForFunction(function.original)
if (extension != null) {
if (result == null) {
@@ -76,7 +76,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : BaseImportingSc
override fun getContributedSyntheticExtensionFunctions(receiverTypes: Collection<KotlinType>): Collection<FunctionDescriptor> {
return receiverTypes.flatMapTo(LinkedHashSet<FunctionDescriptor>()) { type ->
type.memberScope.getDescriptors(DescriptorKindFilter.FUNCTIONS)
type.memberScope.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS)
.filterIsInstance<FunctionDescriptor>()
.map { extensionForFunction(it.original) }
.filterNotNull()