All languages: Add getPrimaryQlClasses()

This is a non-overridable predicate that concatenates all the
getAPrimaryQlClass() results into a comma-separated string.
This commit is contained in:
Ian Lynagh
2021-08-23 13:12:47 +01:00
parent 0210d85ce8
commit a9db1c52e5
13 changed files with 34 additions and 6 deletions

View File

@@ -100,6 +100,11 @@ class Top extends @top {
cached
string toString() { hasName(this, result) }
/**
* Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.
*/
final string getPrimaryQlClasses() { result = concat(getAPrimaryQlClass(), ",") }
/**
* Gets the name of a primary CodeQL class to which this element belongs.
*

View File

@@ -89,7 +89,7 @@ private predicate duplicateMetadata(Field f) {
* Retrieves the canonical QL class(es) for entity `el`
*/
private string getQlClass(Top el) {
result = "[" + concat(el.getAPrimaryQlClass(), ",") + "] "
result = "[" + el.getPrimaryQlClasses() + "] "
// Alternative implementation -- do not delete. It is useful for QL class discovery.
// result = "[" + concat(el.getAQlClass(), ",") + "] "
}