diff --git a/java/kotlin-extractor2/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor2/src/main/kotlin/KotlinFileExtractor.kt index e4cda860739..1479686c180 100644 --- a/java/kotlin-extractor2/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor2/src/main/kotlin/KotlinFileExtractor.kt @@ -2622,7 +2622,7 @@ OLD: KE1 f ) */ - // extractBody(body, id) + extractBody(body, id) } /* @@ -2939,36 +2939,44 @@ OLD: KE1 // TODO: extract annotations } } +*/ - private fun extractBody(b: IrBody, callable: Label) { + private fun extractBody(b: KtExpression, callable: Label) { with("body", b) { when (b) { - is IrBlockBody -> extractBlockBody(b, callable) + is KtBlockExpression -> extractBlockBody(b, callable) +/* +OLD: KE1 is IrSyntheticBody -> extractSyntheticBody(b, callable) - is IrExpressionBody -> extractExpressionBody(b, callable) - else -> { - logger.errorElement("Unrecognised IrBody: " + b.javaClass, b) - } + else -> extractExpressionBody(b, callable) +*/ + else -> TODO() } } } + // TODO: Can this be inlined? private fun extractBlockBody(callable: Label, locId: Label) = tw.getFreshIdLabel().also { tw.writeStmts_block(it, callable, 0, callable) tw.writeHasLocation(it, locId) } - private fun extractBlockBody(b: IrBlockBody, callable: Label) { + private fun extractBlockBody(b: KtBlockExpression, callable: Label) { with("block body", b) { extractBlockBody(callable, tw.getLocation(b)).also { for ((sIdx, stmt) in b.statements.withIndex()) { - extractStatement(stmt, callable, it, sIdx) +/* +OLD: KE1 + extractExpression(stmt, callable, it, sIdx) +*/ } } } } +/* +OLD: KE1 private fun extractSyntheticBody(b: IrSyntheticBody, callable: Label) { with("synthetic body", b) { val kind = b.kind diff --git a/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt b/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt index 8333b82f9a7..9f67ed42ae6 100644 --- a/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt +++ b/java/kotlin-extractor2/src/main/kotlin/TrapWriter.kt @@ -106,8 +106,6 @@ TODO: Inline this if it can remain private } } -/* -OLD: KE1 /** Returns a label for a fresh ID (i.e. a new label bound to `*`). */ fun getFreshIdLabel(): Label { val label: Label = lm.getFreshLabel() @@ -115,6 +113,8 @@ OLD: KE1 return label } +/* +OLD: KE1 /** * It is not easy to assign keys to local variables, so they get given `*` IDs. However, the * same variable may be referred to from distant places in the IR, so we need a way to find out