Java: Accept revised CFG.

This commit is contained in:
Anders Schack-Mulligen
2026-02-13 15:27:18 +01:00
parent 106a9d479f
commit eb37c413f2
39 changed files with 525 additions and 461 deletions

View File

@@ -1,12 +1,10 @@
#select
| Test.kt:3:1:80:1 | Exceptional Exit | Constructor | Test.kt:3:1:80:1 | Exit | Constructor |
| Test.kt:3:1:80:1 | Exit | Constructor | file://:0:0:0:0 | <none> | <none> |
| Test.kt:3:1:80:1 | Entry | Constructor | Test.kt:3:1:80:1 | { ... } | BlockStmt |
| Test.kt:3:1:80:1 | Normal Exit | Constructor | Test.kt:3:1:80:1 | Exit | Constructor |
| Test.kt:3:1:80:1 | super(...) | SuperConstructorInvocationStmt | Test.kt:3:1:80:1 | { ... } | BlockStmt |
| Test.kt:3:1:80:1 | { ... } | BlockStmt | Test.kt:3:1:80:1 | Normal Exit | Constructor |
| Test.kt:3:1:80:1 | { ... } | BlockStmt | Test.kt:3:1:80:1 | super(...) | SuperConstructorInvocationStmt |
| Test.kt:4:2:79:2 | Exceptional Exit | Method | Test.kt:4:2:79:2 | Exit | Method |
| Test.kt:4:2:79:2 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:4:2:79:2 | Entry | Method | Test.kt:4:13:79:2 | { ... } | BlockStmt |
| Test.kt:4:2:79:2 | Normal Exit | Method | Test.kt:4:2:79:2 | Exit | Method |
| Test.kt:4:13:79:2 | { ... } | BlockStmt | Test.kt:5:3:5:16 | var ...; | LocalVariableDeclStmt |
| Test.kt:5:3:5:16 | var ...; | LocalVariableDeclStmt | Test.kt:5:16:5:16 | 0 | IntegerLiteral |
@@ -30,19 +28,23 @@
| Test.kt:11:11:11:11 | 0 | IntegerLiteral | Test.kt:11:7:11:11 | ... > ... | GTExpr |
| Test.kt:11:14:14:3 | { ... } | BlockStmt | Test.kt:12:4:12:9 | <Expr>; | ExprStmt |
| Test.kt:12:4:12:9 | ...=... | AssignExpr | Test.kt:13:4:13:9 | <Expr>; | ExprStmt |
| Test.kt:12:4:12:9 | <Expr>; | ExprStmt | Test.kt:12:8:12:9 | 20 | LongLiteral |
| Test.kt:12:4:12:9 | <Expr>; | ExprStmt | Test.kt:12:4:12:9 | y | VarAccess |
| Test.kt:12:4:12:9 | y | VarAccess | Test.kt:12:8:12:9 | 20 | LongLiteral |
| Test.kt:12:8:12:9 | 20 | LongLiteral | Test.kt:12:4:12:9 | ...=... | AssignExpr |
| Test.kt:13:4:13:9 | ...=... | AssignExpr | Test.kt:18:3:18:7 | <Expr>; | ExprStmt |
| Test.kt:13:4:13:9 | <Expr>; | ExprStmt | Test.kt:13:8:13:9 | 10 | IntegerLiteral |
| Test.kt:13:4:13:9 | <Expr>; | ExprStmt | Test.kt:13:4:13:9 | z | VarAccess |
| Test.kt:13:4:13:9 | z | VarAccess | Test.kt:13:8:13:9 | 10 | IntegerLiteral |
| Test.kt:13:8:13:9 | 10 | IntegerLiteral | Test.kt:13:4:13:9 | ...=... | AssignExpr |
| Test.kt:14:10:16:3 | ... -> ... | WhenBranch | Test.kt:14:10:16:3 | true | BooleanLiteral |
| Test.kt:14:10:16:3 | true | BooleanLiteral | Test.kt:14:10:16:3 | { ... } | BlockStmt |
| Test.kt:14:10:16:3 | { ... } | BlockStmt | Test.kt:15:4:15:9 | <Expr>; | ExprStmt |
| Test.kt:15:4:15:9 | ...=... | AssignExpr | Test.kt:18:3:18:7 | <Expr>; | ExprStmt |
| Test.kt:15:4:15:9 | <Expr>; | ExprStmt | Test.kt:15:8:15:9 | 30 | LongLiteral |
| Test.kt:15:4:15:9 | <Expr>; | ExprStmt | Test.kt:15:4:15:9 | y | VarAccess |
| Test.kt:15:4:15:9 | y | VarAccess | Test.kt:15:8:15:9 | 30 | LongLiteral |
| Test.kt:15:8:15:9 | 30 | LongLiteral | Test.kt:15:4:15:9 | ...=... | AssignExpr |
| Test.kt:18:3:18:7 | ...=... | AssignExpr | Test.kt:21:3:24:9 | <Expr>; | ExprStmt |
| Test.kt:18:3:18:7 | <Expr>; | ExprStmt | Test.kt:18:7:18:7 | 0 | IntegerLiteral |
| Test.kt:18:3:18:7 | <Expr>; | ExprStmt | Test.kt:18:3:18:7 | z | VarAccess |
| Test.kt:18:3:18:7 | z | VarAccess | Test.kt:18:7:18:7 | 0 | IntegerLiteral |
| Test.kt:18:7:18:7 | 0 | IntegerLiteral | Test.kt:18:3:18:7 | ...=... | AssignExpr |
| Test.kt:21:3:24:9 | <Expr>; | ExprStmt | Test.kt:21:3:24:9 | when ... | WhenExpr |
| Test.kt:21:3:24:9 | when ... | WhenExpr | Test.kt:21:6:22:9 | ... -> ... | WhenBranch |
@@ -52,14 +54,16 @@
| Test.kt:21:6:22:9 | ... -> ... | WhenBranch | Test.kt:21:6:21:6 | x | VarAccess |
| Test.kt:21:10:21:10 | 0 | IntegerLiteral | Test.kt:21:6:21:10 | ... < ... | LTExpr |
| Test.kt:22:4:22:9 | ...=... | AssignExpr | Test.kt:27:3:27:8 | <Expr>; | ExprStmt |
| Test.kt:22:4:22:9 | <Expr>; | ExprStmt | Test.kt:22:8:22:9 | 40 | LongLiteral |
| Test.kt:22:4:22:9 | <Expr>; | ExprStmt | Test.kt:22:4:22:9 | y | VarAccess |
| Test.kt:22:4:22:9 | y | VarAccess | Test.kt:22:8:22:9 | 40 | LongLiteral |
| Test.kt:22:8:22:9 | 40 | LongLiteral | Test.kt:22:4:22:9 | ...=... | AssignExpr |
| Test.kt:24:4:24:9 | ... -> ... | WhenBranch | Test.kt:24:4:24:9 | true | BooleanLiteral |
| Test.kt:24:4:24:9 | return ... | ReturnStmt | Test.kt:4:2:79:2 | Normal Exit | Method |
| Test.kt:24:4:24:9 | true | BooleanLiteral | Test.kt:24:10:24:10 | INSTANCE | VarAccess |
| Test.kt:24:10:24:10 | INSTANCE | VarAccess | Test.kt:24:4:24:9 | return ... | ReturnStmt |
| Test.kt:27:3:27:8 | ...=... | AssignExpr | Test.kt:30:3:33:3 | <Expr>; | ExprStmt |
| Test.kt:27:3:27:8 | <Expr>; | ExprStmt | Test.kt:27:7:27:8 | 10 | IntegerLiteral |
| Test.kt:27:3:27:8 | <Expr>; | ExprStmt | Test.kt:27:3:27:8 | z | VarAccess |
| Test.kt:27:3:27:8 | z | VarAccess | Test.kt:27:7:27:8 | 10 | IntegerLiteral |
| Test.kt:27:7:27:8 | 10 | IntegerLiteral | Test.kt:27:3:27:8 | ...=... | AssignExpr |
| Test.kt:30:3:33:3 | <Expr>; | ExprStmt | Test.kt:30:3:33:3 | when ... | WhenExpr |
| Test.kt:30:3:33:3 | when ... | WhenExpr | Test.kt:30:7:33:3 | ... -> ... | WhenBranch |
@@ -70,13 +74,16 @@
| Test.kt:30:12:30:12 | 0 | IntegerLiteral | Test.kt:30:7:30:12 | ... (value equals) ... | ValueEQExpr |
| Test.kt:30:15:33:3 | { ... } | BlockStmt | Test.kt:31:4:31:9 | <Expr>; | ExprStmt |
| Test.kt:31:4:31:9 | ...=... | AssignExpr | Test.kt:32:4:32:9 | <Expr>; | ExprStmt |
| Test.kt:31:4:31:9 | <Expr>; | ExprStmt | Test.kt:31:8:31:9 | 60 | LongLiteral |
| Test.kt:31:4:31:9 | <Expr>; | ExprStmt | Test.kt:31:4:31:9 | y | VarAccess |
| Test.kt:31:4:31:9 | y | VarAccess | Test.kt:31:8:31:9 | 60 | LongLiteral |
| Test.kt:31:8:31:9 | 60 | LongLiteral | Test.kt:31:4:31:9 | ...=... | AssignExpr |
| Test.kt:32:4:32:9 | ...=... | AssignExpr | Test.kt:35:3:35:8 | <Expr>; | ExprStmt |
| Test.kt:32:4:32:9 | <Expr>; | ExprStmt | Test.kt:32:8:32:9 | 10 | IntegerLiteral |
| Test.kt:32:4:32:9 | <Expr>; | ExprStmt | Test.kt:32:4:32:9 | z | VarAccess |
| Test.kt:32:4:32:9 | z | VarAccess | Test.kt:32:8:32:9 | 10 | IntegerLiteral |
| Test.kt:32:8:32:9 | 10 | IntegerLiteral | Test.kt:32:4:32:9 | ...=... | AssignExpr |
| Test.kt:35:3:35:8 | ...=... | AssignExpr | Test.kt:38:3:41:3 | while (...) | WhileStmt |
| Test.kt:35:3:35:8 | <Expr>; | ExprStmt | Test.kt:35:7:35:8 | 20 | IntegerLiteral |
| Test.kt:35:3:35:8 | <Expr>; | ExprStmt | Test.kt:35:3:35:8 | z | VarAccess |
| Test.kt:35:3:35:8 | z | VarAccess | Test.kt:35:7:35:8 | 20 | IntegerLiteral |
| Test.kt:35:7:35:8 | 20 | IntegerLiteral | Test.kt:35:3:35:8 | ...=... | AssignExpr |
| Test.kt:38:3:41:3 | while (...) | WhileStmt | Test.kt:38:9:38:9 | x | VarAccess |
| Test.kt:38:9:38:9 | x | VarAccess | Test.kt:38:13:38:13 | 0 | IntegerLiteral |
@@ -85,34 +92,39 @@
| Test.kt:38:13:38:13 | 0 | IntegerLiteral | Test.kt:38:9:38:13 | ... > ... | GTExpr |
| Test.kt:38:16:41:3 | { ... } | BlockStmt | Test.kt:39:4:39:9 | <Expr>; | ExprStmt |
| Test.kt:39:4:39:9 | ...=... | AssignExpr | Test.kt:40:4:40:6 | <Expr>; | ExprStmt |
| Test.kt:39:4:39:9 | <Expr>; | ExprStmt | Test.kt:39:8:39:9 | 10 | LongLiteral |
| Test.kt:39:4:39:9 | <Expr>; | ExprStmt | Test.kt:39:4:39:9 | y | VarAccess |
| Test.kt:39:4:39:9 | y | VarAccess | Test.kt:39:8:39:9 | 10 | LongLiteral |
| Test.kt:39:8:39:9 | 10 | LongLiteral | Test.kt:39:4:39:9 | ...=... | AssignExpr |
| Test.kt:40:4:40:4 | x | VarAccess | Test.kt:40:4:40:6 | <unary> | LocalVariableDeclExpr |
| Test.kt:40:4:40:6 | ...=... | AssignExpr | Test.kt:40:4:40:6 | <Expr>; | ExprStmt |
| Test.kt:40:4:40:6 | <Expr>; | ExprStmt | Test.kt:40:4:40:6 | <Stmt> | StmtExpr |
| Test.kt:40:4:40:6 | <Expr>; | ExprStmt | Test.kt:40:4:40:6 | <unary> | VarAccess |
| Test.kt:40:4:40:6 | <Expr>; | ExprStmt | Test.kt:40:4:40:6 | <unary> | VarAccess |
| Test.kt:40:4:40:6 | <Stmt> | StmtExpr | Test.kt:40:4:40:6 | { ... } | BlockStmt |
| Test.kt:40:4:40:6 | <Expr>; | ExprStmt | Test.kt:40:4:40:6 | x | VarAccess |
| Test.kt:40:4:40:6 | <Expr>; | ExprStmt | Test.kt:40:4:40:6 | { ... } | BlockStmt |
| Test.kt:40:4:40:6 | <Stmt> | StmtExpr | Test.kt:40:4:40:6 | <implicit coercion to unit> | ImplicitCoercionToUnitExpr |
| Test.kt:40:4:40:6 | <implicit coercion to unit> | ImplicitCoercionToUnitExpr | Test.kt:38:9:38:9 | x | VarAccess |
| Test.kt:40:4:40:6 | <unary> | LocalVariableDeclExpr | Test.kt:40:4:40:6 | <Expr>; | ExprStmt |
| Test.kt:40:4:40:6 | <unary> | VarAccess | Test.kt:40:4:40:6 | <implicit coercion to unit> | ImplicitCoercionToUnitExpr |
| Test.kt:40:4:40:6 | <unary> | VarAccess | Test.kt:40:4:40:6 | <Stmt> | StmtExpr |
| Test.kt:40:4:40:6 | <unary> | VarAccess | Test.kt:40:4:40:6 | dec(...) | MethodCall |
| Test.kt:40:4:40:6 | dec(...) | MethodCall | Test.kt:40:4:40:6 | ...=... | AssignExpr |
| Test.kt:40:4:40:6 | var ...; | LocalVariableDeclStmt | Test.kt:40:4:40:4 | x | VarAccess |
| Test.kt:40:4:40:6 | x | VarAccess | Test.kt:40:4:40:6 | <unary> | VarAccess |
| Test.kt:40:4:40:6 | { ... } | BlockStmt | Test.kt:40:4:40:6 | var ...; | LocalVariableDeclStmt |
| Test.kt:43:3:43:8 | ...=... | AssignExpr | Test.kt:73:3:73:8 | <Expr>; | ExprStmt |
| Test.kt:43:3:43:8 | <Expr>; | ExprStmt | Test.kt:43:7:43:8 | 30 | IntegerLiteral |
| Test.kt:43:3:43:8 | <Expr>; | ExprStmt | Test.kt:43:3:43:8 | z | VarAccess |
| Test.kt:43:3:43:8 | z | VarAccess | Test.kt:43:7:43:8 | 30 | IntegerLiteral |
| Test.kt:43:7:43:8 | 30 | IntegerLiteral | Test.kt:43:3:43:8 | ...=... | AssignExpr |
| Test.kt:73:3:73:8 | ...=... | AssignExpr | Test.kt:77:3:77:8 | <Expr>; | ExprStmt |
| Test.kt:73:3:73:8 | <Expr>; | ExprStmt | Test.kt:73:7:73:8 | 50 | IntegerLiteral |
| Test.kt:73:3:73:8 | <Expr>; | ExprStmt | Test.kt:73:3:73:8 | z | VarAccess |
| Test.kt:73:3:73:8 | z | VarAccess | Test.kt:73:7:73:8 | 50 | IntegerLiteral |
| Test.kt:73:7:73:8 | 50 | IntegerLiteral | Test.kt:73:3:73:8 | ...=... | AssignExpr |
| Test.kt:77:3:77:8 | ...=... | AssignExpr | Test.kt:78:9:78:9 | INSTANCE | VarAccess |
| Test.kt:77:3:77:8 | <Expr>; | ExprStmt | Test.kt:77:7:77:8 | 40 | IntegerLiteral |
| Test.kt:77:3:77:8 | <Expr>; | ExprStmt | Test.kt:77:3:77:8 | w | VarAccess |
| Test.kt:77:3:77:8 | w | VarAccess | Test.kt:77:7:77:8 | 40 | IntegerLiteral |
| Test.kt:77:7:77:8 | 40 | IntegerLiteral | Test.kt:77:3:77:8 | ...=... | AssignExpr |
| Test.kt:78:3:78:8 | return ... | ReturnStmt | Test.kt:4:2:79:2 | Normal Exit | Method |
| Test.kt:78:9:78:9 | INSTANCE | VarAccess | Test.kt:78:3:78:8 | return ... | ReturnStmt |
| Test.kt:82:1:89:1 | Entry | Method | Test.kt:82:21:89:1 | { ... } | BlockStmt |
| Test.kt:82:1:89:1 | Exceptional Exit | Method | Test.kt:82:1:89:1 | Exit | Method |
| Test.kt:82:1:89:1 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:82:1:89:1 | Normal Exit | Method | Test.kt:82:1:89:1 | Exit | Method |
| Test.kt:82:21:89:1 | { ... } | BlockStmt | Test.kt:83:2:88:2 | try ... | TryStmt |
| Test.kt:83:2:88:2 | try ... | TryStmt | Test.kt:83:6:86:2 | { ... } | BlockStmt |
@@ -124,13 +136,14 @@
| Test.kt:84:11:84:18 | (...)... | CastExpr | Test.kt:86:4:88:2 | catch (...) | CatchClause |
| Test.kt:85:3:85:10 | return ... | ReturnStmt | Test.kt:82:1:89:1 | Normal Exit | Method |
| Test.kt:85:10:85:10 | 1 | IntegerLiteral | Test.kt:85:3:85:10 | return ... | ReturnStmt |
| Test.kt:86:4:88:2 | catch (...) | CatchClause | Test.kt:82:1:89:1 | Exceptional Exit | Method |
| Test.kt:86:4:88:2 | catch (...) | CatchClause | Test.kt:86:11:86:31 | e | LocalVariableDeclExpr |
| Test.kt:86:11:86:31 | e | LocalVariableDeclExpr | Test.kt:86:34:88:2 | { ... } | BlockStmt |
| Test.kt:86:34:88:2 | { ... } | BlockStmt | Test.kt:87:10:87:10 | 2 | IntegerLiteral |
| Test.kt:87:3:87:10 | return ... | ReturnStmt | Test.kt:82:1:89:1 | Normal Exit | Method |
| Test.kt:87:10:87:10 | 2 | IntegerLiteral | Test.kt:87:3:87:10 | return ... | ReturnStmt |
| Test.kt:91:1:98:1 | Entry | Method | Test.kt:91:22:98:1 | { ... } | BlockStmt |
| Test.kt:91:1:98:1 | Exceptional Exit | Method | Test.kt:91:1:98:1 | Exit | Method |
| Test.kt:91:1:98:1 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:91:1:98:1 | Normal Exit | Method | Test.kt:91:1:98:1 | Exit | Method |
| Test.kt:91:22:98:1 | { ... } | BlockStmt | Test.kt:92:2:97:2 | try ... | TryStmt |
| Test.kt:92:2:97:2 | try ... | TryStmt | Test.kt:92:6:95:2 | { ... } | BlockStmt |
@@ -142,13 +155,14 @@
| Test.kt:93:11:93:13 | ...!! | NotNullExpr | Test.kt:95:4:97:2 | catch (...) | CatchClause |
| Test.kt:94:3:94:10 | return ... | ReturnStmt | Test.kt:91:1:98:1 | Normal Exit | Method |
| Test.kt:94:10:94:10 | 1 | IntegerLiteral | Test.kt:94:3:94:10 | return ... | ReturnStmt |
| Test.kt:95:4:97:2 | catch (...) | CatchClause | Test.kt:91:1:98:1 | Exceptional Exit | Method |
| Test.kt:95:4:97:2 | catch (...) | CatchClause | Test.kt:95:11:95:33 | e | LocalVariableDeclExpr |
| Test.kt:95:11:95:33 | e | LocalVariableDeclExpr | Test.kt:95:36:97:2 | { ... } | BlockStmt |
| Test.kt:95:36:97:2 | { ... } | BlockStmt | Test.kt:96:10:96:10 | 2 | IntegerLiteral |
| Test.kt:96:3:96:10 | return ... | ReturnStmt | Test.kt:91:1:98:1 | Normal Exit | Method |
| Test.kt:96:10:96:10 | 2 | IntegerLiteral | Test.kt:96:3:96:10 | return ... | ReturnStmt |
| Test.kt:100:1:110:1 | Entry | Method | Test.kt:100:25:110:1 | { ... } | BlockStmt |
| Test.kt:100:1:110:1 | Exceptional Exit | Method | Test.kt:100:1:110:1 | Exit | Method |
| Test.kt:100:1:110:1 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:100:1:110:1 | Normal Exit | Method | Test.kt:100:1:110:1 | Exit | Method |
| Test.kt:100:25:110:1 | { ... } | BlockStmt | Test.kt:101:5:103:5 | <Expr>; | ExprStmt |
| Test.kt:101:5:103:5 | <Expr>; | ExprStmt | Test.kt:101:5:103:5 | when ... | WhenExpr |
@@ -186,8 +200,7 @@
| Test.kt:108:9:108:29 | <Expr>; | ExprStmt | Test.kt:108:17:108:28 | "y not null" | StringLiteral |
| Test.kt:108:9:108:29 | println(...) | MethodCall | Test.kt:100:1:110:1 | Normal Exit | Method |
| Test.kt:108:17:108:28 | "y not null" | StringLiteral | Test.kt:108:9:108:29 | println(...) | MethodCall |
| Test.kt:112:1:116:1 | Exceptional Exit | Method | Test.kt:112:1:116:1 | Exit | Method |
| Test.kt:112:1:116:1 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:112:1:116:1 | Entry | Method | Test.kt:112:32:116:1 | { ... } | BlockStmt |
| Test.kt:112:1:116:1 | Normal Exit | Method | Test.kt:112:1:116:1 | Exit | Method |
| Test.kt:112:32:116:1 | { ... } | BlockStmt | Test.kt:113:5:115:5 | <Expr>; | ExprStmt |
| Test.kt:113:5:115:5 | <Expr>; | ExprStmt | Test.kt:113:5:115:5 | when ... | WhenExpr |
@@ -199,8 +212,7 @@
| Test.kt:113:14:113:14 | y | VarAccess | Test.kt:112:1:116:1 | Normal Exit | Method |
| Test.kt:113:14:113:14 | y | VarAccess | Test.kt:113:17:115:5 | { ... } | BlockStmt |
| Test.kt:113:17:115:5 | { ... } | BlockStmt | Test.kt:112:1:116:1 | Normal Exit | Method |
| Test.kt:118:1:124:1 | Exceptional Exit | Method | Test.kt:118:1:124:1 | Exit | Method |
| Test.kt:118:1:124:1 | Exit | Method | file://:0:0:0:0 | <none> | <none> |
| Test.kt:118:1:124:1 | Entry | Method | Test.kt:118:37:124:1 | { ... } | BlockStmt |
| Test.kt:118:1:124:1 | Normal Exit | Method | Test.kt:118:1:124:1 | Exit | Method |
| Test.kt:118:37:124:1 | { ... } | BlockStmt | Test.kt:119:2:123:12 | <Expr>; | ExprStmt |
| Test.kt:119:2:123:12 | <Expr>; | ExprStmt | Test.kt:119:2:123:12 | when ... | WhenExpr |
@@ -216,6 +228,7 @@
| Test.kt:122:12:122:16 | ... -> ... | WhenBranch | Test.kt:122:12:122:16 | true | BooleanLiteral |
| Test.kt:122:12:122:16 | <Expr>; | ExprStmt | Test.kt:122:12:122:16 | false | BooleanLiteral |
| Test.kt:122:12:122:16 | false | BooleanLiteral | Test.kt:118:1:124:1 | Normal Exit | Method |
| Test.kt:122:12:122:16 | false | BooleanLiteral | Test.kt:123:8:123:10 | { ... } | BlockStmt |
| Test.kt:122:12:122:16 | true | BooleanLiteral | Test.kt:122:12:122:16 | <Expr>; | ExprStmt |
| Test.kt:123:8:123:10 | { ... } | BlockStmt | Test.kt:118:1:124:1 | Normal Exit | Method |
missingSuccessor

