mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
Merge pull request #9731 from igfoo/igfoo/private
Kotlin: Make more methods private
This commit is contained in:
@@ -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 ->
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user