Merge pull request #6536 from github/igfoo/getPrimaryQlClasses

All languages: Add getPrimaryQlClasses()
This commit is contained in:
Ian Lynagh
2021-08-23 19:49:37 +01:00
committed by GitHub
13 changed files with 34 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
lgtm,codescanning
* Added `Locatable.getPrimaryQlClasses()` predicate, which gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

View File

@@ -132,6 +132,11 @@ class Locatable extends @locatable {
none()
}
/**
* 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 primary QL class for the Locatable.
*/

View File

@@ -44,9 +44,9 @@ private predicate isNotNeeded(Locatable el) {
* Retrieves the canonical QL class(es) for entity `el`
*/
private string getQlClass(Locatable el) {
result = "[" + concat(el.getAPrimaryQlClass(), ",") + "] "
result = "[" + el.getPrimaryQlClasses() + "] "
// Alternative implementation -- do not delete. It is useful for QL class discovery.
// not el.getAPrimaryQlClass() = "???" and result = "[" + concat(el.getAPrimaryQlClass(), ",") + "] " or el.getAPrimaryQlClass() = "???" and result = "??[" + concat(el.getAQlClass(), ",") + "] "
// not el.getAPrimaryQlClass() = "???" and result = "[" + getPrimaryQlClasses() + "] " or el.getAPrimaryQlClass() = "???" and result = "??[" + concat(el.getAQlClass(), ",") + "] "
}
/**