Table of Contents

Class TransformDisplayClassUsage

Namespace
ICSharpCode.Decompiler.IL.Transforms
Assembly
ICSharpCode.Decompiler.dll

Transforms closure fields to local variables.

This is a post-processing step of DelegateConstruction, LocalFunctionDecompiler and TransformExpressionTrees.

In general we can perform SROA (scalar replacement of aggregates) on any variable that satisfies the following conditions:

  1. It is initialized by an empty/default constructor call.
  2. The variable is never passed to another method.
  3. The variable is never the target of an invocation.

Note that 2) and 3) apply because declarations and uses of lambdas and local functions are already transformed by the time this transform is applied.

public class TransformDisplayClassUsage : ILVisitor, IILTransform
Inheritance
TransformDisplayClassUsage
Implements
Inherited Members

Constructors

TransformDisplayClassUsage()

public TransformDisplayClassUsage()

Methods

Default(ILInstruction)

Called by Visit*() methods that were not overridden

protected override void Default(ILInstruction inst)

Parameters

inst ILInstruction

VisitILFunction(ILFunction)

protected override void VisitILFunction(ILFunction function)

Parameters

function ILFunction

VisitLdFlda(LdFlda)

protected override void VisitLdFlda(LdFlda inst)

Parameters

inst LdFlda

VisitLdObj(LdObj)

protected override void VisitLdObj(LdObj inst)

Parameters

inst LdObj

VisitStLoc(StLoc)

protected override void VisitStLoc(StLoc inst)

Parameters

inst StLoc

VisitStObj(StObj)

protected override void VisitStObj(StObj inst)

Parameters

inst StObj