Interface StatementTransformer

All Known Implementing Classes:
AccessorTransforms, ArrayInitializers, AssignmentExpressions, CompoundAssignments, ExpressionTransforms, GeneratedNullChecks, Inlining, NewObjectTransform, StringConcat, SwitchExpressions, SwitchOnString, TernaryExpressions

public interface StatementTransformer
A transform that runs on a sequence of statements within a block.

Interleaving different statement-combining transforms on a per-statement level improves the detection of nested constructs. For example, array initializers can assume each element assignment was already reduced to a single statement even if the element contains a high-level construct detected by a different transform.

Created by covers1624 on 21/7/21.

  • Method Details

    • transform

      void transform(Instruction statement, StatementTransformContext ctx)
      Runs the transform on the statements within a block.

      This transform may only modify instructions after and including the provided position. The transform will run from over the block backwards.

      Instructions prior to the current position must not be modified. It is valid to read such instructions, but not recommended as those have not been transformed yet.

      This function is only called on control-flow blocks with unreachable end-points. This, the last instruction in the block must always have the InstructionFlag.END_POINT_UNREACHABLE flag.

      Parameters:
      ctx - The context.
      block - The block being transformed.
      pos - The position to transform.