CodeQL library for C#
codeql/csharp-all 0.7.5 ( changelog , source )
Search

Member predicate Call :: getArgumentForParameter

Gets the argument for this call associated with the parameter p, if any.

This takes into account both positional and named arguments, but does not consider default arguments.

An argument must always have a type that is convertible to the relevant parameter type. Therefore, params arguments are only taken into account when they are passed as explicit arrays. For example, in the call to M1 on line 5, o is not an argument for M1’s args parameter, while new object[] { o } on line 6 is, in

class C {
  void M1(params object[] args) { }

  void M2(object o) {
    M1(o);
    M1(new object[] { o });
  }
}
Expr getArgumentForParameter ( Parameter p )