Python: Share implementation of awaited

This commit is contained in:
Rasmus Lerchedahl Petersen
2021-10-27 11:41:18 +02:00
parent 01ad19b82b
commit 826f44d98e
4 changed files with 55 additions and 78 deletions

View File

@@ -9,18 +9,18 @@ class AwaitedTest extends InlineExpectationsTest {
override string getARelevantTag() { result = "awaited" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
exists(API::Node a, DataFlow::Node n, API::Node pred |
a = pred.getAwaited() and
n = a.getAUse() and
location = n.getLocation() and
exists(API::Node awaited, DataFlow::Node use, API::Node pred |
awaited = pred.getAwaited() and
use = awaited.getAUse() and
location = use.getLocation() and
// Module variable nodes have no suitable location, so it's best to simply exclude them entirely
// from the inline tests.
not n instanceof DataFlow::ModuleVariableNode and
not use instanceof DataFlow::ModuleVariableNode and
exists(location.getFile().getRelativePath())
|
tag = "awaited" and
value = pred.getPath() and
element = n.toString()
element = use.toString()
)
}
}