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

Member predicate Callable::getBody

Gets the body of this callable, if any.

The body is either a BlockStmt or an Expr.

Normally, each callable will have at most one body, except in the case where the same callable is compiled multiple times. For example, if we compile both A.cs

namespaces N {
  public class C {
    public int M() { return 0; }
  }
}

and later B.cs

namespaces N {
  public class C {
    public int M() => 1;
  }
}

then both { return 0; } and 1 are bodies of N.C.M().

ControlFlowElement getBody()