Skip to content

Commit 45f5825

Browse files
committed
Python API: Add ClassValue.getABaseType()
1 parent 6c6e35f commit 45f5825

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

python/ql/src/semmle/python/objects/ObjectAPI.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ class ClassValue extends Value {
322322

323323
/** Gets an improper super type of this class. */
324324
ClassValue getASuperType() {
325-
result = this.getBaseType(_)
326-
or
327-
result = this.getASuperType().getBaseType(_)
328-
or
329-
result = this
325+
result = this.getABaseType*()
330326
}
331327

332328
/** Looks up the attribute `name` on this class.
@@ -371,6 +367,11 @@ class ClassValue extends Value {
371367
result = Types::getBase(this, n)
372368
}
373369

370+
/** Gets a base class of this class */
371+
ClassValue getABaseType() {
372+
result = Types::getBase(this, _)
373+
}
374+
374375
/** Holds if this class is a new style class.
375376
A new style class is one that implicitly or explicitly inherits from `object`. */
376377
predicate isNewStyle() {

0 commit comments

Comments
 (0)