mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
Merge pull request #10279 from igfoo/igfoo/extractGeneratedClass
Kotlin: Remove cast in extractGeneratedClass
This commit is contained in:
@@ -4669,14 +4669,18 @@ open class KotlinFileExtractor(
|
||||
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 = baseClass.owner.declarations.findSubType<IrFunction> { it.symbol is IrConstructorSymbol }
|
||||
val baseConstructorId = useFunction<DbConstructor>(baseConstructor as IrFunction)
|
||||
if (baseConstructor == null) {
|
||||
logger.warnElement("Cannot find base constructor", currentDeclaration)
|
||||
} else {
|
||||
val superCallId = tw.getFreshIdLabel<DbSuperconstructorinvocationstmt>()
|
||||
tw.writeStmts_superconstructorinvocationstmt(superCallId, constructorBlockId, 0, ids.constructor)
|
||||
|
||||
tw.writeHasLocation(superCallId, locId)
|
||||
tw.writeCallableBinding(superCallId.cast<DbCaller>(), baseConstructorId)
|
||||
val baseConstructorId = useFunction<DbConstructor>(baseConstructor)
|
||||
|
||||
tw.writeHasLocation(superCallId, locId)
|
||||
tw.writeCallableBinding(superCallId.cast<DbCaller>(), baseConstructorId)
|
||||
}
|
||||
}
|
||||
|
||||
addModifiers(id, "final")
|
||||
|
||||
Reference in New Issue
Block a user