Skip to content

Commit 028aded

Browse files
asgerfNapalys
authored andcommitted
JS: Avoid duplication with constructor body
1 parent c430a36 commit 028aded

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

javascript/ql/lib/semmle/javascript/dataflow/Nodes.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ class ClassNode extends DataFlow::ValueNode, DataFlow::SourceNode {
872872
or
873873
// Function-style class case
874874
astNode instanceof Function and
875+
not astNode = any(ClassDefinition cls).getConstructor().getBody() and
875876
function.getFunction() = astNode and
876877
(
877878
exists(getAFunctionValueWithPrototype(function))

javascript/ql/test/library-tests/Classes/tests.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ test_ConstructorDefinitions
194194
| tst.js:11:9:11:8 | constructor() {} |
195195
test_ClassNodeConstructor
196196
| dataflow.js:4:2:13:2 | class F ... \\n\\t\\t}\\n\\t} | dataflow.js:4:12:4:11 | () {} |
197-
| dataflow.js:4:12:4:11 | () {} | dataflow.js:4:12:4:11 | () {} |
198197
| fields.js:1:1:4:1 | class C ... = 42\\n} | fields.js:1:9:1:8 | () {} |
199198
| points.js:1:1:18:1 | class P ... ;\\n }\\n} | points.js:2:14:5:3 | (x, y) ... y;\\n } |
200199
| points.js:20:1:33:1 | class C ... ;\\n }\\n} | points.js:21:14:24:3 | (x, y, ... c;\\n } |

0 commit comments

Comments
 (0)