Skip to content

Commit 012e138

Browse files
helper for typed subclassing
1 parent 40da109 commit 012e138

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

python/ql/src/Statements/StatementNoEffect.ql

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,18 @@ private Function getAnOverload() {
114114
)
115115
}
116116

117+
private API::Node getATypedSubclass(API::Node base) {
118+
// class Result(base, ...)
119+
result = base.getASubclass()
120+
or
121+
// Result = base[...]
122+
result = base.getASubscript()
123+
}
124+
117125
private ClassDef getAProtocolDef() {
118126
exists(Expr e |
119127
e =
120-
API::moduleImport("typing")
121-
.getMember("Protocol")
122-
.getASubclass*()
128+
getATypedSubclass*(API::moduleImport("typing").getMember("Protocol"))
123129
.getAValueReachableFromSource()
124130
.asExpr()
125131
|

0 commit comments

Comments
 (0)