@@ -31,7 +31,7 @@ predicate no_comment(ExceptStmt ex) {
31
31
}
32
32
33
33
predicate non_local_control_flow ( ExceptStmt ex ) {
34
- ex .getType ( ) .refersTo ( theStopIterationType ( ) )
34
+ ex .getType ( ) .pointsTo ( ClassValue :: stopIteration ( ) )
35
35
}
36
36
37
37
predicate try_has_normal_exit ( Try try ) {
@@ -64,32 +64,29 @@ predicate subscript(Stmt s) {
64
64
s .( Delete ) .getATarget ( ) instanceof Subscript
65
65
}
66
66
67
- predicate encode_decode ( Expr ex , ClassObject type ) {
67
+ predicate encode_decode ( Call ex , ClassValue type ) {
68
68
exists ( string name |
69
- ex .( Call ) . getFunc ( ) .( Attribute ) .getName ( ) = name |
70
- name = "encode" and type = Object :: builtin ( "UnicodeEncodeError" )
69
+ ex .getFunc ( ) .( Attribute ) .getName ( ) = name |
70
+ name = "encode" and type = ClassValue :: unicodeEncodeError ( )
71
71
or
72
- name = "decode" and type = Object :: builtin ( "UnicodeDecodeError" )
72
+ name = "decode" and type = ClassValue :: unicodeDecodeError ( )
73
73
)
74
74
}
75
75
76
- predicate small_handler ( ExceptStmt ex , Stmt s , ClassObject type ) {
76
+ predicate small_handler ( ExceptStmt ex , Stmt s , ClassValue type ) {
77
77
not exists ( ex .getTry ( ) .getStmt ( 1 ) ) and
78
78
s = ex .getTry ( ) .getStmt ( 0 ) and
79
- ex .getType ( ) .refersTo ( type )
79
+ ex .getType ( ) .pointsTo ( type )
80
80
}
81
81
82
- /** Holds if this exception handler is sufficiently small in scope to not need a comment
83
- * as to what it is doing.
84
- */
85
82
predicate focussed_handler ( ExceptStmt ex ) {
86
- exists ( Stmt s , ClassObject type |
83
+ exists ( Stmt s , ClassValue type |
87
84
small_handler ( ex , s , type ) |
88
- subscript ( s ) and type .getAnImproperSuperType ( ) = theLookupErrorType ( )
85
+ subscript ( s ) and type .getASuperType ( ) = ClassValue :: lookupError ( )
89
86
or
90
- attribute_access ( s ) and type = theAttributeErrorType ( )
87
+ attribute_access ( s ) and type = ClassValue :: attributeError ( )
91
88
or
92
- s .( ExprStmt ) .getValue ( ) instanceof Name and type = theNameErrorType ( )
89
+ s .( ExprStmt ) .getValue ( ) instanceof Name and type = ClassValue :: nameError ( )
93
90
or
94
91
encode_decode ( s .( ExprStmt ) .getValue ( ) , type )
95
92
)
0 commit comments