CodeQL library for C#
Search

Member predicate Ssa::ExplicitDefinition::isCapturedVariableDefinitionFlowIn

Holds if this definition updates a captured local scope variable, and the updated value may be read from the implicit entry definition def using one or more calls (as indicated by additionalCalls), starting from call c.

Example:

class C {
  void M1() {
    int i = 0;
    void M2() => System.Console.WriteLine(i);
    i = 1;
    M2();
  }
}

If this definition is the update of i on line 5, then the value may be read inside M2 via the call on line 6.

predicate isCapturedVariableDefinitionFlowIn(ImplicitEntryDefinition def, ElementNode c, boolean additionalCalls)