@@ -23,29 +23,30 @@ module Public {
2323 * content type, or a return kind.
2424 */
2525 class SummaryComponent extends TSummaryComponent {
26- /** Gets a textual representation of this summary component. */
27- string toString ( ) {
28- exists ( ContentSet c | this = TContentSummaryComponent ( c ) and result = c .toString ( ) )
29- or
30- exists ( ContentSet c | this = TWithoutContentSummaryComponent ( c ) and result = "without " + c )
31- or
32- exists ( ContentSet c | this = TWithContentSummaryComponent ( c ) and result = "with " + c )
26+ /** Gets a textual representation of this component used for MaD models. */
27+ string getMadRepresentation ( ) {
28+ result = getMadRepresentationSpecific ( this )
3329 or
3430 exists ( ArgumentPosition pos |
35- this = TParameterSummaryComponent ( pos ) and result = "parameter " + pos
31+ this = TParameterSummaryComponent ( pos ) and
32+ result = "Parameter[" + getArgumentPosition ( pos ) + "]"
3633 )
3734 or
3835 exists ( ParameterPosition pos |
39- this = TArgumentSummaryComponent ( pos ) and result = "argument " + pos
36+ this = TArgumentSummaryComponent ( pos ) and
37+ result = "Argument[" + getParameterPosition ( pos ) + "]"
4038 )
4139 or
42- exists ( ReturnKind rk | this = TReturnSummaryComponent ( rk ) and result = "return (" + rk + ")" )
43- or
44- exists ( SummaryComponent:: SyntheticGlobal sg |
45- this = TSyntheticGlobalSummaryComponent ( sg ) and
46- result = "synthetic global (" + sg + ")"
40+ exists ( string synthetic |
41+ this = TSyntheticGlobalSummaryComponent ( synthetic ) and
42+ result = "SyntheticGlobal[" + synthetic + "]"
4743 )
44+ or
45+ this = TReturnSummaryComponent ( getReturnValueKind ( ) ) and result = "ReturnValue"
4846 }
47+
48+ /** Gets a textual representation of this summary component. */
49+ string toString ( ) { result = this .getMadRepresentation ( ) }
4950 }
5051
5152 /** Provides predicates for constructing summary components. */
@@ -124,19 +125,22 @@ module Public {
124125 this = TSingletonSummaryComponentStack ( result ) or result = this .tail ( ) .bottom ( )
125126 }
126127
127- /** Gets a textual representation of this stack. */
128- string toString ( ) {
128+ /** Gets a textual representation of this stack used for MaD models . */
129+ string getMadRepresentation ( ) {
129130 exists ( SummaryComponent head , SummaryComponentStack tail |
130131 head = this .head ( ) and
131132 tail = this .tail ( ) and
132- result = tail + "." + head
133+ result = tail . getMadRepresentation ( ) + "." + head . getMadRepresentation ( )
133134 )
134135 or
135136 exists ( SummaryComponent c |
136137 this = TSingletonSummaryComponentStack ( c ) and
137- result = c .toString ( )
138+ result = c .getMadRepresentation ( )
138139 )
139140 }
141+
142+ /** Gets a textual representation of this stack. */
143+ string toString ( ) { result = this .getMadRepresentation ( ) }
140144 }
141145
142146 /** Provides predicates for constructing stacks of summary components. */
@@ -165,42 +169,6 @@ module Public {
165169 SummaryComponentStack return ( ReturnKind rk ) { result = singleton ( SummaryComponent:: return ( rk ) ) }
166170 }
167171
168- /** Gets a textual representation of this component used for flow summaries. */
169- private string getComponent ( SummaryComponent sc ) {
170- result = getComponentSpecific ( sc )
171- or
172- exists ( ArgumentPosition pos |
173- sc = TParameterSummaryComponent ( pos ) and
174- result = "Parameter[" + getArgumentPosition ( pos ) + "]"
175- )
176- or
177- exists ( ParameterPosition pos |
178- sc = TArgumentSummaryComponent ( pos ) and
179- result = "Argument[" + getParameterPosition ( pos ) + "]"
180- )
181- or
182- exists ( string synthetic |
183- sc = TSyntheticGlobalSummaryComponent ( synthetic ) and
184- result = "SyntheticGlobal[" + synthetic + "]"
185- )
186- or
187- sc = TReturnSummaryComponent ( getReturnValueKind ( ) ) and result = "ReturnValue"
188- }
189-
190- /** Gets a textual representation of this stack used for flow summaries. */
191- string getComponentStack ( SummaryComponentStack stack ) {
192- exists ( SummaryComponent head , SummaryComponentStack tail |
193- head = stack .head ( ) and
194- tail = stack .tail ( ) and
195- result = getComponentStack ( tail ) + "." + getComponent ( head )
196- )
197- or
198- exists ( SummaryComponent c |
199- stack = TSingletonSummaryComponentStack ( c ) and
200- result = getComponent ( c )
201- )
202- }
203-
204172 /**
205173 * A class that exists for QL technical reasons only (the IPA type used
206174 * to represent component stacks needs to be bounded).
@@ -1381,8 +1349,8 @@ module Private {
13811349 c .relevantSummary ( input , output , preservesValue ) and
13821350 csv =
13831351 c .getCallableCsv ( ) // Callable information
1384- + getComponentStack ( input ) + ";" // input
1385- + getComponentStack ( output ) + ";" // output
1352+ + input . getMadRepresentation ( ) + ";" // input
1353+ + output . getMadRepresentation ( ) + ";" // output
13861354 + renderKind ( preservesValue ) + ";" // kind
13871355 + renderProvenance ( c ) // provenance
13881356 )
0 commit comments