Skip to content

Commit

Permalink
Further simplify interpretElement to avoid 'm' only being used on one…
Browse files Browse the repository at this point in the history
… side of a disjunction
  • Loading branch information
smowton authored and owen-mc committed Nov 11, 2024
1 parent d9126d3 commit 520acc4
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions go/ql/lib/semmle/go/dataflow/ExternalFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,21 @@ SourceSinkInterpretationInput::SourceOrSinkElement interpretElement(
// Go does not need to distinguish functions with signature
signature = "" and
exists(string p | p = interpretPackage(pkg) |
result.asEntity().(Field).hasQualifiedName(p, type, name) and
result.hasTypeInfo(p, type, subtypes)
result.hasTypeInfo(p, type, subtypes) and
(
result.asEntity().(Field).hasQualifiedName(p, type, name) or
result.asEntity().(Method).hasQualifiedName(p, type, name)
)
or
exists(Method m | m.hasQualifiedName(p, type, name) |
result.asEntity() = m and
result.hasTypeInfo(p, type, subtypes)
or
subtypes = true and
// p.type is an interface and we include types which implement it
exists(Method m2, string pkg2, string type2 |
m2.getReceiverType().implements(p, type) and
m2.getName() = name and
m2.getReceiverBaseType().hasQualifiedName(pkg2, type2)
|
result.asEntity() = m2 and
result.hasTypeInfo(pkg2, type2, subtypes)
)
subtypes = true and
// p.type is an interface and we include types which implement it
exists(Method m2, string pkg2, string type2 |
m2.getReceiverType().implements(p, type) and
m2.getName() = name and
m2.getReceiverBaseType().hasQualifiedName(pkg2, type2)
|
result.asEntity() = m2 and
result.hasTypeInfo(pkg2, type2, subtypes)
)
or
type = "" and
Expand Down

0 comments on commit 520acc4

Please sign in to comment.