Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 75795d8

Browse files
author
Max Schaefer
committed
Improve performance of upgrade script.
1 parent b057cbe commit 75795d8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

upgrades/ee5c327face2866a7b3b12dcce5c291be52ebf52/upgrade_comment_groups.ql

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ Location getLocation(CommentGroup cg) {
3333
not exists(cg.getLocation()) and result = cg.getComment(0).getLocation()
3434
}
3535

36-
from CommentGroup cg, File f, int idx
36+
predicate hasLocation(CommentGroup cg, File f, int startLine) {
37+
exists(Location loc | loc = getLocation(cg) |
38+
f = loc.getFile() and
39+
startLine = loc.getStartLine()
40+
)
41+
}
42+
43+
from CommentGroup cg, File file, int idx
3744
where
38-
f = getLocation(cg).getFile() and
39-
rank[idx + 1](CommentGroup rankedcg |
40-
getLocation(rankedcg).getFile() = f
41-
|
42-
rankedcg order by getLocation(rankedcg).getStartLine()
43-
) = cg
44-
select cg, f, idx
45+
hasLocation(cg, file, _) and
46+
cg = rank[idx + 1](CommentGroup cg2, int line | hasLocation(cg2, file, line) | cg2 order by line)
47+
select cg, file, idx

0 commit comments

Comments
 (0)