Merge pull request #159 from github/hvitved/herdoc-body-rank-performance

Improve performance of `HereDoc::getBody()`
This commit is contained in:
Arthur Baars
2021-03-23 10:40:28 +01:00
committed by GitHub

View File

@@ -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)
)
}