Kotlin: Add do/while loops

This commit is contained in:
Ian Lynagh
2021-08-11 13:53:39 +01:00
parent 0c429e4f80
commit 97722faee9
2 changed files with 14 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.ir.expressions.IrWhen
import org.jetbrains.kotlin.ir.expressions.IrElseBranch
import org.jetbrains.kotlin.ir.expressions.IrWhileLoop
import org.jetbrains.kotlin.ir.expressions.IrBlock
import org.jetbrains.kotlin.ir.expressions.IrDoWhileLoop
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
@@ -357,6 +358,16 @@ class KotlinFileExtractor(val tw: TrapWriter) {
if(body != null) {
extractExpression(body, callable, id, 1) // TODO: The QLLs think this is a Stmt
}
} is IrDoWhileLoop -> {
val id = tw.getFreshIdLabel<DbDostmt>()
val locId = tw.getLocation(e.startOffset, e.endOffset)
tw.writeStmts_dostmt(id, parent, idx, callable)
tw.writeHasLocation(id, locId)
extractExpression(e.condition, callable, id, 0)
val body = e.body
if(body != null) {
extractExpression(body, callable, id, 1) // TODO: The QLLs think this is a Stmt
}
} is IrWhen -> {
if(e.origin == IF) {
var branchParent = parent