Introduce NoLookupLocation and some new constants to classify LookupLocation.NO_LOCATION usages

This commit is contained in:
Zalim Bashorov
2015-08-17 19:17:23 +03:00
parent e692b7b9c4
commit 0ca9c6fd40
7 changed files with 51 additions and 20 deletions
@@ -105,7 +105,7 @@ abstract class KCallableContainerImpl : DeclarationContainerImpl {
fun findPropertyDescriptor(name: String, signature: String): PropertyDescriptor {
val properties = scope
.getProperties(Name.guess(name))
.getProperties(Name.guess(name), NO_LOCATION_FROM_REFLECTION)
.filter { descriptor ->
descriptor is PropertyDescriptor &&
RuntimeTypeMapper.mapPropertySignature(descriptor).asString() == signature
@@ -123,7 +123,7 @@ abstract class KCallableContainerImpl : DeclarationContainerImpl {
}
fun findFunctionDescriptor(name: String, signature: String): FunctionDescriptor {
val functions = (if (name == "<init>") constructorDescriptors.toList() else scope.getFunctions(Name.guess(name)))
val functions = (if (name == "<init>") constructorDescriptors.toList() else scope.getFunctions(Name.guess(name), NO_LOCATION_FROM_REFLECTION))
.filter { descriptor ->
RuntimeTypeMapper.mapSignature(descriptor).asString() == signature
}
@@ -16,11 +16,14 @@
package kotlin.reflect.jvm.internal
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
import org.jetbrains.kotlin.name.FqName
import kotlin.reflect.IllegalCallableAccessException
internal val PLATFORM_STATIC = FqName("kotlin.platform.platformStatic")
internal val NO_LOCATION_FROM_REFLECTION = NoLookupLocation.create("from reflection")
// TODO: wrap other exceptions
internal inline fun <R> reflectionCall(block: () -> R): R =
try {