Merge pull request #75 from github/aschackmull/isclosure

Expose transitive closure syntax.
This commit is contained in:
Anders Schack-Mulligen
2021-10-13 15:45:20 +02:00
committed by GitHub

View File

@@ -783,6 +783,9 @@ class Call extends TCall, Expr, Formula {
final int getNumberOfArguments() { result = count(this.getArgument(_)) }
/** Holds if this call is a transitive closure of `kind` either `+` or `*`. */
predicate isClosure(string kind) { none() }
/**
* Gets the module that contains the predicate.
* E.g. for `Foo::bar()` the result is `Foo`.
@@ -814,6 +817,10 @@ class PredicateCall extends TPredicateCall, Call {
override string getAPrimaryQlClass() { result = "PredicateCall" }
override predicate isClosure(string kind) {
kind = expr.getChild(_).(Generated::Closure).getValue()
}
/**
* Gets the name of the predicate called.
* E.g. for `foo()` the result is "foo".
@@ -850,6 +857,10 @@ class MemberCall extends TMemberCall, Call {
result = expr.getChild(_).(Generated::QualifiedRhs).getName().getValue()
}
override predicate isClosure(string kind) {
kind = expr.getChild(_).(Generated::QualifiedRhs).getChild(_).(Generated::Closure).getValue()
}
/**
* Gets the supertype referenced in this call, that is the `Foo` in `Foo.super.bar(...)`.
*