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

Member predicate DelegateLikeCall::getRuntimeArgument

Gets the argument that corresponds to the ith parameter of a potential run-time target of this call.

Unlike getArgument(), this predicate takes reflection based calls and named arguments into account. Example:

class A {
  virtual void M(int first, int second) { }

  static void CallM(A a) {
    a.M(second: 1, first: 2);
    typeof(A).InvokeMember("M", BindingFlags.Public, null, a, new int[]{ 1, 2 });
  }
}
  • Line 5: The first and second arguments are 1 and 2, respectively. However, the first and second run-time arguments of A.M() are 2 and 1, respectively.

  • Line 6: The static target is Type.InvokeMember() and the first, second, third, fourth, and fifth arguments are "M", BindingFlags.Public, null, a, and new int[]{ 1, 2 }, respectively. However, the run-time target is A.M() and the first and second arguments are 1 and 2, respectively.

Expr getRuntimeArgument(int i)