mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: add regression test for ODASA-7506
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
| issue7506.js:12:1:12:34 | class C ... e\\n }\\n} | Component state property 'p1' is $@, but it is never read. | issue7506.js:15:5:15:10 | p1: '' | written |
|
||||
| undefined.js:1:1:1:34 | class C ... }\\n} | Component state property 'notWritten' is $@, but it is never written. | undefined.js:8:9:8:29 | this.st ... Written | read |
|
||||
| undefined.js:1:1:1:34 | class C ... }\\n} | Component state property 'notWrittenButReadInChain' is $@, but it is never written. | undefined.js:9:9:9:43 | this.st ... InChain | read |
|
||||
| undefined.js:32:1:32:34 | class C ... }\\n} | Component state property 'notWrittenThrougExternalPropertyAccess' is $@, but it is never written. | undefined.js:35:9:35:57 | this.st ... yAccess | read |
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
class C1 extends React.Component {
|
||||
|
||||
state = {
|
||||
p1: ''
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
const { p1: p2 } = state
|
||||
}
|
||||
}
|
||||
|
||||
class C2 extends React.Component {
|
||||
|
||||
state = {
|
||||
p1: ''
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps_unmodeled(props, state) {
|
||||
const { p1: p2 } = state
|
||||
}
|
||||
}
|
||||
|
||||
// semmle-extractor-options: --experimental
|
||||
Reference in New Issue
Block a user