internal void Transform <THandler>( IRContext context, THandler handler) where THandler : ITransformerHandler { Debug.Assert(context != null, "Invalid conext"); var toTransform = context.GetMethodCollection( new MethodPredicate(Configuration.RequiredFlags)); if (toTransform.TotalNumMethods < 1) { return; } // Apply all transformations foreach (var transform in Transformations) { handler.BeforeTransformation( context, transform); transform.Transform(toTransform); handler.AfterTransformation( context, transform); } // Apply final flags foreach (var entry in toTransform) { entry.AddTransformationFlags(Configuration.TransformationFlags); } if (Configuration.FinalGC) { context.GC(); } }