mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Fix try statement extraction
This commit is contained in:
@@ -1047,17 +1047,17 @@ open class KotlinFileExtractor(
|
||||
val locId = tw.getLocation(e)
|
||||
tw.writeStmts_trystmt(id, stmtParent.parent, stmtParent.idx, callable)
|
||||
tw.writeHasLocation(id, locId)
|
||||
extractExpressionExpr(e.tryResult, callable, id, -1)
|
||||
extractExpressionStmt(e.tryResult, callable, id, -1)
|
||||
val finallyStmt = e.finallyExpression
|
||||
if(finallyStmt != null) {
|
||||
extractExpressionExpr(finallyStmt, callable, id, -2)
|
||||
extractExpressionStmt(finallyStmt, callable, id, -2)
|
||||
}
|
||||
for((catchIdx, catchClause) in e.catches.withIndex()) {
|
||||
val catchId = tw.getFreshIdLabel<DbCatchclause>()
|
||||
tw.writeStmts_catchclause(catchId, id, catchIdx, callable)
|
||||
// TODO: Index -1: unannotatedtypeaccess
|
||||
extractTypeAccess(catchClause.catchParameter.type, callable, catchId, -1, catchClause.catchParameter)
|
||||
extractVariableExpr(catchClause.catchParameter, callable, catchId, 0)
|
||||
extractExpressionExpr(catchClause.result, callable, catchId, 1)
|
||||
extractExpressionStmt(catchClause.result, callable, catchId, 1)
|
||||
}
|
||||
}
|
||||
is IrContainerExpression -> {
|
||||
|
||||
@@ -57,11 +57,9 @@
|
||||
| stmts.kt:28:11:28:11 | x | VarAccess |
|
||||
| stmts.kt:28:11:28:15 | ... > ... | GTExpr |
|
||||
| stmts.kt:28:15:28:15 | y | VarAccess |
|
||||
| stmts.kt:33:9:35:5 | <Stmt> | StmtExpr |
|
||||
| stmts.kt:34:15:34:30 | new Exception(...) | ClassInstanceExpr |
|
||||
| stmts.kt:34:26:34:28 | Foo | StringLiteral |
|
||||
| stmts.kt:36:12:36:23 | Exception | TypeAccess |
|
||||
| stmts.kt:36:12:36:23 | e | LocalVariableDeclExpr |
|
||||
| stmts.kt:36:26:38:5 | <Stmt> | StmtExpr |
|
||||
| stmts.kt:37:16:37:16 | 1 | IntegerLiteral |
|
||||
| stmts.kt:39:13:41:5 | <Stmt> | StmtExpr |
|
||||
| stmts.kt:40:16:40:16 | 2 | IntegerLiteral |
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| stmts.kt:33:5:41:5 | try ... | stmts.kt:33:9:35:5 | { ... } |
|
||||
4
java/ql/test/kotlin/library-tests/stmts/tryStmts.ql
Normal file
4
java/ql/test/kotlin/library-tests/stmts/tryStmts.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import java
|
||||
|
||||
from TryStmt s
|
||||
select s, s.getBlock()
|
||||
Reference in New Issue
Block a user