@@ -1692,39 +1692,27 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1692
1692
)
1693
1693
}
1694
1694
1695
- signature module TestSourceSinkInputSig {
1696
- /**
1697
- * A class or source elements relevant for testing.
1698
- */
1699
- class RelevantSourceCallable instanceof SourceOrSinkElement {
1700
- /** Gets the string representation of this callable used by `source/1`. */
1701
- string getCallableCsv ( ) ;
1702
- }
1703
-
1704
- /**
1705
- * A class or sink elements relevant for testing.
1706
- */
1707
- class RelevantSinkCallable instanceof SourceOrSinkElement {
1708
- /** Gets the string representation of this callable used by `source/1`. */
1709
- string getCallableCsv ( ) ;
1710
- }
1695
+ /** A source or sink relevant for testing. */
1696
+ signature class RelevantSourceOrSinkElementSig extends SourceOrSinkElement {
1697
+ /** Gets the string representation of this callable used by `source/1` or `sink/1`. */
1698
+ string getCallableCsv ( ) ;
1711
1699
}
1712
1700
1713
1701
/** Provides query predicates for outputting a set of relevant sources and sinks. */
1714
- module TestSourceSinkOutput< TestSourceSinkInputSig TestSourceSinkInput > {
1715
- private import TestSourceSinkInput
1716
-
1702
+ module TestSourceSinkOutput<
1703
+ RelevantSourceOrSinkElementSig RelevantSource , RelevantSourceOrSinkElementSig RelevantSink >
1704
+ {
1717
1705
/**
1718
1706
* Holds if there exists a relevant source callable with information roughly corresponding to `csv`.
1719
1707
* Used for testing.
1720
1708
* The syntax is: "namespace;type;overrides;name;signature;ext;outputspec;kind;provenance",
1721
1709
* ext is hardcoded to empty.
1722
1710
*/
1723
1711
query predicate source ( string csv ) {
1724
- exists ( RelevantSourceCallable c , string output , string kind , Provenance provenance |
1725
- sourceElement ( c , output , kind , provenance ) and
1712
+ exists ( RelevantSource s , string output , string kind , Provenance provenance |
1713
+ sourceElement ( s , output , kind , provenance ) and
1726
1714
csv =
1727
- c .getCallableCsv ( ) // Callable information
1715
+ s .getCallableCsv ( ) // Callable information
1728
1716
+ output + ";" // output
1729
1717
+ kind + ";" // kind
1730
1718
+ provenance // provenance
@@ -1738,10 +1726,10 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1738
1726
* ext is hardcoded to empty.
1739
1727
*/
1740
1728
query predicate sink ( string csv ) {
1741
- exists ( RelevantSinkCallable c , string input , string kind , Provenance provenance |
1742
- sinkElement ( c , input , kind , provenance ) and
1729
+ exists ( RelevantSink s , string input , string kind , Provenance provenance |
1730
+ sinkElement ( s , input , kind , provenance ) and
1743
1731
csv =
1744
- c .getCallableCsv ( ) // Callable information
1732
+ s .getCallableCsv ( ) // Callable information
1745
1733
+ input + ";" // input
1746
1734
+ kind + ";" // kind
1747
1735
+ provenance // provenance
@@ -1751,35 +1739,18 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1751
1739
}
1752
1740
}
1753
1741
1754
- signature module TestSummaryInputSig {
1755
- /**
1756
- * A class of callables where the flow summary should be included
1757
- * in the `summary/1` query predicate.
1758
- */
1759
- class RelevantSummarizedCallable instanceof SummarizedCallableImpl {
1760
- /** Gets the string representation of this callable used by `summary/1`. */
1761
- string getCallableCsv ( ) ;
1762
- }
1742
+ /** A summarized callable relevant for testing. */
1743
+ signature class RelevantSummarizedCallableSig extends SummarizedCallableImpl {
1744
+ /** Gets the string representation of this callable used by `summary/1`. */
1745
+ string getCallableCsv ( ) ;
1746
+
1747
+ predicate relevantSummary (
1748
+ SummaryComponentStack input , SummaryComponentStack output , boolean preservesValue
1749
+ ) ;
1763
1750
}
1764
1751
1765
1752
/** Provides a query predicate for outputting a set of relevant flow summaries. */
1766
- module TestSummaryOutput< TestSummaryInputSig TestInput> {
1767
- private import TestInput
1768
-
1769
- final class RelevantSummarizedCallableFinal = TestInput:: RelevantSummarizedCallable ;
1770
-
1771
- class RelevantSummarizedCallable extends RelevantSummarizedCallableFinal instanceof SummarizedCallableImpl
1772
- {
1773
- /** Holds if flow is propagated between `input` and `output`. */
1774
- predicate relevantSummary (
1775
- SummaryComponentStack input , SummaryComponentStack output , boolean preservesValue
1776
- ) {
1777
- super .propagatesFlow ( input , output , preservesValue )
1778
- }
1779
-
1780
- string toString ( ) { result = super .toString ( ) }
1781
- }
1782
-
1753
+ module TestSummaryOutput< RelevantSummarizedCallableSig RelevantSummarizedCallable> {
1783
1754
/** Render the kind in the format used in flow summaries. */
1784
1755
private string renderKind ( boolean preservesValue ) {
1785
1756
preservesValue = true and result = "value"
@@ -1816,31 +1787,13 @@ module Make<DF::InputSig DataFlowLang, InputSig<DataFlowLang> Input> {
1816
1787
}
1817
1788
}
1818
1789
1819
- signature module TestNeutralInputSig {
1820
- /**
1821
- * A class of callables where the neutral model should be included
1822
- * in the `neutral/1` query predicate.
1823
- */
1824
- class RelevantNeutralCallable instanceof NeutralCallable {
1825
- /** Gets the string representation of this callable used by `neutral/1`. */
1826
- string getCallableCsv ( ) ;
1827
- }
1790
+ /** A summarized callable relevant for testing. */
1791
+ signature class RelevantNeutralCallableSig extends NeutralCallable {
1792
+ /** Gets the string representation of this callable used by `neutral/1`. */
1793
+ string getCallableCsv ( ) ;
1828
1794
}
1829
1795
1830
- module TestNeutralOutput< TestNeutralInputSig TestInput> {
1831
- private import TestInput
1832
-
1833
- final class RelevantNeutralCallableFinal = TestInput:: RelevantNeutralCallable ;
1834
-
1835
- class RelevantNeutralCallable extends RelevantNeutralCallableFinal instanceof NeutralCallable {
1836
- /**
1837
- * Gets the kind of the neutral.
1838
- */
1839
- string getKind ( ) { result = super .getKind ( ) }
1840
-
1841
- string toString ( ) { result = super .toString ( ) }
1842
- }
1843
-
1796
+ module TestNeutralOutput< RelevantNeutralCallableSig RelevantNeutralCallable> {
1844
1797
private string renderProvenance ( NeutralCallable c ) {
1845
1798
exists ( Provenance p | p .isManual ( ) and c .hasProvenance ( p ) and result = p .toString ( ) )
1846
1799
or
0 commit comments