Minor optimization
This commit is contained in:
@@ -88,13 +88,6 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLabelsToDescriptors(): MutableMap<Name, MutableList<DeclarationDescriptor>> {
|
|
||||||
if (labelsToDescriptors == null) {
|
|
||||||
labelsToDescriptors = HashMap()
|
|
||||||
}
|
|
||||||
return labelsToDescriptors!!
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> {
|
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> {
|
||||||
checkMayRead()
|
checkMayRead()
|
||||||
|
|
||||||
@@ -107,10 +100,10 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
|||||||
override fun addLabeledDeclaration(descriptor: DeclarationDescriptor) {
|
override fun addLabeledDeclaration(descriptor: DeclarationDescriptor) {
|
||||||
checkMayWrite()
|
checkMayWrite()
|
||||||
|
|
||||||
val labelsToDescriptors = getLabelsToDescriptors()
|
if (labelsToDescriptors == null) {
|
||||||
val name = descriptor.getName()
|
labelsToDescriptors = HashMap()
|
||||||
var declarationDescriptors = labelsToDescriptors.getOrPut(name) { ArrayList() }
|
}
|
||||||
declarationDescriptors.add(descriptor)
|
labelsToDescriptors!!.getOrPut(descriptor.getName()) { ArrayList(1) }.add(descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addVariableOrClassDescriptor(descriptor: DeclarationDescriptor) {
|
private fun addVariableOrClassDescriptor(descriptor: DeclarationDescriptor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user