Example #1
0
 /// <summary>
 /// Constructs a new builder.
 /// </summary>
 /// <param name="configuration">The transformer configuration.</param>
 /// <param name="targetBuilder">The target builder.</param>
 internal Builder(
     TransformerConfiguration configuration,
     ImmutableArray <Transformation> .Builder targetBuilder)
 {
     Configuration = configuration;
     builder       = targetBuilder;
 }
Example #2
0
 /// <summary>
 /// Constructs a new transformer.
 /// </summary>
 /// <param name="configuration">The transformer configuration.</param>
 /// <param name="transformations">The transformations.</param>
 private Transformer(
     TransformerConfiguration configuration,
     ImmutableArray <Transformation> transformations)
 {
     Configuration   = configuration;
     Transformations = transformations;
 }
Example #3
0
        /// <summary>
        /// Creates a transformer for the given optimization level.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="configuration">The transformer configuration.</param>
        /// <param name="inliningMode">The inlining mode to use.</param>
        /// <returns>The created transformer.</returns>
        public static Transformer CreateTransformer(
            this OptimizationLevel level,
            TransformerConfiguration configuration,
            InliningMode inliningMode)
        {
            var builder = Transformer.CreateBuilder(configuration);

            builder.AddOptimizations(inliningMode, level);
            return(builder.ToTransformer());
        }
Example #4
0
        /// <summary>
        /// Creates a transformer for the given optimization level.
        /// </summary>
        /// <param name="level">The level.</param>
        /// <param name="configuration">The transformer configuration.</param>
        /// <param name="contextFlags">The context flags.</param>
        /// <returns>The created transformer.</returns>
        public static Transformer CreateTransformer(
            this OptimizationLevel level,
            TransformerConfiguration configuration,
            ContextFlags contextFlags)
        {
            var builder = Transformer.CreateBuilder(configuration);

            builder.AddOptimizations(contextFlags, level);
            return(builder.ToTransformer());
        }
Example #5
0
        /// <summary>
        /// Creates a transformer.
        /// </summary>
        /// <param name="configuration">The transformer configuration.</param>
        /// <param name="transform">The first transformation.</param>
        /// <param name="transformations">The other transformations.</param>
        /// <returns>The created transformer.</returns>
        public static Transformer Create(
            TransformerConfiguration configuration,
            Transformation transform,
            params Transformation[] transformations)
        {
            var builder = ImmutableArray.CreateBuilder <Transformation>(
                transformations.Length + 1);

            builder.Add(transform);
            builder.AddRange(transformations);
            return(Create(configuration, builder.MoveToImmutable()));
        }
Example #6
0
 /// <summary>
 /// Creates a transformer.
 /// </summary>
 /// <param name="configuration">The transformer configuration.</param>
 /// <param name="transforms">The transformations.</param>
 /// <returns>The created transformer.</returns>
 public static Transformer Create(
     TransformerConfiguration configuration,
     ImmutableArray <Transformation> transforms) =>
 new Transformer(configuration, transforms);
Example #7
0
 /// <summary>
 /// Creates a transformer.
 /// </summary>
 /// <param name="configuration">The transformer configuration.</param>
 /// <param name="transform">The specification to use.</param>
 /// <returns>The created transformer.</returns>
 public static Transformer Create(
     TransformerConfiguration configuration,
     Transformation transform) =>
 Create(configuration, ImmutableArray.Create(transform));
Example #8
0
 /// <summary>
 /// Creates a new transformer builder.
 /// </summary>
 /// <param name="configuration">The transformer configuration.</param>
 /// <returns>A new builder.</returns>
 public static Builder CreateBuilder(TransformerConfiguration configuration) =>
 new Builder(configuration, ImmutableArray.CreateBuilder <Transformation>());