`CallExpr.getCalleeExpr` should get uninstantiated function

This commit is contained in:
Owen Mansel-Chan 2022-04-11 21:31:31 +01:00 коммит произвёл Chris Smowton
Родитель 7a7ca619b3
Коммит ce9c9cfe9d
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -839,7 +839,11 @@ class CallExpr extends CallOrConversionExpr {
} }
/** Gets the expression representing the function being called. */ /** Gets the expression representing the function being called. */
Expr getCalleeExpr() { result = this.getChildExpr(0) } Expr getCalleeExpr() {
if this.getChildExpr(0) instanceof GenericFunctionInstantiationExpr
then result = this.getChildExpr(0).(GenericFunctionInstantiationExpr).getBase()
else result = this.getChildExpr(0)
}
/** Gets the `i`th argument expression of this call (0-based). */ /** Gets the `i`th argument expression of this call (0-based). */
Expr getArgument(int i) { Expr getArgument(int i) {
@ -866,16 +870,11 @@ class CallExpr extends CallOrConversionExpr {
result = callee.(Ident).getName() result = callee.(Ident).getName()
or or
result = callee.(SelectorExpr).getSelector().getName() result = callee.(SelectorExpr).getSelector().getName()
or
result = callee.(GenericFunctionInstantiationExpr).getBase().(Ident).getName()
) )
} }
/** Gets the declared target of this call. */ /** Gets the declared target of this call. */
Function getTarget() { Function getTarget() { this.getCalleeExpr() = result.getAReference() }
this.getCalleeExpr() = result.getAReference() or
this.getCalleeExpr().(GenericFunctionInstantiationExpr).getBase() = result.getAReference()
}
/** Holds if this call has an ellipsis after its last argument. */ /** Holds if this call has an ellipsis after its last argument. */
predicate hasEllipsis() { has_ellipsis(this) } predicate hasEllipsis() { has_ellipsis(this) }