Removed unused code in WritableScopeImpl
This commit is contained in:
@@ -45,8 +45,6 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
||||
|
||||
private var variableOrClassDescriptors: MutableMap<Name, DeclarationDescriptor>? = null
|
||||
|
||||
private var propertyGroups: SetMultimap<Name, VariableDescriptor>? = null
|
||||
|
||||
private var packageAliases: MutableMap<Name, PackageViewDescriptor>? = null
|
||||
|
||||
private var labelsToDescriptors: MutableMap<Name, MutableList<DeclarationDescriptor>>? = null
|
||||
@@ -123,17 +121,9 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
||||
}
|
||||
|
||||
override fun addVariableDescriptor(variableDescriptor: VariableDescriptor) {
|
||||
addVariableDescriptor(variableDescriptor, false)
|
||||
}
|
||||
|
||||
private fun addVariableDescriptor(variableDescriptor: VariableDescriptor, isProperty: Boolean) {
|
||||
checkMayWrite()
|
||||
|
||||
val name = variableDescriptor.getName()
|
||||
if (isProperty) {
|
||||
checkForPropertyRedeclaration(name, variableDescriptor)
|
||||
getPropertyGroups().put(name, variableDescriptor)
|
||||
}
|
||||
if (variableDescriptor.getExtensionReceiverParameter() == null) {
|
||||
checkForRedeclaration(name, variableDescriptor)
|
||||
// TODO : Should this always happen?
|
||||
@@ -146,28 +136,20 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> {
|
||||
checkMayRead()
|
||||
|
||||
val propertyGroupsByName = propertyGroups?.get(name) ?: return workerScope.getProperties(name)
|
||||
return concatInOrder(propertyGroupsByName, workerScope.getProperties(name))
|
||||
return workerScope.getProperties(name)
|
||||
}
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor? {
|
||||
checkMayRead()
|
||||
|
||||
val descriptor = variableOrClassDescriptors?.get(name)
|
||||
if (descriptor is VariableDescriptor && propertyGroups?.get(name)?.contains(descriptor) != true) {
|
||||
if (descriptor is VariableDescriptor) {
|
||||
return descriptor
|
||||
}
|
||||
|
||||
return workerScope.getLocalVariable(name)
|
||||
}
|
||||
|
||||
private fun getPropertyGroups(): SetMultimap<Name, VariableDescriptor> {
|
||||
if (propertyGroups == null) {
|
||||
propertyGroups = LinkedHashMultimap.create()
|
||||
}
|
||||
return propertyGroups!!
|
||||
}
|
||||
|
||||
private fun getFunctionGroups(): SetMultimap<Name, FunctionDescriptor> {
|
||||
if (functionGroups == null) {
|
||||
functionGroups = LinkedHashMultimap.create()
|
||||
@@ -199,19 +181,6 @@ public class WritableScopeImpl(override val workerScope: JetScope,
|
||||
addToDeclared(classifierDescriptor)
|
||||
}
|
||||
|
||||
private fun checkForPropertyRedeclaration(name: Name, variableDescriptor: VariableDescriptor) {
|
||||
val properties = getPropertyGroups()[name]
|
||||
val receiverParameter = variableDescriptor.getExtensionReceiverParameter()
|
||||
for (oldProperty in properties) {
|
||||
val receiverParameterForOldVariable = oldProperty.getExtensionReceiverParameter()
|
||||
if (receiverParameter != null
|
||||
&& receiverParameterForOldVariable != null
|
||||
&& JetTypeChecker.DEFAULT.equalTypes(receiverParameter.getType(), receiverParameterForOldVariable.getType())) {
|
||||
redeclarationHandler.handleRedeclaration(oldProperty, variableDescriptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkForRedeclaration(name: Name, classifierDescriptor: DeclarationDescriptor) {
|
||||
val originalDescriptor = getVariableOrClassDescriptors()[name]
|
||||
if (originalDescriptor != null) {
|
||||
|
||||
Reference in New Issue
Block a user