Merge pull request #10049 from igfoo/igfoo/NotNullExpr2

Kotlin: Remove a non-null-expr
This commit is contained in:
Ian Lynagh
2022-08-16 10:59:33 +01:00
committed by GitHub

View File

@@ -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)