mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
For now, these have just been made into `private` imports. After doing
this, I went through all of the (now not compiling) files and added in
private imports to the modules that they actually depended on.
I also added an explicit import of `LegacyPointsTo` (even though it may
be unnecessary) in cases where the points-to dependency was somewhat
surprising (and one we want to get rid of). This was primarily inside
the various SSA layers.
For modules inside `semmle.python.{types, objects, pointsto}` I did not
bother, as these are fairly clearly related to points-to.
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
/** Utilities for handling the zope libraries */
|
|
|
|
import python
|
|
private import LegacyPointsTo
|
|
|
|
/** A method that belongs to a sub-class of `zope.interface.Interface` */
|
|
class ZopeInterfaceMethodValue extends PythonFunctionValue {
|
|
/** Holds if this method belongs to a class that sub-classes `zope.interface.Interface` */
|
|
ZopeInterfaceMethodValue() {
|
|
exists(Value interface, ClassValue owner |
|
|
interface = Module::named("zope.interface").attr("Interface") and
|
|
owner.declaredAttribute(_) = this and
|
|
// `zope.interface.Interface` will be recognized as a Value by the pointsTo analysis,
|
|
// because it is the result of instantiating a "meta" class. getASuperType only returns
|
|
// ClassValues, so we do this little trick to make things work
|
|
Types::getBase(owner.getASuperType(), _) = interface
|
|
)
|
|
}
|
|
|
|
override int minParameters() { result = super.minParameters() + 1 }
|
|
|
|
override int maxParameters() {
|
|
if exists(this.getScope().getVararg())
|
|
then result = super.maxParameters()
|
|
else result = super.maxParameters() + 1
|
|
}
|
|
}
|