|
1 | 1 | private import ql |
2 | 2 | private import codeql_ql.ast.internal.TreeSitter |
| 3 | +private import experimental.RA |
3 | 4 |
|
4 | 5 | /** Gets a timestamp corresponding to the number of seconds since the date Semmle was founded. */ |
5 | 6 | bindingset[d, h, m, s, ms] |
@@ -78,6 +79,10 @@ private float getRanked(Array a, int i) { |
78 | 79 | result = rank[i + 1](int j, float f | f = a.getFloat(j) and f >= 0 | f order by j) |
79 | 80 | } |
80 | 81 |
|
| 82 | +private string getRankedLine(Array a, int i) { |
| 83 | + result = rank[i + 1](int j, string s | s = a.getString(j) and s != "" | s order by j) |
| 84 | +} |
| 85 | + |
81 | 86 | module EvaluatorLog { |
82 | 87 | class Entry extends Object { } |
83 | 88 |
|
@@ -283,7 +288,9 @@ module KindPredicatesLog { |
283 | 288 |
|
284 | 289 | PipeLine() { this = ra.getArray(raReference) } |
285 | 290 |
|
286 | | - string getLineOfRA(int n) { result = this.getString(n) } |
| 291 | + string getLineOfRA(int n) { result = getRankedLine(this, n) } |
| 292 | + |
| 293 | + RAExpr getExpr(int n) { result.getPredicate() = this and result.getLine() = n } |
287 | 294 | } |
288 | 295 |
|
289 | 296 | class RA extends Object { |
@@ -320,6 +327,12 @@ module KindPredicatesLog { |
320 | 327 | raLine = this.getPipeLine().getLineOfRA(pragma[only_bind_into](i)) |
321 | 328 | } |
322 | 329 |
|
| 330 | + float getCountAndExpr(int i, RAExpr raExpr) { |
| 331 | + result = this.getCount(i) and |
| 332 | + raExpr.getPredicate() = this.getPipeLine() and |
| 333 | + raExpr.getLine() = i |
| 334 | + } |
| 335 | + |
323 | 336 | float getCount(int i) { result = getRanked(this.getArray("counts"), i) } |
324 | 337 |
|
325 | 338 | float getDuplicationPercentage(int i) { |
@@ -376,4 +389,6 @@ module KindPredicatesLog { |
376 | 389 | class Extensional extends SummaryEvent { |
377 | 390 | Extensional() { evaluationStrategy = "EXTENSIONAL" } |
378 | 391 | } |
| 392 | + |
| 393 | + class RAExpr = RAParser<PipeLine>::RAExpr; |
379 | 394 | } |
0 commit comments