Skip to content

Commit 12fd77f

Browse files
committed
Merge pull request #3 from asgerf/js/merge_classes
JS: Avoid duplication with constructor body
2 parents c430a36 + 3575fba commit 12fd77f

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/ClassNode/tests.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ getAReceiverNode
1515
| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:4:17:4:16 | this |
1616
| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:7:6:7:5 | this |
1717
| tst.js:3:1:10:1 | class A ... () {}\\n} | tst.js:9:10:9:9 | this |
18-
| tst.js:3:9:3:8 | () {} | tst.js:3:9:3:8 | this |
1918
| tst.js:13:1:13:21 | class A ... ds A {} | tst.js:13:20:13:19 | this |
2019
| tst.js:15:1:15:15 | function B() {} | tst.js:15:1:15:0 | this |
2120
| tst.js:15:1:15:15 | function B() {} | tst.js:17:19:17:18 | this |

0 commit comments

Comments
 (0)