View File

@@ -1,54 +1,15 @@
import java
import utils.test.AstCfg
newtype TMaybeControlFlowNode =
TControlFlowNode(ControlFlowNode c) or
TNoControlFlowNode()
class MaybeControlFlowNode extends TMaybeControlFlowNode {
abstract string toString();
abstract Location getLocation();
abstract string getPrimaryQlClasses();
}
class YesMaybeControlFlowNode extends MaybeControlFlowNode {
ControlFlowNode c;
YesMaybeControlFlowNode() { this = TControlFlowNode(c) }
override string toString() { result = c.toString() }
override Location getLocation() { result = c.getLocation() }
override string getPrimaryQlClasses() { result = c.getAstNode().getPrimaryQlClasses() }
}
class NoMaybeControlFlowNode extends MaybeControlFlowNode {
NoMaybeControlFlowNode() { this = TNoControlFlowNode() }
override string toString() { result = "<none>" }
override Location getLocation() { result.toString() = "file://:0:0:0:0" }
override string getPrimaryQlClasses() { result = "<none>" }
}
MaybeControlFlowNode maybeSuccessor(ControlFlowNode n) {
if exists(n.getASuccessor())
then result = TControlFlowNode(n.getASuccessor())
else result = TNoControlFlowNode()
}
from ControlFlowNode n, MaybeControlFlowNode m
from ControlFlowNode n, ControlFlowNode m
where
m = maybeSuccessor(n) and
m = getAnAstSuccessor(n) and
n.getLocation().getFile().(CompilationUnit).fromSource()
select n, n.getAstNode().getPrimaryQlClasses(), m, m.getPrimaryQlClasses()
select n, n.getAstNode().getPrimaryQlClasses(), m, m.getAstNode().getPrimaryQlClasses()
query predicate missingSuccessor(Expr n) {
maybeSuccessor(n.getControlFlowNode()) instanceof NoMaybeControlFlowNode and
n.getFile().(CompilationUnit).fromSource() and
not n instanceof TypeAccess and
not n instanceof VarWrite
query predicate missingSuccessor(Expr e) {
exists(ControlFlowNode n | n = e.getControlFlowNode() and not exists(n.getASuccessor())) and
e.getFile().(CompilationUnit).fromSource() and
not e instanceof TypeAccess and
not e instanceof VarWrite
}