Skip to content

Commit c571721

Browse files
Napalysasgerf
andcommitted
Update Nodes.qll
Applied suggestions Co-Authored-By: Asger F <316427+asgerf@users.noreply.github.com>
1 parent 6a284ee commit c571721

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,11 +1242,12 @@ module ClassNode {
12421242
*/
12431243
class FunctionStyleClass extends Range, DataFlow::ValueNode {
12441244
override AST::ValueNode astNode;
1245-
AbstractFunction function;
1245+
AbstractCallable function;
12461246

12471247
FunctionStyleClass() {
12481248
// ES6 class case
1249-
astNode instanceof ClassDefinition
1249+
astNode instanceof ClassDefinition and
1250+
function.(AbstractClass).getClass() = astNode
12501251
or
12511252
// Function-style class case
12521253
astNode instanceof Function and

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ 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 | () {} |
197198
| fields.js:1:1:4:1 | class C ... = 42\\n} | fields.js:1:9:1:8 | () {} |
198199
| points.js:1:1:18:1 | class P ... ;\\n }\\n} | points.js:2:14:5:3 | (x, y) ... y;\\n } |
199200
| 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)