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

Predicate Cached::expr_parent_adjusted

The expr_parent() relation adjusted for expandable assignments. For example, the assignment x += y is extracted as

         +=
          |
          2
          |
          =
         / \
        1   0
       /     \
      x       +
             / \
            1   0
           /     \
          x       y

in order to be able to retrieve the expanded assignment x = x + y as the 2nd child. This predicate changes the diagram above into

         +=
        /  \
       1    0
      /      \
     x        y

Import path

import semmle.code.csharp.ExprOrStmtParent
predicate expr_parent_adjusted(Expr child, int i, ControlFlowElement parent)