Skip to content

Commit e9c03c9

Browse files
committed
JS: Implement getBasicBlock() for exceptional nodes
1 parent 44a270a commit e9c03c9

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,10 @@ module DataFlow {
788788
function.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
789789
}
790790

791+
override BasicBlock getBasicBlock() {
792+
result = function.(ExprOrStmt).getBasicBlock()
793+
}
794+
791795
/**
792796
* Gets the function corresponding to this exceptional return node.
793797
*/
@@ -810,6 +814,10 @@ module DataFlow {
810814
invoke.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
811815
}
812816

817+
override BasicBlock getBasicBlock() {
818+
result = invoke.getBasicBlock()
819+
}
820+
813821
/**
814822
* Gets the invocation corresponding to this exceptional return node.
815823
*/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| tst.js:1:10:1:11 | fs |
2+
| tst.js:1:10:1:11 | fs |
3+
| tst.js:1:20:1:23 | 'fs' |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import javascript
2+
3+
from DataFlow::Node node
4+
where not exists(node.getBasicBlock())
5+
select node

0 commit comments

Comments
 (0)