mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
materialize less strings when ranking states
This commit is contained in:
@@ -147,6 +147,8 @@ module Make<RegexTreeViewSig TreeImpl> {
|
||||
/**
|
||||
* Gets a string for the full location of `t`.
|
||||
*/
|
||||
bindingset[t]
|
||||
pragma[inline_late]
|
||||
string getTermLocationString(RegExpTerm t) {
|
||||
exists(string file, int startLine, int startColumn, int endLine, int endColumn |
|
||||
t.hasLocationInfo(file, startLine, startColumn, endLine, endColumn) and
|
||||
|
||||
@@ -354,13 +354,13 @@ module Make<RegexTreeViewSig TreeImpl> {
|
||||
*/
|
||||
private int rankState(State state) {
|
||||
state =
|
||||
rank[result](State s |
|
||||
exists(StateTuple tuple |
|
||||
tuple = getARelevantStateTuple(_, _) and
|
||||
s = [tuple.getFirst(), tuple.getSecond(), tuple.getThird()]
|
||||
rank[result](State s, int startLine, int endLine, int startColumn, int endColumn |
|
||||
exists(StateTuple tuple | tuple = getARelevantStateTuple(_, _) |
|
||||
s = [tuple.getFirst(), tuple.getSecond(), tuple.getThird()] and
|
||||
s.getRepr().hasLocationInfo(_, startLine, startColumn, endLine, endColumn)
|
||||
)
|
||||
|
|
||||
s order by getTermLocationString(s.getRepr())
|
||||
s order by startLine, startColumn, endLine, endColumn
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user