@@ -23,29 +23,30 @@ module Public {
23
23
* content type, or a return kind.
24
24
*/
25
25
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 )
33
29
or
34
30
exists ( ArgumentPosition pos |
35
- this = TParameterSummaryComponent ( pos ) and result = "parameter " + pos
31
+ this = TParameterSummaryComponent ( pos ) and
32
+ result = "Parameter[" + getArgumentPosition ( pos ) + "]"
36
33
)
37
34
or
38
35
exists ( ParameterPosition pos |
39
- this = TArgumentSummaryComponent ( pos ) and result = "argument " + pos
36
+ this = TArgumentSummaryComponent ( pos ) and
37
+ result = "Argument[" + getParameterPosition ( pos ) + "]"
40
38
)
41
39
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 + "]"
47
43
)
44
+ or
45
+ this = TReturnSummaryComponent ( getReturnValueKind ( ) ) and result = "ReturnValue"
48
46
}
47
+
48
+ /** Gets a textual representation of this summary component. */
49
+ string toString ( ) { result = this .getAccessStep ( ) }
49
50
}
50
51
51
52
/** Provides predicates for constructing summary components. */
@@ -125,19 +126,22 @@ module Public {
125
126
this = TSingletonSummaryComponentStack ( result ) or result = this .tail ( ) .bottom ( )
126
127
}
127
128
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 ( ) {
130
131
exists ( SummaryComponent head , SummaryComponentStack tail |
131
132
head = this .head ( ) and
132
133
tail = this .tail ( ) and
133
- result = tail + "." + head
134
+ result = tail . getAccessPath ( ) + "." + head . getAccessStep ( )
134
135
)
135
136
or
136
137
exists ( SummaryComponent c |
137
138
this = TSingletonSummaryComponentStack ( c ) and
138
- result = c .toString ( )
139
+ result = c .getAccessStep ( )
139
140
)
140
141
}
142
+
143
+ /** Gets a textual representation of this stack. */
144
+ string toString ( ) { result = this .getAccessPath ( ) }
141
145
}
142
146
143
147
/** Provides predicates for constructing stacks of summary components. */
@@ -166,42 +170,6 @@ module Public {
166
170
SummaryComponentStack return ( ReturnKind rk ) { result = singleton ( SummaryComponent:: return ( rk ) ) }
167
171
}
168
172
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
-
205
173
/**
206
174
* A class that exists for QL technical reasons only (the IPA type used
207
175
* to represent component stacks needs to be bounded).
@@ -1382,8 +1350,8 @@ module Private {
1382
1350
c .relevantSummary ( input , output , preservesValue ) and
1383
1351
csv =
1384
1352
c .getCallableCsv ( ) // Callable information
1385
- + getComponentStack ( input ) + ";" // input
1386
- + getComponentStack ( output ) + ";" // output
1353
+ + input . getAccessPath ( ) + ";" // input
1354
+ + output . getAccessPath ( ) + ";" // output
1387
1355
+ renderKind ( preservesValue ) + ";" // kind
1388
1356
+ renderProvenance ( c ) // provenance
1389
1357
)
0 commit comments