Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dacde5d

Browse files
committed
JS: restrict ClassMemberAsPropWrite to static members
1 parent e891ab7 commit dacde5d

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,9 @@ module DataFlow {
478478
private class ClassMemberAsPropWrite extends PropWrite, PropNode {
479479
override MemberDefinition prop;
480480

481-
override Node getBase() {
482-
prop.isStatic() and
483-
result = valueNode(prop.getDeclaringClass())
484-
}
481+
ClassMemberAsPropWrite() { prop.isStatic() }
482+
483+
override Node getBase() { result = valueNode(prop.getDeclaringClass()) }
485484

486485
override Expr getPropertyNameExpr() { result = prop.getNameExpr() }
487486

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
| tst.js:3:5:3:8 | x: 4 |
22
| tst.js:4:5:6:5 | func: f ... ;\\n } |
33
| tst.js:7:5:9:5 | f() {\\n ... ;\\n } |
4-
| tst.js:12:9:12:8 | constructor() {} |
54
| tst.js:13:3:15:3 | static ... x);\\n } |
6-
| tst.js:16:3:18:3 | f(x) {\\n ... x);\\n } |
75
| tst.js:21:1:21:6 | C.prop |
86
| tst.js:24:13:24:27 | onClick={click} |
97
| tst.js:27:3:27:26 | get x() ... null; } |

javascript/ql/test/library-tests/PropWrite/PropWritePropName.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
| tst.js:3:5:3:8 | x: 4 | x |
22
| tst.js:4:5:6:5 | func: f ... ;\\n } | func |
33
| tst.js:7:5:9:5 | f() {\\n ... ;\\n } | f |
4-
| tst.js:12:9:12:8 | constructor() {} | constructor |
54
| tst.js:13:3:15:3 | static ... x);\\n } | func |
6-
| tst.js:16:3:18:3 | f(x) {\\n ... x);\\n } | f |
75
| tst.js:21:1:21:6 | C.prop | prop |
86
| tst.js:24:13:24:27 | onClick={click} | onClick |
97
| tst.js:27:3:27:26 | get x() ... null; } | x |

javascript/ql/test/library-tests/PropWrite/PropWriteRhs.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
| tst.js:3:5:3:8 | x: 4 | tst.js:3:8:3:8 | 4 |
22
| tst.js:4:5:6:5 | func: f ... ;\\n } | tst.js:4:11:6:5 | functio ... ;\\n } |
33
| tst.js:7:5:9:5 | f() {\\n ... ;\\n } | tst.js:7:6:9:5 | () {\\n ... ;\\n } |
4-
| tst.js:12:9:12:8 | constructor() {} | tst.js:12:9:12:8 | () {} |
54
| tst.js:13:3:15:3 | static ... x);\\n } | tst.js:13:14:15:3 | (x) {\\n ... x);\\n } |
6-
| tst.js:16:3:18:3 | f(x) {\\n ... x);\\n } | tst.js:16:4:18:3 | (x) {\\n ... x);\\n } |
75
| tst.js:21:1:21:6 | C.prop | tst.js:21:10:21:11 | 56 |
86
| tst.js:24:13:24:27 | onClick={click} | tst.js:24:22:24:26 | click |
97
| tst.js:32:5:32:8 | n: 1 | tst.js:32:8:32:8 | 1 |

0 commit comments

Comments
 (0)