@@ -59,7 +59,7 @@ predicate summaryElement(DataFlowCallable c, string input, string output, string
59
59
* is currently restricted to `"BlockArgument"`.
60
60
*/
61
61
bindingset [ c]
62
- SummaryComponent interpretComponentSpecific ( string c ) {
62
+ SummaryComponent interpretComponentSpecific ( AccessPathToken c ) {
63
63
c = "Receiver" and
64
64
result = FlowSummary:: SummaryComponent:: receiver ( )
65
65
or
@@ -76,15 +76,10 @@ SummaryComponent interpretComponentSpecific(string c) {
76
76
result = FlowSummary:: SummaryComponent:: arrayElementUnknown ( )
77
77
or
78
78
exists ( int i |
79
- c .regexpCapture ( "ArrayElement\\[([0-9]+)\\]" , 1 ) .toInt ( ) = i and
79
+ c .getName ( ) = "ArrayElement" and
80
+ i = AccessPath:: parseInt ( c .getAnArgument ( ) ) and
80
81
result = FlowSummary:: SummaryComponent:: arrayElementKnown ( i )
81
82
)
82
- or
83
- exists ( int i1 , int i2 |
84
- c .regexpCapture ( "ArrayElement\\[([-0-9]+)\\.\\.([0-9]+)\\]" , 1 ) .toInt ( ) = i1 and
85
- c .regexpCapture ( "ArrayElement\\[([-0-9]+)\\.\\.([0-9]+)\\]" , 2 ) .toInt ( ) = i2 and
86
- result = FlowSummary:: SummaryComponent:: arrayElementKnown ( [ i1 .. i2 ] )
87
- )
88
83
}
89
84
90
85
/** Gets the textual representation of a summary component in the format used for flow summaries. */
@@ -172,25 +167,14 @@ module ParsePositions {
172
167
)
173
168
}
174
169
175
- bindingset [ s]
176
- private int parsePosition ( string s ) {
177
- result = s .regexpCapture ( "([-0-9]+)" , 1 ) .toInt ( )
178
- or
179
- exists ( int n1 , int n2 |
180
- s .regexpCapture ( "([-0-9]+)\\.\\.([0-9]+)" , 1 ) .toInt ( ) = n1 and
181
- s .regexpCapture ( "([-0-9]+)\\.\\.([0-9]+)" , 2 ) .toInt ( ) = n2 and
182
- result in [ n1 .. n2 ]
183
- )
184
- }
185
-
186
170
predicate isParsedParameterPosition ( string c , int i ) {
187
171
isParamBody ( c ) and
188
- i = parsePosition ( c )
172
+ i = AccessPath :: parseInt ( c )
189
173
}
190
174
191
175
predicate isParsedArgumentPosition ( string c , int i ) {
192
176
isArgBody ( c ) and
193
- i = parsePosition ( c )
177
+ i = AccessPath :: parseInt ( c )
194
178
}
195
179
}
196
180
0 commit comments