@@ -432,24 +432,27 @@ class ClassValue extends Value {
432432
433433 /** Holds if this class is an iterator. */
434434 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+ )
447450 )
448451 or
449452 /* This will be redundant when we have C class information */
450453 this = ClassValue:: generator ( )
451454 }
452-
455+
453456 /** Holds if this class is a container(). That is, does it have a __getitem__ method. */
454457 predicate isContainer ( ) { exists ( this .lookup ( "__getitem__" ) ) }
455458
0 commit comments