mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
add a getImportString utility predicate to Import
This commit is contained in:
@@ -1129,6 +1129,21 @@ class Import extends TImport, ModuleMember, ModuleRef {
|
||||
result = imp.getChild(0).(QL::ImportModuleExpr).getChild().getName(i).getValue()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full string specifying the module being imported.
|
||||
*/
|
||||
string getImportString() {
|
||||
exists(string selec |
|
||||
not exists(getQualifiedName(_)) and selec = ""
|
||||
or
|
||||
selec =
|
||||
"::" + strictconcat(int i, string q | q = this.getSelectionName(i) | q, "::" order by i)
|
||||
|
|
||||
result =
|
||||
strictconcat(int i, string q | q = this.getQualifiedName(i) | q, "." order by i) + selec
|
||||
)
|
||||
}
|
||||
|
||||
final override FileOrModule getResolvedModule() { resolve(this, result) }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user