mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Merge pull request #7003 from asgerf/js/mixed-this-fp
Approved by erik-krogh
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
import javascript
|
||||
|
||||
/** Holds if `base` declares or inherits method `m` with the given `name`. */
|
||||
predicate hasMethod(ClassDefinition base, string name, MethodDefinition m) {
|
||||
predicate hasMethod(ClassDefinition base, string name, MethodDeclaration m) {
|
||||
m = base.getMethod(name) or
|
||||
hasMethod(base.getSuperClassDefinition(), name, m)
|
||||
}
|
||||
@@ -22,7 +22,7 @@ predicate hasMethod(ClassDefinition base, string name, MethodDefinition m) {
|
||||
* where `fromMethod` and `toMethod` are of kind `fromKind` and `toKind`, respectively.
|
||||
*/
|
||||
predicate isLocalMethodAccess(
|
||||
PropAccess access, MethodDefinition fromMethod, string fromKind, MethodDefinition toMethod,
|
||||
PropAccess access, MethodDefinition fromMethod, string fromKind, MethodDeclaration toMethod,
|
||||
string toKind
|
||||
) {
|
||||
hasMethod(fromMethod.getDeclaringClass(), access.getPropertyName(), toMethod) and
|
||||
@@ -32,7 +32,7 @@ predicate isLocalMethodAccess(
|
||||
toKind = getKind(toMethod)
|
||||
}
|
||||
|
||||
string getKind(MethodDefinition m) {
|
||||
string getKind(MethodDeclaration m) {
|
||||
if m.isStatic() then result = "static" else result = "instance"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
abstract class Q {
|
||||
abstract test();
|
||||
static test() {}
|
||||
|
||||
method() {
|
||||
this.test(); // OK
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user