mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Optimise join orders
This commit is contained in:
@@ -79,6 +79,7 @@ class AstNode extends @node, Locatable {
|
||||
}
|
||||
|
||||
/** Gets the innermost function definition to which this AST node belongs, if any. */
|
||||
pragma[nomagic]
|
||||
FuncDef getEnclosingFunction() { result = this.getParent().parentInSameFunction*() }
|
||||
|
||||
/**
|
||||
|
||||
@@ -479,6 +479,13 @@ class Function extends ValueEntity, @functionobject {
|
||||
ResultVariable getAResult() { result = this.getResult(_) }
|
||||
}
|
||||
|
||||
pragma[inline_late]
|
||||
bindingset[m]
|
||||
private Type implementsIncludingInterfaceMethodsCand(Method m, string mname) {
|
||||
result.implements(m.getReceiverType().getUnderlyingType()) and
|
||||
mname = m.getName()
|
||||
}
|
||||
|
||||
/**
|
||||
* A method, that is, a function with a receiver variable, or a function declared in an interface.
|
||||
*
|
||||
@@ -580,9 +587,14 @@ class Method extends Function {
|
||||
predicate implementsIncludingInterfaceMethods(Method m) {
|
||||
this = m
|
||||
or
|
||||
exists(Type t |
|
||||
this = t.getMethod(m.getName()) and
|
||||
t.implements(m.getReceiverType().getUnderlyingType())
|
||||
// Take all methods
|
||||
// Get receiver type then underlying type ==> [method, recvutype]
|
||||
// Map through Type.implements ==> [method, candtype]
|
||||
// Get method name ==> [mname, candtype]
|
||||
// Get corresponding method
|
||||
exists(Type t, string mname |
|
||||
t = implementsIncludingInterfaceMethodsCand(m, mname) and
|
||||
this = t.getMethod(mname)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user