|
15 | 15 | import python |
16 | 16 |
|
17 | 17 | predicate incorrect_except_order(ExceptStmt ex1, ClassValue cls1, ExceptStmt ex2, ClassValue cls2) { |
18 | | - exists(int i, int j, Try t | |
19 | | - ex1 = t.getHandler(i) and |
20 | | - ex2 = t.getHandler(j) and |
21 | | - i < j and |
22 | | - cls1 = except_class(ex1) and |
23 | | - cls2 = except_class(ex2) and |
24 | | - cls1 = cls2.getASuperType() |
25 | | - ) |
| 18 | + exists(int i, int j, Try t | |
| 19 | + ex1 = t.getHandler(i) and |
| 20 | + ex2 = t.getHandler(j) and |
| 21 | + i < j and |
| 22 | + cls1 = except_class(ex1) and |
| 23 | + cls2 = except_class(ex2) and |
| 24 | + cls1 = cls2.getASuperType() |
| 25 | + ) |
26 | 26 | } |
27 | 27 |
|
28 | 28 | ClassValue except_class(ExceptStmt ex) { ex.getType().pointsTo(result) } |
29 | 29 |
|
30 | 30 | from ExceptStmt ex1, ClassValue cls1, ExceptStmt ex2, ClassValue cls2 |
31 | 31 | where incorrect_except_order(ex1, cls1, ex2, cls2) |
32 | 32 | select ex2, |
33 | | - "Except block for $@ is unreachable; the more general $@ for $@ will always be executed in preference.", |
34 | | - cls2, cls2.getName(), ex1, "except block", cls1, cls1.getName() |
| 33 | + "Except block for $@ is unreachable; the more general $@ for $@ will always be executed in preference.", |
| 34 | + cls2, cls2.getName(), ex1, "except block", cls1, cls1.getName() |
0 commit comments