mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
C#: Refactoring to allow override of the flow summaries reported by a test.
This commit is contained in:
@@ -1004,6 +1004,13 @@ module Private {
|
||||
abstract class RelevantSummarizedCallable extends SummarizedCallable {
|
||||
/** Gets the string representation of this callable used by `summary/1`. */
|
||||
abstract string getCallableCsv();
|
||||
|
||||
/** Holds if flow is progated between `input` and `output` */
|
||||
predicate relevantSummary(
|
||||
SummaryComponentStack input, SummaryComponentStack output, boolean preservesValue
|
||||
) {
|
||||
this.propagatesFlow(input, output, preservesValue)
|
||||
}
|
||||
}
|
||||
|
||||
/** Render the kind in the format used in flow summaries. */
|
||||
@@ -1023,7 +1030,7 @@ module Private {
|
||||
RelevantSummarizedCallable c, SummaryComponentStack input, SummaryComponentStack output,
|
||||
boolean preservesValue
|
||||
|
|
||||
c.propagatesFlow(input, output, preservesValue) and
|
||||
c.relevantSummary(input, output, preservesValue) and
|
||||
csv =
|
||||
c.getCallableCsv() + ";;" + getComponentStackCsv(input) + ";" +
|
||||
getComponentStackCsv(output) + ";" + renderKind(preservesValue)
|
||||
|
||||
@@ -16,13 +16,14 @@ abstract class IncludeSummarizedCallable extends RelevantSummarizedCallable {
|
||||
)
|
||||
}
|
||||
|
||||
/* Gets a string representing, whether the declaring type is an interface. */
|
||||
predicate isAbstractOrInterface() {
|
||||
this.getDeclaringType() instanceof Interface or
|
||||
this.(Modifiable).isAbstract()
|
||||
}
|
||||
|
||||
/** Gets a string representing, whether the declaring type is an interface. */
|
||||
private string getCallableOverride() {
|
||||
if
|
||||
this.getDeclaringType() instanceof Interface or
|
||||
this.(Modifiable).isAbstract()
|
||||
then result = "true"
|
||||
else result = "false"
|
||||
if this.isAbstractOrInterface() then result = "true" else result = "false"
|
||||
}
|
||||
|
||||
/** Gets a string representing the callable in semi-colon separated format for use in flow summaries. */
|
||||
|
||||
Reference in New Issue
Block a user