mirror of
https://github.com/github/codeql.git
synced 2026-02-08 03:01:10 +01:00
Merge pull request #75 from github/aschackmull/isclosure
Expose transitive closure syntax.
This commit is contained in:
@@ -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(...)`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user