JS: add DataFlow::Node.getIntValue()

This commit is contained in:
Asger F
2019-02-12 13:04:59 +00:00
parent 0fd9d157f8
commit 2fd1ee60a2
3 changed files with 22 additions and 0 deletions

View File

@@ -108,6 +108,9 @@ module DataFlow {
b = analyze().getAValue().(AbstractBoolean).getBooleanValue()
}
/** Gets the integer value of this node, if it is an integer constant. */
int getIntValue() { result = asExpr().getIntValue() }
/**
* Holds if this expression may refer to the initial value of parameter `p`.
*/

View File

@@ -0,0 +1,15 @@
| eval.js:2:11:2:12 | 42 | 42 |
| sources.js:4:12:4:13 | 19 | 19 |
| sources.js:5:4:5:5 | 23 | 23 |
| tst.js:3:9:3:10 | 42 | 42 |
| tst.js:51:11:51:12 | 42 | 42 |
| tst.js:65:9:65:10 | 42 | 42 |
| tst.js:69:11:69:12 | 23 | 23 |
| tst.js:93:6:93:7 | 19 | 19 |
| tst.js:94:6:94:7 | 23 | 23 |
| tst.js:95:6:95:6 | 0 | 0 |
| tst.js:103:6:103:7 | 19 | 19 |
| tst.js:103:10:103:11 | 23 | 23 |
| tst.js:103:14:103:14 | 0 | 0 |
| tst.ts:2:18:2:19 | 42 | 42 |
| tst.ts:8:9:8:10 | 23 | 23 |

View File

@@ -0,0 +1,4 @@
import javascript
from DataFlow::Node node
select node, node.getIntValue()