CPP: QLDoc helper predicates.

This commit is contained in:
Geoffrey White
2019-11-05 13:06:43 +00:00
parent 3584c0b2e5
commit 5106626bd0

View File

@@ -619,35 +619,41 @@ Function getAPossibleDefinition(Function undefinedFunction) {
result.isDefined()
}
/**
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
*
* If there is at least one defined target after performing some simple virtual dispatch
* resolution, then the result is all the defined targets.
*/
private Function getTarget1(Call c) {
/*
* If there is at least one defined target after performing some simple virtual dispatch
* resolution, then the result is all the defined targets.
*/
result = VirtualDispatch::getAViableTarget(c) and
result.isDefined()
}
/**
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
*
* If we can use the heuristic matching of functions to find definitions for some of the viable
* targets, return those.
*/
private Function getTarget2(Call c) {
/*
* If we can use the heuristic matching of functions to find definitions for some of the viable
* targets, return those.
*/
not exists(getTarget1(c)) and
result = getAPossibleDefinition(VirtualDispatch::getAViableTarget(c))
}
/**
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
*
* Otherwise, the result is the undefined `Function` instances.
*/
private Function getTarget3(Call c) {
not exists(getTarget1(c)) and
not exists(getTarget2(c)) and
// Otherwise, the result is the undefined `Function` instances.
result = VirtualDispatch::getAViableTarget(c)
}
/**
* Gets a possible target for the Call, using the name and parameter matching if we did not associate
* Gets a possible target for the `Call`, using the name and parameter matching if we did not associate
* this call with a specific definition at link or compile time, and performing simple virtual
* dispatch resolution.
*/