Introduce getAUse

This commit is contained in:
Robert
2023-02-27 17:44:48 +00:00
parent 4c880dfb19
commit 6f5ac5df4f

View File

@@ -26,7 +26,12 @@
/**
* In how many ways is this command used. Will always be at least 1.
*/
int getNumberOfUsages() { result = count(CommandUsage e | e.getCommandName() = this | e) }
int getNumberOfUsages() { result = count(this.getAUse()) }
/**
* Get a usage of this command.
*/
CommandUsage getAUse() { result.getCommandName() = this }
/**
* Get the canonical first usage of this command, to use for the location
@@ -35,10 +40,7 @@
* the alert.
*/
CommandUsage getFirstUsage() {
result.getCommandName() = this and
forall(CommandUsage e | e.getCommandName() = this |
e.getLocationOrdinal() >= result.getLocationOrdinal()
)
result = max(CommandUsage use | use = this.getAUse() | use order by use.getLocationOrdinal())
}
}