mirror of
https://github.com/github/codeql.git
synced 2026-02-19 16:33:40 +01:00
Merge pull request #159 from github/hvitved/herdoc-body-rank-performance
Improve performance of `HereDoc::getBody()`
This commit is contained in:
@@ -523,6 +523,16 @@ class CharacterLiteral extends Literal, TCharacterLiteral {
|
||||
final override string getAPrimaryQlClass() { result = "CharacterLiteral" }
|
||||
}
|
||||
|
||||
pragma[noinline]
|
||||
private predicate rankHeredocBody(File f, Generated::HeredocBody b, int i) {
|
||||
b =
|
||||
rank[i](Generated::HeredocBody b0 |
|
||||
f = b0.getLocation().getFile()
|
||||
|
|
||||
b0 order by b0.getLocation().getStartLine(), b0.getLocation().getStartColumn()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A "here document". For example:
|
||||
* ```rb
|
||||
@@ -589,12 +599,7 @@ class HereDoc extends StringlikeLiteral, THereDoc {
|
||||
|
|
||||
b order by b.getLocation().getStartLine(), b.getLocation().getStartColumn()
|
||||
) and
|
||||
result =
|
||||
rank[i](Generated::HeredocBody b |
|
||||
f = b.getLocation().getFile()
|
||||
|
|
||||
b order by b.getLocation().getStartLine(), b.getLocation().getStartColumn()
|
||||
)
|
||||
rankHeredocBody(f, result, i)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user