Minor refactor and fix in Scope constructors

This commit is contained in:
Dmitry Petrov
2017-04-26 16:32:41 +03:00
parent 54294eaaa7
commit acefd0d891
@@ -37,9 +37,7 @@ class Scope(val scopeOwnerSymbol: IrSymbol) {
val scopeOwner: DeclarationDescriptor get() = scopeOwnerSymbol.descriptor val scopeOwner: DeclarationDescriptor get() = scopeOwnerSymbol.descriptor
@Deprecated("Creates unbound symbol") @Deprecated("Creates unbound symbol")
constructor(scopeOwner: ClassDescriptor) : this(IrClassSymbolImpl(scopeOwner)) constructor(descriptor: DeclarationDescriptor): this(createSymbolForScopeOwner(descriptor))
@Deprecated("C")
private var lastTemporaryIndex: Int = 0 private var lastTemporaryIndex: Int = 0
private fun nextTemporaryIndex(): Int = lastTemporaryIndex++ private fun nextTemporaryIndex(): Int = lastTemporaryIndex++
@@ -60,11 +58,12 @@ class Scope(val scopeOwnerSymbol: IrSymbol) {
) )
} }
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("Creates unbound symbol") @Deprecated("Creates unbound symbol")
fun Scope(descriptor: DeclarationDescriptor) = fun createSymbolForScopeOwner(descriptor: DeclarationDescriptor) =
when (descriptor) { when (descriptor) {
is ClassDescriptor -> Scope(IrClassSymbolImpl(descriptor)) is ClassDescriptor -> IrClassSymbolImpl(descriptor)
is FunctionDescriptor -> Scope(createFunctionSymbol(descriptor)) is FunctionDescriptor -> createFunctionSymbol(descriptor)
is PropertyDescriptor -> Scope(IrFieldSymbolImpl(descriptor)) is PropertyDescriptor -> IrFieldSymbolImpl(descriptor)
else -> throw AssertionError("Unexpected scopeOwner descriptor: $descriptor") else -> throw AssertionError("Unexpected scopeOwner descriptor: $descriptor")
} }