@@ -163,49 +163,20 @@ private module Django {
163163 t .startInAttr ( "Model" ) and
164164 result = models ( )
165165 or
166+ // subclass
167+ result .asExpr ( ) .( ClassExpr ) .getABase ( ) = classRef ( t .continue ( ) ) .asExpr ( )
168+ or
166169 exists ( DataFlow:: TypeTracker t2 | result = classRef ( t2 ) .track ( t2 , t ) )
167170 }
168171
169172 /** Gets a reference to the `django.db.models.Model` class. */
170173 DataFlow:: Node classRef ( ) { result = classRef ( DataFlow:: TypeTracker:: end ( ) ) }
171-
172- /** Gets a definition of a subclass the `django.db.models.Model` class. */
173- class SubclassDef extends ControlFlowNode {
174- string name ;
175-
176- SubclassDef ( ) {
177- exists ( ClassExpr ce |
178- this .getNode ( ) = ce and
179- ce .getABase ( ) = classRef ( ) .asExpr ( ) and
180- ce .getName ( ) = name
181- )
182- }
183-
184- string getName ( ) { result = name }
185- }
186-
187- /**
188- * A reference to a class that is a subclass of the `django.db.models.Model` class.
189- * This is an approximation, since it simply matches identifiers.
190- */
191- private DataFlow:: Node subclassRef ( DataFlow:: TypeTracker t ) {
192- t .start ( ) and
193- result .asCfgNode ( ) .( NameNode ) .getId ( ) = any ( SubclassDef cd ) .getName ( )
194- or
195- exists ( DataFlow:: TypeTracker t2 | result = subclassRef ( t2 ) .track ( t2 , t ) )
196- }
197-
198- /**
199- * A reference to a class that is a subclass of the `django.db.models.Model` class.
200- * This is an approximation, since it simply matches identifiers.
201- */
202- DataFlow:: Node subclassRef ( ) { result = subclassRef ( DataFlow:: TypeTracker:: end ( ) ) }
203174 }
204175
205176 /** Gets a reference to the `objects` object of a django model. */
206177 private DataFlow:: Node objects ( DataFlow:: TypeTracker t ) {
207178 t .startInAttr ( "objects" ) and
208- result = Model:: subclassRef ( )
179+ result = Model:: classRef ( )
209180 or
210181 exists ( DataFlow:: TypeTracker t2 | result = objects ( t2 ) .track ( t2 , t ) )
211182 }
0 commit comments