@@ -17,7 +17,7 @@ class SummarizedCallableBase = AbstractFunctionDecl;
1717DataFlowCallable inject ( SummarizedCallable c ) { result = TDataFlowFunc ( c ) }
1818
1919/** Gets the parameter position of the instance parameter. */
20- ArgumentPosition instanceParameterPosition ( ) { none ( ) } // disables implicit summary flow to `this` for callbacks
20+ ArgumentPosition instanceParameterPosition ( ) { result instanceof ThisArgumentPosition }
2121
2222/** Gets the synthesized summary data-flow node for the given values. */
2323Node summaryNode ( SummarizedCallable c , SummaryNodeState state ) { result = TSummaryNode ( c , state ) }
@@ -31,23 +31,23 @@ DataFlowType getContentType(Content c) { any() }
3131/** Gets the return type of kind `rk` for callable `c`. */
3232bindingset [ c]
3333DataFlowType getReturnType ( SummarizedCallable c , ReturnKind rk ) {
34- any ( ) // TODO
34+ any ( ) // TODO once we have type pruning
3535}
3636
3737/**
3838 * Gets the type of the parameter matching arguments at position `pos` in a
3939 * synthesized call that targets a callback of type `t`.
4040 */
4141DataFlowType getCallbackParameterType ( DataFlowType t , ArgumentPosition pos ) {
42- none ( ) // TODO
42+ any ( ) // TODO once we have type pruning
4343}
4444
4545/**
4646 * Gets the return type of kind `rk` in a synthesized call that targets a
4747 * callback of type `t`.
4848 */
4949DataFlowType getCallbackReturnType ( DataFlowType t , ReturnKind rk ) {
50- none ( ) // TODO
50+ any ( ) // TODO once we have type pruning
5151}
5252
5353/**
@@ -97,12 +97,12 @@ predicate sinkElement(Element e, string input, string kind, boolean generated) {
9797/** Gets the summary component for specification component `c`, if any. */
9898bindingset [ c]
9999SummaryComponent interpretComponentSpecific ( AccessPathToken c ) {
100- none ( ) // TODO
100+ none ( ) // TODO once we have field flow
101101}
102102
103103/** Gets the textual representation of the content in the format used for flow summaries. */
104104private string getContentSpecificCsv ( Content c ) {
105- none ( ) // TODO
105+ none ( ) // TODO once we have field flow
106106}
107107
108108/** Gets the textual representation of a summary component in the format used for flow summaries. */
@@ -117,14 +117,10 @@ string getComponentSpecificCsv(SummaryComponent sc) {
117117}
118118
119119/** Gets the textual representation of a parameter position in the format used for flow summaries. */
120- string getParameterPositionCsv ( ParameterPosition pos ) {
121- none ( ) // TODO
122- }
120+ string getParameterPositionCsv ( ParameterPosition pos ) { result = pos .toString ( ) }
123121
124122/** Gets the textual representation of an argument position in the format used for flow summaries. */
125- string getArgumentPositionCsv ( ArgumentPosition pos ) {
126- none ( ) // TODO
127- }
123+ string getArgumentPositionCsv ( ArgumentPosition pos ) { result = pos .toString ( ) }
128124
129125/** Holds if input specification component `c` needs a reference. */
130126predicate inputNeedsReferenceSpecific ( string c ) { none ( ) }
@@ -187,11 +183,21 @@ predicate interpretInputSpecific(string c, InterpretNode mid, InterpretNode n) {
187183/** Gets the argument position obtained by parsing `X` in `Parameter[X]`. */
188184bindingset [ s]
189185ArgumentPosition parseParamBody ( string s ) {
190- none ( ) // TODO
186+ exists ( int index | index = AccessPath:: parseInt ( s ) |
187+ result .( PositionalArgumentPosition ) .getIndex ( ) = index
188+ or
189+ index = - 1 and
190+ result instanceof ThisArgumentPosition
191+ )
191192}
192193
193194/** Gets the parameter position obtained by parsing `X` in `Argument[X]`. */
194195bindingset [ s]
195196ParameterPosition parseArgBody ( string s ) {
196- none ( ) // TODO
197+ exists ( int index | index = AccessPath:: parseInt ( s ) |
198+ result .( PositionalParameterPosition ) .getIndex ( ) = index
199+ or
200+ index = - 1 and
201+ result instanceof ThisParameterPosition
202+ )
197203}
0 commit comments