Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae7aa30

Browse files
tamasvajkigfoo
authored andcommitted
Extract break/continue/throw
1 parent 63c22ca commit ae7aa30

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

java/kotlin-extractor/src/main/kotlin/KotlinExtractorExtension.kt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,21 +716,42 @@ class KotlinFileExtractor(val logger: FileLogger, val tw: FileTrapWriter, val fi
716716

717717
extractExpression(e.value, callable, id, 1)
718718
}
719+
is IrThrow -> {
720+
val id = tw.getFreshIdLabel<DbThrowstmt>()
721+
val locId = tw.getLocation(e)
722+
tw.writeStmts_throwstmt(id, parent, idx, callable)
723+
tw.writeHasLocation(id, locId)
724+
extractExpression(e.value, callable, id, 0)
725+
}
726+
is IrBreak -> {
727+
val id = tw.getFreshIdLabel<DbBreakstmt>()
728+
val locId = tw.getLocation(e)
729+
tw.writeStmts_breakstmt(id, parent, idx, callable)
730+
tw.writeHasLocation(id, locId)
731+
}
732+
is IrContinue -> {
733+
val id = tw.getFreshIdLabel<DbContinuestmt>()
734+
val locId = tw.getLocation(e)
735+
tw.writeStmts_continuestmt(id, parent, idx, callable)
736+
tw.writeHasLocation(id, locId)
737+
}
719738
is IrReturn -> {
720739
val id = tw.getFreshIdLabel<DbReturnstmt>()
721740
val locId = tw.getLocation(e)
722741
tw.writeStmts_returnstmt(id, parent, idx, callable)
723742
tw.writeHasLocation(id, locId)
724743
extractExpression(e.value, callable, id, 0)
725-
} is IrContainerExpression -> {
744+
}
745+
is IrContainerExpression -> {
726746
val id = tw.getFreshIdLabel<DbBlock>()
727747
val locId = tw.getLocation(e)
728748
tw.writeStmts_block(id, parent, idx, callable)
729749
tw.writeHasLocation(id, locId)
730750
e.statements.forEachIndexed { i, s ->
731751
extractStatement(s, callable, id, i)
732752
}
733-
} is IrWhileLoop -> {
753+
}
754+
is IrWhileLoop -> {
734755
val id = tw.getFreshIdLabel<DbWhilestmt>()
735756
val locId = tw.getLocation(e)
736757
tw.writeStmts_whilestmt(id, parent, idx, callable)
@@ -740,7 +761,8 @@ class KotlinFileExtractor(val logger: FileLogger, val tw: FileTrapWriter, val fi
740761
if(body != null) {
741762
extractExpression(body, callable, id, 1)
742763
}
743-
} is IrDoWhileLoop -> {
764+
}
765+
is IrDoWhileLoop -> {
744766
val id = tw.getFreshIdLabel<DbDostmt>()
745767
val locId = tw.getLocation(e)
746768
tw.writeStmts_dostmt(id, parent, idx, callable)
@@ -750,7 +772,8 @@ class KotlinFileExtractor(val logger: FileLogger, val tw: FileTrapWriter, val fi
750772
if(body != null) {
751773
extractExpression(body, callable, id, 1)
752774
}
753-
} is IrWhen -> {
775+
}
776+
is IrWhen -> {
754777
val id = tw.getFreshIdLabel<DbWhenexpr>()
755778
val typeId = useType(e.type)
756779
val locId = tw.getLocation(e)

0 commit comments

Comments
 (0)