mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Kotlin: Use variable names more consistently
This commit is contained in:
@@ -412,7 +412,7 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
|
||||
// add method:
|
||||
val obinitLabel = getFunctionLabel(c, "<obinit>", listOf(), pluginContext.irBuiltIns.unitType, extensionReceiverParameter = null, functionTypeParameters = listOf(), classTypeArguments = listOf())
|
||||
val obinitLabel = getFunctionLabel(c, "<obinit>", listOf(), pluginContext.irBuiltIns.unitType, extensionReceiverParameter = null, functionTypeParameters = listOf(), classTypeArgsIncludingOuterClasses = listOf())
|
||||
val obinitId = tw.getLabelFor<DbMethod>(obinitLabel)
|
||||
val returnType = useType(pluginContext.irBuiltIns.unitType)
|
||||
tw.writeMethods(obinitId, "<obinit>", "<obinit>()", returnType.javaResult.id, returnType.kotlinResult.id, parentId, obinitId)
|
||||
@@ -1561,7 +1561,7 @@ open class KotlinFileExtractor(
|
||||
val id = tw.getFreshIdLabel<DbMethodaccess>()
|
||||
val type = useType(e.type)
|
||||
val locId = tw.getLocation(e)
|
||||
val methodLabel = getFunctionLabel(irCallable.parent, "<obinit>", listOf(), e.type, null, functionTypeParameters = listOf(), classTypeArguments = listOf())
|
||||
val methodLabel = getFunctionLabel(irCallable.parent, "<obinit>", listOf(), e.type, null, functionTypeParameters = listOf(), classTypeArgsIncludingOuterClasses = listOf())
|
||||
val methodId = tw.getLabelFor<DbMethod>(methodLabel)
|
||||
tw.writeExprs_methodaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
|
||||
tw.writeHasLocation(id, locId)
|
||||
|
||||
@@ -627,8 +627,8 @@ class X {
|
||||
else -> listOf()
|
||||
}
|
||||
|
||||
fun getFunctionLabel(f: IrFunction, classTypeArguments: List<IrTypeArgument>? = null) : String {
|
||||
return getFunctionLabel(f.parent, getFunctionShortName(f), f.valueParameters, f.returnType, f.extensionReceiverParameter, getFunctionTypeParameters(f), classTypeArguments)
|
||||
fun getFunctionLabel(f: IrFunction, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>? = null) : String {
|
||||
return getFunctionLabel(f.parent, getFunctionShortName(f), f.valueParameters, f.returnType, f.extensionReceiverParameter, getFunctionTypeParameters(f), classTypeArgsIncludingOuterClasses)
|
||||
}
|
||||
|
||||
fun getEnclosingClass(it: IrDeclarationParent): IrClass? =
|
||||
@@ -645,10 +645,10 @@ class X {
|
||||
returnType: IrType,
|
||||
extensionReceiverParameter: IrValueParameter?,
|
||||
functionTypeParameters: List<IrTypeParameter>,
|
||||
classTypeArguments: List<IrTypeArgument>?
|
||||
classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?
|
||||
): String {
|
||||
val parentId = useDeclarationParent(parent, false, classTypeArguments, true)
|
||||
return getFunctionLabel(parent, parentId, name, parameters, returnType, extensionReceiverParameter, functionTypeParameters, classTypeArguments)
|
||||
val parentId = useDeclarationParent(parent, false, classTypeArgsIncludingOuterClasses, true)
|
||||
return getFunctionLabel(parent, parentId, name, parameters, returnType, extensionReceiverParameter, functionTypeParameters, classTypeArgsIncludingOuterClasses)
|
||||
}
|
||||
|
||||
fun getFunctionLabel(f: IrFunction, parentId: Label<out DbElement>, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?) =
|
||||
@@ -751,13 +751,13 @@ class X {
|
||||
return id
|
||||
}
|
||||
|
||||
fun <T: DbCallable> useFunction(f: IrFunction, classTypeArguments: List<IrTypeArgument>? = null): Label<out T> {
|
||||
fun <T: DbCallable> useFunction(f: IrFunction, classTypeArgsIncludingOuterClasses: List<IrTypeArgument>? = null): Label<out T> {
|
||||
if (f.isLocalFunction()) {
|
||||
val ids = getLocallyVisibleFunctionLabels(f)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return ids.function as Label<out T>
|
||||
} else {
|
||||
return useFunctionCommon<T>(f, getFunctionLabel(f, classTypeArguments))
|
||||
return useFunctionCommon<T>(f, getFunctionLabel(f, classTypeArgsIncludingOuterClasses))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user