mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Code quality improvements
This commit is contained in:
@@ -1914,13 +1914,6 @@ open class KotlinFileExtractor(
|
||||
unaryopReceiver(id, c.dispatchReceiver, "Dispatch receiver")
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the lhs of a binary op from this call's extension receiver, and the rhs from its sole argument.
|
||||
*/
|
||||
fun binopExtensionMethod(id: Label<out DbExpr>) {
|
||||
binopReceiver(id, c.extensionReceiver, "Extension receiver")
|
||||
}
|
||||
|
||||
val dr = c.dispatchReceiver
|
||||
when {
|
||||
isFunction(target, "kotlin", "String", "plus", false) -> {
|
||||
|
||||
@@ -1290,7 +1290,7 @@ open class KotlinUsesExtractor(
|
||||
else null
|
||||
} ?: run {
|
||||
val parentFqName = parentClass.fqNameWhenAvailable?.asString()
|
||||
val msg = "Couldn't find a Java equivalent function to $parentFqName.${f.name} in ${javaClass.fqNameWhenAvailable}"
|
||||
val msg = "Couldn't find a Java equivalent function to $parentFqName.${f.name.asString()} in ${javaClass.fqNameWhenAvailable?.asString()}"
|
||||
if (!globalExtensionState.deduplicatedWarnings.contains(msg)) {
|
||||
logger.warn(msg)
|
||||
globalExtensionState.deduplicatedWarnings.add(msg)
|
||||
|
||||
@@ -12,15 +12,3 @@ inline fun <reified S: IrDeclaration> Iterable<IrDeclaration>.findSubType(
|
||||
): S? {
|
||||
return this.find { it is S && predicate(it) } as S?
|
||||
}
|
||||
|
||||
/**
|
||||
* This behaves the same as Iterable<IrDeclaration>.singleOrNull, but
|
||||
* requires that the value found is of the subtype S, and it casts
|
||||
* the result for you appropriately.
|
||||
*/
|
||||
inline fun <reified S: IrDeclaration> Iterable<IrDeclaration>.singleOrNullSubType(
|
||||
predicate: (S) -> Boolean
|
||||
): S? {
|
||||
return this.singleOrNull { it is S && predicate(it) } as S?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user