Skip to content

Commit d52b2bd

Browse files
committed
JS: Fix FP in ˚MixedStaticInstanceThisAccess
1 parent afa6424 commit d52b2bd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

javascript/ql/src/Declarations/MixedStaticInstanceThisAccess.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import javascript
1313

1414
/** Holds if `base` declares or inherits method `m` with the given `name`. */
15-
predicate hasMethod(ClassDefinition base, string name, MethodDefinition m) {
15+
predicate hasMethod(ClassDefinition base, string name, MethodDeclaration m) {
1616
m = base.getMethod(name) or
1717
hasMethod(base.getSuperClassDefinition(), name, m)
1818
}
@@ -22,7 +22,7 @@ predicate hasMethod(ClassDefinition base, string name, MethodDefinition m) {
2222
* where `fromMethod` and `toMethod` are of kind `fromKind` and `toKind`, respectively.
2323
*/
2424
predicate isLocalMethodAccess(
25-
PropAccess access, MethodDefinition fromMethod, string fromKind, MethodDefinition toMethod,
25+
PropAccess access, MethodDefinition fromMethod, string fromKind, MethodDeclaration toMethod,
2626
string toKind
2727
) {
2828
hasMethod(fromMethod.getDeclaringClass(), access.getPropertyName(), toMethod) and
@@ -32,7 +32,7 @@ predicate isLocalMethodAccess(
3232
toKind = getKind(toMethod)
3333
}
3434

35-
string getKind(MethodDefinition m) {
35+
string getKind(MethodDeclaration m) {
3636
if m.isStatic() then result = "static" else result = "instance"
3737
}
3838

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
| abstract.ts:6:9:6:17 | this.test | Access to static method $@ from instance method $@ is not possible through `this`. | abstract.ts:3:5:3:20 | static test() {} | test | abstract.ts:5:5:7:5 | method( ... K\\n } | method |
21
| instanceStatic.js:3:9:3:16 | this.baz | Access to instance method $@ from static method $@ is not possible through `this`. | instanceStatic.js:5:5:7:5 | baz(){\\n\\n } | baz | instanceStatic.js:2:5:4:5 | static ... K\\n } | bar |
32
| staticInstance.js:3:9:3:16 | this.baz | Access to static method $@ from instance method $@ is not possible through `this`. | staticInstance.js:5:5:6:5 | static baz(){\\n } | baz | staticInstance.js:2:5:4:5 | bar(){\\n ... K\\n } | bar |
43
| tst.js:66:9:66:14 | this.f | Access to instance method $@ from static method $@ is not possible through `this`. | tst.js:60:5:62:5 | f() {\\n\\n } | f | tst.js:65:5:67:5 | static ... K\\n } | test |

0 commit comments

Comments
 (0)