Skip to content

Commit fb44aa1

Browse files
authored
Merge pull request #2428 from erik-krogh/useOfReturnlessFunctionSuperCalls
Approved by max-schaefer
2 parents cf92022 + 4efc71b commit fb44aa1

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

javascript/ql/src/Statements/UseOfReturnlessFunction.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ where
222222
not lastStatementHasNoEffect(func) and
223223
// anonymous one-shot closure. Those are used in weird ways and we ignore them.
224224
not oneshotClosure(call) and
225-
not hasNonVoidReturnType(func)
225+
not hasNonVoidReturnType(func) and
226+
not call.getEnclosingExpr() instanceof SuperCall
226227
select
227228
call, msg, func, name

javascript/ql/test/query-tests/Statements/UseOfReturnlessFunction/tst.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,16 @@
9292

9393
+function() {
9494
console.log("FOO");
95-
}.call(this);
95+
}.call(this);
96+
97+
class Foo {
98+
constructor() {
99+
console.log("FOO");
100+
}
101+
}
102+
103+
class Bar extends Foo {
104+
constructor() {
105+
console.log(super()); // OK.
106+
}
107+
}

0 commit comments

Comments
 (0)