diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt index c7f37b9726f..b6a47866b5f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/scopes/WritableScopeImpl.kt @@ -182,11 +182,11 @@ public class WritableScopeImpl @jvmOverloads constructor( var list = variablesAndClassifiersByName?.get(name) while (list != null) { - val descriptorIndex = list.head + val descriptorIndex = list.last if (descriptorIndex < descriptorLimit) { return descriptorIndex.descriptorByIndex() } - list = list.tail + list = list.prev } return null } @@ -196,10 +196,10 @@ public class WritableScopeImpl @jvmOverloads constructor( var list = functionsByName?.get(name) while (list != null) { - if (list.head < descriptorLimit) { + if (list.last < descriptorLimit) { return list.toDescriptors() } - list = list.tail + list = list.prev } return null } @@ -228,7 +228,7 @@ public class WritableScopeImpl @jvmOverloads constructor( p.println("}") } - private class IntList(val head: Int, val tail: IntList?) + private class IntList(val last: Int, val prev: IntList?) private fun IntList?.plus(value: Int) = IntList(value, this) @@ -236,15 +236,14 @@ public class WritableScopeImpl @jvmOverloads constructor( val result = ArrayList(1) var rest: IntList? = this do { - result.add(rest!!.head.descriptorByIndex() as TDescriptor) - rest = rest.tail + result.add(rest!!.last.descriptorByIndex() as TDescriptor) + rest = rest.prev } while (rest != null) return result } private inner class Snapshot(val descriptorLimit: Int) : JetScope by this@WritableScopeImpl { - override fun getDescriptors(kindFilter: DescriptorKindFilter, - nameFilter: (Name) -> Boolean): Collection { + override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection { checkMayRead() changeLockLevel(WritableScope.LockLevel.READING) diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt index fae1f9a3966..9fa86e94f1a 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/JetScope.kt @@ -49,8 +49,10 @@ public trait JetScope { * All visible descriptors from current scope possibly filtered by the given name and kind filters * (that means that the implementation is not obliged to use the filters but may do so when it gives any performance advantage). */ - public fun getDescriptors(kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL, - nameFilter: (Name) -> Boolean = ALL_NAME_FILTER): Collection + public fun getDescriptors( + kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL, + nameFilter: (Name) -> Boolean = ALL_NAME_FILTER + ): Collection /** * Adds receivers to the list in order of locality, so that the closest (the most local) receiver goes first