Skip to content

Commit 4b73c99

Browse files
authored
QL: Merge pull request #75 from github/aschackmull/isclosure
Expose transitive closure syntax.
2 parents 366fc23 + 7d68020 commit 4b73c99

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

ql/src/codeql_ql/ast/Ast.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,9 @@ class Call extends TCall, Expr, Formula {
783783

784784
final int getNumberOfArguments() { result = count(this.getArgument(_)) }
785785

786+
/** Holds if this call is a transitive closure of `kind` either `+` or `*`. */
787+
predicate isClosure(string kind) { none() }
788+
786789
/**
787790
* Gets the module that contains the predicate.
788791
* E.g. for `Foo::bar()` the result is `Foo`.
@@ -814,6 +817,10 @@ class PredicateCall extends TPredicateCall, Call {
814817

815818
override string getAPrimaryQlClass() { result = "PredicateCall" }
816819

820+
override predicate isClosure(string kind) {
821+
kind = expr.getChild(_).(Generated::Closure).getValue()
822+
}
823+
817824
/**
818825
* Gets the name of the predicate called.
819826
* E.g. for `foo()` the result is "foo".
@@ -850,6 +857,10 @@ class MemberCall extends TMemberCall, Call {
850857
result = expr.getChild(_).(Generated::QualifiedRhs).getName().getValue()
851858
}
852859

860+
override predicate isClosure(string kind) {
861+
kind = expr.getChild(_).(Generated::QualifiedRhs).getChild(_).(Generated::Closure).getValue()
862+
}
863+
853864
/**
854865
* Gets the supertype referenced in this call, that is the `Foo` in `Foo.super.bar(...)`.
855866
*

0 commit comments

Comments
 (0)