Skip to content

Commit 0eaba2b

Browse files
committed
JS: Minor simplication of ranked basic block calculation
We have to look up the node index within the block anyway, so include it as an aggregation variable.
1 parent f7c70c1 commit 0eaba2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,15 +462,15 @@ module AccessPath {
462462
ReachableBasicBlock bb, Root root, string path, int ranking, AccessPathKind type
463463
) {
464464
result =
465-
rank[ranking](ControlFlowNode ref |
465+
rank[ranking](ControlFlowNode ref, int i |
466466
ref = getAccessTo(root, path, _) and
467-
ref.getBasicBlock() = bb and
467+
ref = bb.getNode(i) and
468468
// Prunes the accesses where there does not exists a read and write within the same basicblock.
469469
// This could be more precise, but doing it like this avoids massive joins.
470470
hasRead(bb) and
471471
hasWrite(bb)
472472
|
473-
ref order by any(int i | ref = bb.getNode(i))
473+
ref order by i
474474
) and
475475
result = getAccessTo(root, path, type)
476476
}

0 commit comments

Comments
 (0)