Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1caafb8

Browse files
committed
add type arguments of ModuleInstation to the pretty AST
1 parent adc1466 commit 1caafb8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

ql/ql/src/codeql_ql/ast/Ast.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,20 @@ class ModuleExpr extends TModuleExpr, ModuleRef {
22172217
result = super.getAChild(pred)
22182218
or
22192219
pred = directMember("getQualifier") and result = this.getQualifier()
2220+
or
2221+
exists(int i | pred = indexedMember("getArgument", i) and result = this.getArgument(i))
2222+
}
2223+
2224+
/**
2225+
* Gets the `i`th type argument if this module is a module instantiation.
2226+
* The result is either a `PredicateExpr` or a `TypeExpr`.
2227+
*/
2228+
AstNode getArgument(int i) {
2229+
exists(QL::ModuleInstantiation instantiation | instantiation.getParent() = me |
2230+
toQL(result) = instantiation.getChild(i).getPredicate()
2231+
or
2232+
toQL(result) = instantiation.getChild(i).getTypeExpr()
2233+
)
22202234
}
22212235
}
22222236

0 commit comments

Comments
 (0)