add a getImportString utility predicate to Import

This commit is contained in:
Erik Krogh Kristensen
2022-03-28 10:14:27 +02:00
parent d4c8f42336
commit 77aff04429

View File

@@ -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) }
}