cached stages iteration 2

This commit is contained in:
Erik Krogh Kristensen
2021-12-07 11:16:25 +01:00
parent 71eacea90b
commit 60b5af215f
8 changed files with 81 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import python
private import semmle.python.objects.ObjectAPI
private import semmle.python.objects.Modules
private import semmle.python.internal.CachedStages
/**
* A module. This is the top level element in an AST, corresponding to a source file.
@@ -221,7 +222,9 @@ private predicate transitively_imported_from_entry_point(File file) {
)
}
cached
string moduleNameFromFile(Container file) {
Stages::SSA::ref() and
exists(string basename |
basename = moduleNameFromBase(file) and
legalShortName(basename)