Shared: prefer exists(var) instead of var = any(string s)

This commit is contained in:
Asger Feldthaus
2022-03-16 13:37:08 +01:00
parent 102540072e
commit e3fbaf5d8f
2 changed files with 4 additions and 4 deletions

View File

@@ -217,5 +217,5 @@ predicate isExtraValidNoArgumentTokenInIdentifyingAccessPath(string name) {
bindingset[name, argument]
predicate isExtraValidTokenArgumentInIdentifyingAccessPath(string name, string argument) {
name = ["Member"] and
argument = any(string s)
exists(argument)
}

View File

@@ -50,13 +50,13 @@ predicate isPackageUsed(string package) {
bindingset[package, type, path]
API::Node getExtraNodeFromPath(string package, string type, AccessPath path, int n) {
isRelevantFullPath(package, type, path) and
package = any(string s) and // Allow any package name, see `isPackageUsed`.
exists(package) and // Allow any package name, see `isPackageUsed`.
type = "" and
n = 0 and
result = API::root()
or
// A row of form `;any;Method[foo]` should match any method named `foo`.
package = any(string s) and
exists(package) and
type = "any" and
n = 1 and
exists(EntryPointFromAnyType entry |
@@ -164,5 +164,5 @@ predicate isExtraValidNoArgumentTokenInIdentifyingAccessPath(string name) {
bindingset[name, argument]
predicate isExtraValidTokenArgumentInIdentifyingAccessPath(string name, string argument) {
name = ["Member", "Method"] and
argument = any(string s)
exists(argument)
}