Wide visibility in ir common stuff

This commit is contained in:
Mikhael Bogdanov
2017-08-08 13:04:32 +02:00
parent ca418c727e
commit 6305abdf9f
4 changed files with 11 additions and 11 deletions
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.types.TypeSubstitutor
import org.jetbrains.kotlin.types.Variance import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.types.typeUtil.makeNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable
internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor, class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
val context: CommonBackendContext) { val context: CommonBackendContext) {
private val descriptorSubstituteMap: MutableMap<DeclarationDescriptor, DeclarationDescriptor> = mutableMapOf() private val descriptorSubstituteMap: MutableMap<DeclarationDescriptor, DeclarationDescriptor> = mutableMapOf()
@@ -553,9 +553,9 @@ internal class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescr
} }
internal class SubstitutedDescriptor(val inlinedFunction: FunctionDescriptor, val descriptor: DeclarationDescriptor) class SubstitutedDescriptor(val inlinedFunction: FunctionDescriptor, val descriptor: DeclarationDescriptor)
internal class DescriptorSubstitutorForExternalScope(val globalSubstituteMap: MutableMap<DeclarationDescriptor, SubstitutedDescriptor>) class DescriptorSubstitutorForExternalScope(val globalSubstituteMap: MutableMap<DeclarationDescriptor, SubstitutedDescriptor>)
: IrElementTransformerVoidWithContext() { : IrElementTransformerVoidWithContext() {
override fun visitCall(expression: IrCall): IrExpression { override fun visitCall(expression: IrCall): IrExpression {
@@ -28,10 +28,10 @@ abstract class Ir<out T: CommonBackendContext>(val context: T, val irModule: IrM
abstract class Symbols<out T: CommonBackendContext>(val context: T, private val symbolTable: SymbolTable) { abstract class Symbols<out T: CommonBackendContext>(val context: T, private val symbolTable: SymbolTable) {
private val builtIns protected val builtIns
get() = context.builtIns get() = context.builtIns
private fun builtInsPackage(vararg packageNameSegments: String) = protected fun builtInsPackage(vararg packageNameSegments: String) =
context.builtIns.builtInsModule.getPackage(FqName.fromSegments(listOf(*packageNameSegments))).memberScope context.builtIns.builtInsModule.getPackage(FqName.fromSegments(listOf(*packageNameSegments))).memberScope
val refClass = symbolTable.referenceClass(context.getInternalClass("Ref")) val refClass = symbolTable.referenceClass(context.getInternalClass("Ref"))
@@ -121,7 +121,7 @@ abstract class Symbols<out T: CommonBackendContext>(val context: T, private val
} }
private val arrayTypes = arrayOf( protected val arrayTypes = arrayOf(
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BYTE), builtIns.getPrimitiveArrayKotlinType(PrimitiveType.BYTE),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.CHAR), builtIns.getPrimitiveArrayKotlinType(PrimitiveType.CHAR),
builtIns.getPrimitiveArrayKotlinType(PrimitiveType.SHORT), builtIns.getPrimitiveArrayKotlinType(PrimitiveType.SHORT),
@@ -65,7 +65,7 @@ fun DeclarationDescriptor.createFakeOverrideDescriptor(owner: ClassDescriptor):
} }
} }
internal fun FunctionDescriptor.createOverriddenDescriptor(owner: ClassDescriptor, final: Boolean = true): FunctionDescriptor { fun FunctionDescriptor.createOverriddenDescriptor(owner: ClassDescriptor, final: Boolean = true): FunctionDescriptor {
return this.newCopyBuilder() return this.newCopyBuilder()
.setOwner(owner) .setOwner(owner)
.setCopyOverrides(true) .setCopyOverrides(true)
@@ -76,7 +76,7 @@ internal fun FunctionDescriptor.createOverriddenDescriptor(owner: ClassDescripto
} }
} }
internal fun ClassDescriptor.createSimpleDelegatingConstructorDescriptor(superConstructorDescriptor: ClassConstructorDescriptor, isPrimary: Boolean = false) fun ClassDescriptor.createSimpleDelegatingConstructorDescriptor(superConstructorDescriptor: ClassConstructorDescriptor, isPrimary: Boolean = false)
: ClassConstructorDescriptor { : ClassConstructorDescriptor {
val constructorDescriptor = ClassConstructorDescriptorImpl.createSynthesized( val constructorDescriptor = ClassConstructorDescriptorImpl.createSynthesized(
/* containingDeclaration = */ this, /* containingDeclaration = */ this,
@@ -91,7 +91,7 @@ internal fun ClassDescriptor.createSimpleDelegatingConstructorDescriptor(superCo
return constructorDescriptor return constructorDescriptor
} }
internal fun IrClass.addSimpleDelegatingConstructor(superConstructorSymbol: IrConstructorSymbol, fun IrClass.addSimpleDelegatingConstructor(superConstructorSymbol: IrConstructorSymbol,
constructorDescriptor: ClassConstructorDescriptor, constructorDescriptor: ClassConstructorDescriptor,
origin: IrDeclarationOrigin) origin: IrDeclarationOrigin)
: IrConstructor { : IrConstructor {
@@ -117,7 +117,7 @@ internal fun IrClass.addSimpleDelegatingConstructor(superConstructorSymbol: IrCo
} }
} }
internal fun CommonBackendContext.createArrayOfExpression(arrayElementType: KotlinType, fun CommonBackendContext.createArrayOfExpression(arrayElementType: KotlinType,
arrayElements: List<IrExpression>, arrayElements: List<IrExpression>,
startOffset: Int, endOffset: Int): IrExpression { startOffset: Int, endOffset: Int): IrExpression {
@@ -41,7 +41,7 @@ import org.jetbrains.kotlin.types.KotlinType
/** /**
* This lowering pass replaces [IrStringConcatenation]s with StringBuilder appends. * This lowering pass replaces [IrStringConcatenation]s with StringBuilder appends.
*/ */
internal class StringConcatenationLowering(val context: CommonBackendContext) : FileLoweringPass { class StringConcatenationLowering(val context: CommonBackendContext) : FileLoweringPass {
override fun lower(irFile: IrFile) { override fun lower(irFile: IrFile) {
irFile.transformChildrenVoid(StringConcatenationTransformer(this)) irFile.transformChildrenVoid(StringConcatenationTransformer(this))
} }