@@ -432,24 +432,27 @@ class ClassValue extends Value {
432
432
433
433
/** Holds if this class is an iterator. */
434
434
predicate isIterator ( ) {
435
- this .hasAttribute ( "__iter__" ) and
436
- ( major_version ( ) = 3 and this .hasAttribute ( "__next__" )
437
- or
438
- /* Because 'next' is a common method name we need to check that an __iter__
439
- * method actually returns this class. This is not needed for Py3 as the
440
- * '__next__' method exists to define a class as an iterator.
441
- */
442
- major_version ( ) = 2 and this .hasAttribute ( "next" ) and
443
- exists ( ClassValue other , FunctionValue iter |
444
- other .declaredAttribute ( "__iter__" ) = iter |
445
- iter .getAnInferredReturnType ( ) = this
446
- )
435
+ this .hasAttribute ( "__iter__" ) and
436
+ (
437
+ major_version ( ) = 3 and this .hasAttribute ( "__next__" )
438
+ or
439
+ /*
440
+ * Because 'next' is a common method name we need to check that an __iter__
441
+ * method actually returns this class. This is not needed for Py3 as the
442
+ * '__next__' method exists to define a class as an iterator.
443
+ */
444
+
445
+ major_version ( ) = 2 and
446
+ this .hasAttribute ( "next" ) and
447
+ exists ( ClassValue other , FunctionValue iter | other .declaredAttribute ( "__iter__" ) = iter |
448
+ iter .getAnInferredReturnType ( ) = this
449
+ )
447
450
)
448
451
or
449
452
/* This will be redundant when we have C class information */
450
453
this = ClassValue:: generator ( )
451
454
}
452
-
455
+
453
456
/** Holds if this class is a container(). That is, does it have a __getitem__ method. */
454
457
predicate isContainer ( ) { exists ( this .lookup ( "__getitem__" ) ) }
455
458
0 commit comments