@@ -28,9 +28,9 @@ predicate probablySingleton(ClassValue cls) {
2828
2929predicate invalid_to_use_is_portably ( ClassValue c ) {
3030 overrides_eq_or_cmp ( c ) and
31- /* Exclude type/builtin-function/bool as it is legitimate to compare them using 'is' but they implement __eq__ */
31+ // Exclude type/builtin-function/bool as it is legitimate to compare them using 'is' but they implement __eq__
3232 not c = Value:: named ( "type" ) and not c = ClassValue:: builtinFunction ( ) and not c = Value:: named ( "bool" ) and
33- /* OK to compare with 'is' if a singleton */
33+ // OK to compare with 'is' if a singleton
3434 not probablySingleton ( c )
3535}
3636
@@ -95,7 +95,7 @@ private predicate comparison_one_type(Compare comp, Cmpop op, ClassValue cls) {
9595}
9696
9797predicate invalid_portable_is_comparison ( Compare comp , Cmpop op , ClassValue cls ) {
98- /* OK to use 'is' when defining '__eq__' */
98+ // OK to use 'is' when defining '__eq__'
9999 not exists ( Function eq | eq .getName ( ) = "__eq__" or eq .getName ( ) = "__ne__" | eq = comp .getScope ( ) .getScope * ( ) )
100100 and
101101 (
@@ -107,20 +107,20 @@ predicate invalid_portable_is_comparison(Compare comp, Cmpop op, ClassValue cls)
107107 )
108108 )
109109 and
110- /* OK to use 'is' when comparing items from a known set of objects */
110+ // OK to use 'is' when comparing items from a known set of objects
111111 not exists ( Expr left , Expr right , Value val |
112112 comp .compares ( left , op , right ) and
113113 exists ( ImmutableLiteral il | il .getLiteralValue ( ) = val ) |
114114 left .pointsTo ( val ) and right .pointsTo ( val )
115115 or
116- /* Simple constant in module, probably some sort of sentinel */
116+ // Simple constant in module, probably some sort of sentinel
117117 exists ( AstNode origin |
118118 not left .pointsTo ( _) and right .pointsTo ( val , origin ) and
119119 origin .getScope ( ) .getEnclosingModule ( ) = comp .getScope ( ) .getEnclosingModule ( )
120120 )
121121 )
122122 and
123- /* OK to use 'is' when comparing with a member of an enum */
123+ // OK to use 'is' when comparing with a member of an enumÏ
124124 not exists ( Expr left , Expr right , AstNode origin |
125125 comp .compares ( left , op , right ) and
126126 enum_member ( origin ) |
0 commit comments