@@ -221,6 +221,11 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
221221 */
222222 string printContent ( Lang:: ContentSet c ) ;
223223
224+ /**
225+ * Gets the parameter position of the return kind, if any.
226+ */
227+ default Lang:: ParameterPosition getReturnKindParamPosition ( Lang:: ReturnKind node ) { none ( ) }
228+
224229 /**
225230 * Holds if it is irrelevant to generate models for `api` based on data flow analysis.
226231 *
@@ -301,6 +306,14 @@ module MakeModelGenerator<
301306 * Gets the kind of the return node.
302307 */
303308 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+ }
304317 }
305318
306319 bindingset [ c]
@@ -309,10 +322,11 @@ module MakeModelGenerator<
309322 private module PrintReturnNodeExt< printCallableParamSig / 2 printCallableParam> {
310323 string getOutput ( ReturnNodeExt node ) {
311324 node .getKind ( ) instanceof DataFlow:: ValueReturnKind and
325+ not exists ( node .getPosition ( ) ) and
312326 result = "ReturnValue"
313327 or
314328 exists ( DataFlow:: ParameterPosition pos |
315- pos = node .getKind ( ) . ( DataFlow :: ParamUpdateReturnKind ) . getPosition ( ) and
329+ pos = node .getPosition ( ) and
316330 result = printCallableParam ( returnNodeEnclosingCallable ( node ) , pos )
317331 )
318332 }
0 commit comments