mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
fix bad join-order in js/missing-this-qualifier
This commit is contained in:
@@ -20,11 +20,17 @@ predicate maybeMissingThis(CallExpr call, MethodDeclaration intendedTarget, Glob
|
||||
call.getCallee() = gv.getAnAccess() and
|
||||
call.getCalleeName() = intendedTarget.getName() and
|
||||
exists(MethodDefinition caller |
|
||||
caller.getBody() = call.getContainer() and
|
||||
caller.getBody() = getRelevantCallExprContainer(call) and
|
||||
intendedTarget.getDeclaringClass() = caller.getDeclaringClass()
|
||||
)
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private StmtContainer getRelevantCallExprContainer(CallExpr c) {
|
||||
result = c.getContainer() and
|
||||
c.getCallee() = any(GlobalVariable v).getAnAccess()
|
||||
}
|
||||
|
||||
from CallExpr call, MethodDeclaration intendedTarget, GlobalVariable gv
|
||||
where
|
||||
maybeMissingThis(call, intendedTarget, gv) and
|
||||
@@ -46,7 +52,7 @@ where
|
||||
exists(Variable decl |
|
||||
decl.getName() = gv.getName() and
|
||||
decl.isNamespaceExport() and
|
||||
call.getContainer().getEnclosingContainer*() instanceof NamespaceDeclaration
|
||||
getRelevantCallExprContainer(call).getEnclosingContainer*() instanceof NamespaceDeclaration
|
||||
)
|
||||
or
|
||||
// call to global function with additional arguments
|
||||
|
||||
Reference in New Issue
Block a user