mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
JS: support indirection with extra args in js/missing-this-qualifier
This commit is contained in:
@@ -50,5 +50,13 @@ where maybeMissingThis(call, intendedTarget, gv)
|
||||
decl.isNamespaceExport() and
|
||||
call.getContainer().getEnclosingContainer*() instanceof NamespaceDeclaration
|
||||
)
|
||||
or
|
||||
// call to global function with additional arguments
|
||||
exists (Function self |
|
||||
intendedTarget.getBody() = self and
|
||||
call.getEnclosingFunction() = self and
|
||||
call.flow().(DataFlow::CallNode).getNumArgument() > self.getNumParameter() and
|
||||
not self.usesArgumentsObject()
|
||||
)
|
||||
)
|
||||
select call, "This call refers to a global function, and not the local method $@.", intendedTarget, intendedTarget.getName()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class X {
|
||||
m() {
|
||||
m("default"); // OK
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user