Minor changes after review
This commit is contained in:
@@ -182,11 +182,11 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
|||||||
|
|
||||||
var list = variablesAndClassifiersByName?.get(name)
|
var list = variablesAndClassifiersByName?.get(name)
|
||||||
while (list != null) {
|
while (list != null) {
|
||||||
val descriptorIndex = list.head
|
val descriptorIndex = list.last
|
||||||
if (descriptorIndex < descriptorLimit) {
|
if (descriptorIndex < descriptorLimit) {
|
||||||
return descriptorIndex.descriptorByIndex()
|
return descriptorIndex.descriptorByIndex()
|
||||||
}
|
}
|
||||||
list = list.tail
|
list = list.prev
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -196,10 +196,10 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
|||||||
|
|
||||||
var list = functionsByName?.get(name)
|
var list = functionsByName?.get(name)
|
||||||
while (list != null) {
|
while (list != null) {
|
||||||
if (list.head < descriptorLimit) {
|
if (list.last < descriptorLimit) {
|
||||||
return list.toDescriptors<FunctionDescriptor>()
|
return list.toDescriptors<FunctionDescriptor>()
|
||||||
}
|
}
|
||||||
list = list.tail
|
list = list.prev
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
|||||||
p.println("}")
|
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)
|
private fun IntList?.plus(value: Int) = IntList(value, this)
|
||||||
|
|
||||||
@@ -236,15 +236,14 @@ public class WritableScopeImpl @jvmOverloads constructor(
|
|||||||
val result = ArrayList<TDescriptor>(1)
|
val result = ArrayList<TDescriptor>(1)
|
||||||
var rest: IntList? = this
|
var rest: IntList? = this
|
||||||
do {
|
do {
|
||||||
result.add(rest!!.head.descriptorByIndex() as TDescriptor)
|
result.add(rest!!.last.descriptorByIndex() as TDescriptor)
|
||||||
rest = rest.tail
|
rest = rest.prev
|
||||||
} while (rest != null)
|
} while (rest != null)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class Snapshot(val descriptorLimit: Int) : JetScope by this@WritableScopeImpl {
|
private inner class Snapshot(val descriptorLimit: Int) : JetScope by this@WritableScopeImpl {
|
||||||
override fun getDescriptors(kindFilter: DescriptorKindFilter,
|
override fun getDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||||
nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
|
||||||
checkMayRead()
|
checkMayRead()
|
||||||
changeLockLevel(WritableScope.LockLevel.READING)
|
changeLockLevel(WritableScope.LockLevel.READING)
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,10 @@ public trait JetScope {
|
|||||||
* All visible descriptors from current scope possibly filtered by the given name and kind filters
|
* 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).
|
* (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,
|
public fun getDescriptors(
|
||||||
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER): Collection<DeclarationDescriptor>
|
kindFilter: DescriptorKindFilter = DescriptorKindFilter.ALL,
|
||||||
|
nameFilter: (Name) -> Boolean = ALL_NAME_FILTER
|
||||||
|
): Collection<DeclarationDescriptor>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds receivers to the list in order of locality, so that the closest (the most local) receiver goes first
|
* Adds receivers to the list in order of locality, so that the closest (the most local) receiver goes first
|
||||||
|
|||||||
Reference in New Issue
Block a user