Merge pull request #9647 from tamasvajk/kotlin-when-branch-encl-stmt

Kotlin: Fix enclosing statement of `when` branches
This commit is contained in:
Tamás Vajk
2022-06-22 13:18:56 +02:00
committed by GitHub
3 changed files with 54 additions and 1 deletions

View File

@@ -29,7 +29,8 @@ class Stmt extends StmtParent, ExprParent, @stmt {
*/
Stmt getEnclosingStmt() {
result = this.getParent() or
result = this.getParent().(SwitchExpr).getEnclosingStmt()
result = this.getParent().(SwitchExpr).getEnclosingStmt() or
result = this.getParent().(WhenExpr).getEnclosingStmt()
}
/** Holds if this statement is the child of the specified parent at the specified (zero-based) position. */