@@ -719,6 +719,19 @@ class Module extends TModule, ModuleDeclaration {
719719 pred = directMember ( "getAlias" ) and result = this .getAlias ( )
720720 or
721721 pred = directMember ( "getAMember" ) and result = this .getAMember ( )
722+ or
723+ exists ( int i | pred = indexedMember ( "hasParameter" , i ) and hasParameter ( i , _, result ) )
724+ }
725+
726+ /** Holds if the `i`th parameter of this module has `name` and type `sig`. */
727+ predicate hasParameter ( int i , string name , SignatureExpr sig ) {
728+ exists ( QL:: ModuleParam param |
729+ param = mod .getParameter ( i ) and name = param .getParameter ( ) .getValue ( )
730+ |
731+ toQL ( sig ) = param .getSignature ( ) .getPredicate ( )
732+ or
733+ toQL ( sig ) = param .getSignature ( ) .getTypeExpr ( )
734+ )
722735 }
723736}
724737
@@ -2225,7 +2238,7 @@ class ModuleExpr extends TModuleExpr, ModuleRef {
22252238 * Gets the `i`th type argument if this module is a module instantiation.
22262239 * The result is either a `PredicateExpr` or a `TypeExpr`.
22272240 */
2228- AstNode getArgument ( int i ) {
2241+ SignatureExpr getArgument ( int i ) {
22292242 exists ( QL:: ModuleInstantiation instantiation | instantiation .getParent ( ) = me |
22302243 toQL ( result ) = instantiation .getChild ( i ) .getPredicate ( )
22312244 or
@@ -2234,6 +2247,9 @@ class ModuleExpr extends TModuleExpr, ModuleRef {
22342247 }
22352248}
22362249
2250+ /** A signature expression, either a `PredicateExpr` or a `TypeExpr`. */
2251+ class SignatureExpr extends TSignatureExpr , AstNode { }
2252+
22372253/** An argument to an annotation. */
22382254private class AnnotationArg extends TAnnotationArg , AstNode {
22392255 QL:: AnnotArg arg ;
0 commit comments