@@ -221,6 +221,11 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
221
221
*/
222
222
string printContent ( Lang:: ContentSet c ) ;
223
223
224
+ /**
225
+ * Gets the parameter position of the return kind, if any.
226
+ */
227
+ default Lang:: ParameterPosition getReturnKindParamPosition ( Lang:: ReturnKind node ) { none ( ) }
228
+
224
229
/**
225
230
* Holds if it is irrelevant to generate models for `api` based on data flow analysis.
226
231
*
@@ -301,6 +306,14 @@ module MakeModelGenerator<
301
306
* Gets the kind of the return node.
302
307
*/
303
308
DataFlow:: ReturnKindExt getKind ( ) { result = kind }
309
+
310
+ /**
311
+ * Gets the parameter position of the return node, if any.
312
+ */
313
+ DataFlow:: ParameterPosition getPosition ( ) {
314
+ result = this .getKind ( ) .( DataFlow:: ParamUpdateReturnKind ) .getPosition ( ) or
315
+ result = getReturnKindParamPosition ( this .getKind ( ) .( DataFlow:: ValueReturnKind ) .getKind ( ) )
316
+ }
304
317
}
305
318
306
319
bindingset [ c]
@@ -309,10 +322,11 @@ module MakeModelGenerator<
309
322
private module PrintReturnNodeExt< printCallableParamSig / 2 printCallableParam> {
310
323
string getOutput ( ReturnNodeExt node ) {
311
324
node .getKind ( ) instanceof DataFlow:: ValueReturnKind and
325
+ not exists ( node .getPosition ( ) ) and
312
326
result = "ReturnValue"
313
327
or
314
328
exists ( DataFlow:: ParameterPosition pos |
315
- pos = node .getKind ( ) . ( DataFlow :: ParamUpdateReturnKind ) . getPosition ( ) and
329
+ pos = node .getPosition ( ) and
316
330
result = printCallableParam ( returnNodeEnclosingCallable ( node ) , pos )
317
331
)
318
332
}
0 commit comments