fix bad join-order in js/missing-this-qualifier

This commit is contained in:
erik-krogh
2023-01-09 16:06:26 +01:00
parent 5157d4df7b
commit 785c21f462

View File

@@ -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