@@ -31,7 +31,7 @@ predicate no_comment(ExceptStmt ex) {
3131}
3232
3333predicate non_local_control_flow ( ExceptStmt ex ) {
34- ex .getType ( ) .refersTo ( theStopIterationType ( ) )
34+ ex .getType ( ) .pointsTo ( ClassValue :: stopIteration ( ) )
3535}
3636
3737predicate try_has_normal_exit ( Try try ) {
@@ -64,32 +64,29 @@ predicate subscript(Stmt s) {
6464 s .( Delete ) .getATarget ( ) instanceof Subscript
6565}
6666
67- predicate encode_decode ( Expr ex , ClassObject type ) {
67+ predicate encode_decode ( Call ex , ClassValue type ) {
6868 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 ( )
7171 or
72- name = "decode" and type = Object :: builtin ( "UnicodeDecodeError" )
72+ name = "decode" and type = ClassValue :: unicodeDecodeError ( )
7373 )
7474}
7575
76- predicate small_handler ( ExceptStmt ex , Stmt s , ClassObject type ) {
76+ predicate small_handler ( ExceptStmt ex , Stmt s , ClassValue type ) {
7777 not exists ( ex .getTry ( ) .getStmt ( 1 ) ) and
7878 s = ex .getTry ( ) .getStmt ( 0 ) and
79- ex .getType ( ) .refersTo ( type )
79+ ex .getType ( ) .pointsTo ( type )
8080}
8181
82- /** Holds if this exception handler is sufficiently small in scope to not need a comment
83- * as to what it is doing.
84- */
8582predicate focussed_handler ( ExceptStmt ex ) {
86- exists ( Stmt s , ClassObject type |
83+ exists ( Stmt s , ClassValue type |
8784 small_handler ( ex , s , type ) |
88- subscript ( s ) and type .getAnImproperSuperType ( ) = theLookupErrorType ( )
85+ subscript ( s ) and type .getASuperType ( ) = ClassValue :: lookupError ( )
8986 or
90- attribute_access ( s ) and type = theAttributeErrorType ( )
87+ attribute_access ( s ) and type = ClassValue :: attributeError ( )
9188 or
92- s .( ExprStmt ) .getValue ( ) instanceof Name and type = theNameErrorType ( )
89+ s .( ExprStmt ) .getValue ( ) instanceof Name and type = ClassValue :: nameError ( )
9390 or
9491 encode_decode ( s .( ExprStmt ) .getValue ( ) , type )
9592 )
0 commit comments