@@ -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 flow summaries. */
27+ string getAccessStep ( ) {
28+ result = getAccessStepSpecific ( 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 .getAccessStep ( ) }
4950 }
5051
5152 /** Provides predicates for constructing summary components. */
@@ -125,19 +126,22 @@ module Public {
125126 this = TSingletonSummaryComponentStack ( result ) or result = this .tail ( ) .bottom ( )
126127 }
127128
128- /** Gets a textual representation of this stack. */
129- string toString ( ) {
129+ /** Gets a textual representation of this stack used for MaD models . */
130+ string getAccessPath ( ) {
130131 exists ( SummaryComponent head , SummaryComponentStack tail |
131132 head = this .head ( ) and
132133 tail = this .tail ( ) and
133- result = tail + "." + head
134+ result = tail . getAccessPath ( ) + "." + head . getAccessStep ( )
134135 )
135136 or
136137 exists ( SummaryComponent c |
137138 this = TSingletonSummaryComponentStack ( c ) and
138- result = c .toString ( )
139+ result = c .getAccessStep ( )
139140 )
140141 }
142+
143+ /** Gets a textual representation of this stack. */
144+ string toString ( ) { result = this .getAccessPath ( ) }
141145 }
142146
143147 /** Provides predicates for constructing stacks of summary components. */
@@ -166,42 +170,6 @@ module Public {
166170 SummaryComponentStack return ( ReturnKind rk ) { result = singleton ( SummaryComponent:: return ( rk ) ) }
167171 }
168172
169- /** Gets a textual representation of this component used for flow summaries. */
170- private string getComponent ( SummaryComponent sc ) {
171- result = getComponentSpecific ( sc )
172- or
173- exists ( ArgumentPosition pos |
174- sc = TParameterSummaryComponent ( pos ) and
175- result = "Parameter[" + getArgumentPosition ( pos ) + "]"
176- )
177- or
178- exists ( ParameterPosition pos |
179- sc = TArgumentSummaryComponent ( pos ) and
180- result = "Argument[" + getParameterPosition ( pos ) + "]"
181- )
182- or
183- exists ( string synthetic |
184- sc = TSyntheticGlobalSummaryComponent ( synthetic ) and
185- result = "SyntheticGlobal[" + synthetic + "]"
186- )
187- or
188- sc = TReturnSummaryComponent ( getReturnValueKind ( ) ) and result = "ReturnValue"
189- }
190-
191- /** Gets a textual representation of this stack used for flow summaries. */
192- string getComponentStack ( SummaryComponentStack stack ) {
193- exists ( SummaryComponent head , SummaryComponentStack tail |
194- head = stack .head ( ) and
195- tail = stack .tail ( ) and
196- result = getComponentStack ( tail ) + "." + getComponent ( head )
197- )
198- or
199- exists ( SummaryComponent c |
200- stack = TSingletonSummaryComponentStack ( c ) and
201- result = getComponent ( c )
202- )
203- }
204-
205173 /**
206174 * A class that exists for QL technical reasons only (the IPA type used
207175 * to represent component stacks needs to be bounded).
@@ -1382,8 +1350,8 @@ module Private {
13821350 c .relevantSummary ( input , output , preservesValue ) and
13831351 csv =
13841352 c .getCallableCsv ( ) // Callable information
1385- + getComponentStack ( input ) + ";" // input
1386- + getComponentStack ( output ) + ";" // output
1353+ + input . getAccessPath ( ) + ";" // input
1354+ + output . getAccessPath ( ) + ";" // output
13871355 + renderKind ( preservesValue ) + ";" // kind
13881356 + renderProvenance ( c ) // provenance
13891357 )
0 commit comments