Extract class references

This commit is contained in:
Tamas Vajk
2021-12-10 16:54:09 +01:00
committed by Ian Lynagh
parent 05028e612c
commit 6455c988f2
3 changed files with 26 additions and 0 deletions

View File

@@ -1791,6 +1791,23 @@ open class KotlinFileExtractor(
@Suppress("UNCHECKED_CAST")
tw.writeIsAnonymClass(ids.type.javaResult.id as Label<DbClass>, idLambdaExpr)
}
is IrClassReference -> {
val exprParent = parent.expr(e, callable)
val id = tw.getFreshIdLabel<DbTypeliteral>()
val locId = tw.getLocation(e)
val type = useType(e.type)
tw.writeExprs_typeliteral(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
tw.writeHasLocation(id, locId)
tw.writeCallableEnclosingExpr(id, callable)
tw.writeStatementEnclosingExpr(id, exprParent.enclosingStmt)
val typeAccessId = tw.getFreshIdLabel<DbUnannotatedtypeaccess>()
val typeAccessType = useType(e.classType)
tw.writeExprs_unannotatedtypeaccess(typeAccessId, typeAccessType.javaResult.id, typeAccessType.kotlinResult.id, id, 0)
tw.writeHasLocation(typeAccessId, locId)
tw.writeCallableEnclosingExpr(typeAccessId, callable)
tw.writeStatementEnclosingExpr(typeAccessId, exprParent.enclosingStmt)
}
else -> {
logger.warnElement(Severity.ErrorSevere, "Unrecognised IrExpression: " + e.javaClass, e)
}