зеркало из https://github.com/github/codeql.git
Combine two arms of newtype `TSourceOrSinkElement`
This commit is contained in:
Родитель
b2c2a94866
Коммит
8abb0594c3
|
@ -153,11 +153,12 @@ module SourceSinkInterpretationInput implements
|
||||||
// Methods having multiple qualified names, a given Method is liable to have
|
// Methods having multiple qualified names, a given Method is liable to have
|
||||||
// more than one SourceOrSinkElement, one for each of the names it claims.
|
// more than one SourceOrSinkElement, one for each of the names it claims.
|
||||||
private newtype TSourceOrSinkElement =
|
private newtype TSourceOrSinkElement =
|
||||||
TMethodEntityElement(Method m, string pkg, string type, boolean subtypes) {
|
TMethodOrFieldEntityElement(Entity e, string pkg, string type, boolean subtypes) {
|
||||||
m.hasQualifiedName(pkg, type, _) and subtypes = [true, false]
|
(
|
||||||
} or
|
e.(Method).hasQualifiedName(pkg, type, _) or
|
||||||
TFieldEntityElement(Field f, string pkg, string type, boolean subtypes) {
|
e.(Field).hasQualifiedName(pkg, type, _)
|
||||||
f.hasQualifiedName(pkg, type, _) and subtypes = [true, false]
|
) and
|
||||||
|
subtypes = [true, false]
|
||||||
} or
|
} or
|
||||||
TOtherEntityElement(Entity e) {
|
TOtherEntityElement(Entity e) {
|
||||||
not e instanceof Method and
|
not e instanceof Method and
|
||||||
|
@ -169,8 +170,7 @@ module SourceSinkInterpretationInput implements
|
||||||
class SourceOrSinkElement extends TSourceOrSinkElement {
|
class SourceOrSinkElement extends TSourceOrSinkElement {
|
||||||
/** Gets this source or sink element as an entity, if it is one. */
|
/** Gets this source or sink element as an entity, if it is one. */
|
||||||
Entity asEntity() {
|
Entity asEntity() {
|
||||||
this = TMethodEntityElement(result, _, _, _) or
|
this = TMethodOrFieldEntityElement(result, _, _, _) or
|
||||||
this = TFieldEntityElement(result, _, _, _) or
|
|
||||||
this = TOtherEntityElement(result)
|
this = TOtherEntityElement(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,8 +182,7 @@ module SourceSinkInterpretationInput implements
|
||||||
* with the given values for `pkg`, `type` and `subtypes`.
|
* with the given values for `pkg`, `type` and `subtypes`.
|
||||||
*/
|
*/
|
||||||
predicate hasTypeInfo(string pkg, string type, boolean subtypes) {
|
predicate hasTypeInfo(string pkg, string type, boolean subtypes) {
|
||||||
this = TMethodEntityElement(_, pkg, type, subtypes) or
|
this = TMethodOrFieldEntityElement(_, pkg, type, subtypes)
|
||||||
this = TFieldEntityElement(_, pkg, type, subtypes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this source or sink element. */
|
/** Gets a textual representation of this source or sink element. */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче