Merge pull request #9731 from igfoo/igfoo/private

Kotlin: Make more methods private
This commit is contained in:
Ian Lynagh
2022-06-29 11:24:33 +01:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ private val specialFunctions = mapOf(
private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet() private val specialFunctionShortNames = specialFunctions.keys.map { it.functionName }.toSet()
fun getSpecialJvmName(f: IrFunction): String? { private fun getSpecialJvmName(f: IrFunction): String? {
if (specialFunctionShortNames.contains(f.name) && f is IrSimpleFunction) { if (specialFunctionShortNames.contains(f.name) && f is IrSimpleFunction) {
f.allOverridden(true).forEach { overriddenFunc -> f.allOverridden(true).forEach { overriddenFunc ->
overriddenFunc.parentClassOrNull?.fqNameWhenAvailable?.let { parentFqName -> overriddenFunc.parentClassOrNull?.fqNameWhenAvailable?.let { parentFqName ->
@@ -87,4 +87,4 @@ fun getJvmName(container: IrAnnotationContainer): String? {
} }
} }
return (container as? IrFunction)?.let { getSpecialJvmName(container) } return (container as? IrFunction)?.let { getSpecialJvmName(container) }
} }

View File

@@ -37,7 +37,7 @@ fun IrType.substituteTypeArguments(params: List<IrTypeParameter>, arguments: Lis
else -> this else -> this
} }
fun IrSimpleType.substituteTypeArguments(substitutionMap: Map<IrTypeParameterSymbol, IrTypeArgument>): IrSimpleType { private fun IrSimpleType.substituteTypeArguments(substitutionMap: Map<IrTypeParameterSymbol, IrTypeArgument>): IrSimpleType {
if (substitutionMap.isEmpty()) return this if (substitutionMap.isEmpty()) return this
val newArguments = arguments.map { val newArguments = arguments.map {
@@ -100,7 +100,7 @@ private fun subProjectedType(substitutionMap: Map<IrTypeParameterSymbol, IrTypeA
} }
} ?: makeTypeProjection(t.substituteTypeArguments(substitutionMap), outerVariance) } ?: makeTypeProjection(t.substituteTypeArguments(substitutionMap), outerVariance)
fun IrTypeArgument.upperBound(context: IrPluginContext) = private fun IrTypeArgument.upperBound(context: IrPluginContext) =
when(this) { when(this) {
is IrStarProjection -> context.irBuiltIns.anyNType is IrStarProjection -> context.irBuiltIns.anyNType
is IrTypeProjection -> when(this.variance) { is IrTypeProjection -> when(this.variance) {
@@ -111,7 +111,7 @@ fun IrTypeArgument.upperBound(context: IrPluginContext) =
else -> context.irBuiltIns.anyNType else -> context.irBuiltIns.anyNType
} }
fun IrTypeArgument.lowerBound(context: IrPluginContext) = private fun IrTypeArgument.lowerBound(context: IrPluginContext) =
when(this) { when(this) {
is IrStarProjection -> context.irBuiltIns.nothingType is IrStarProjection -> context.irBuiltIns.nothingType
is IrTypeProjection -> when(this.variance) { is IrTypeProjection -> when(this.variance) {
@@ -200,7 +200,7 @@ fun IrTypeArgument.withQuestionMark(b: Boolean): IrTypeArgument =
typealias TypeSubstitution = (IrType, KotlinUsesExtractor.TypeContext, IrPluginContext) -> IrType typealias TypeSubstitution = (IrType, KotlinUsesExtractor.TypeContext, IrPluginContext) -> IrType
fun matchingTypeParameters(l: IrTypeParameter?, r: IrTypeParameter): Boolean { private fun matchingTypeParameters(l: IrTypeParameter?, r: IrTypeParameter): Boolean {
if (l === r) if (l === r)
return true return true
if (l == null) if (l == null)