mirror of
https://github.com/github/codeql.git
synced 2025-12-22 11:46:32 +01:00
Merge pull request #10049 from igfoo/igfoo/NotNullExpr2
Kotlin: Remove a non-null-expr
This commit is contained in:
@@ -4515,14 +4515,19 @@ open class KotlinFileExtractor(
|
|||||||
tw.writeHasLocation(constructorBlockId, locId)
|
tw.writeHasLocation(constructorBlockId, locId)
|
||||||
|
|
||||||
// Super call
|
// Super call
|
||||||
val superCallId = tw.getFreshIdLabel<DbSuperconstructorinvocationstmt>()
|
val baseClass = superTypes.first().classOrNull
|
||||||
tw.writeStmts_superconstructorinvocationstmt(superCallId, constructorBlockId, 0, ids.constructor)
|
if (baseClass == null) {
|
||||||
|
logger.warnElement("Cannot find base class", currentDeclaration)
|
||||||
|
} else {
|
||||||
|
val superCallId = tw.getFreshIdLabel<DbSuperconstructorinvocationstmt>()
|
||||||
|
tw.writeStmts_superconstructorinvocationstmt(superCallId, constructorBlockId, 0, ids.constructor)
|
||||||
|
|
||||||
val baseConstructor = superTypes.first().classOrNull!!.owner.declarations.find { it is IrFunction && it.symbol is IrConstructorSymbol }
|
val baseConstructor = baseClass.owner.declarations.find { it is IrFunction && it.symbol is IrConstructorSymbol }
|
||||||
val baseConstructorId = useFunction<DbConstructor>(baseConstructor as IrFunction)
|
val baseConstructorId = useFunction<DbConstructor>(baseConstructor as IrFunction)
|
||||||
|
|
||||||
tw.writeHasLocation(superCallId, locId)
|
tw.writeHasLocation(superCallId, locId)
|
||||||
tw.writeCallableBinding(superCallId.cast<DbCaller>(), baseConstructorId)
|
tw.writeCallableBinding(superCallId.cast<DbCaller>(), baseConstructorId)
|
||||||
|
}
|
||||||
|
|
||||||
addModifiers(id, "final")
|
addModifiers(id, "final")
|
||||||
addVisibilityModifierToLocalOrAnonymousClass(id)
|
addVisibilityModifierToLocalOrAnonymousClass(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user