protected void TestBuildCode(string classFileName, DocumentType contentType, string contentTypeName)
        {
            string expectedOutput;

            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + classFileName + ".cs"))
            {
                expectedOutput = goldReader.ReadToEnd();
            }

            var configuration = CodeGeneratorConfiguration.Create();
            var typeConfig    = configuration.Get(contentTypeName);

            typeConfig.BaseClass = "Umbraco.Core.Models.TypedModelBase";
            typeConfig.Namespace = "Umbraco.CodeGen.Models";

            configuration.TypeMappings.Add(new TypeMapping("Umbraco.Integer", "Int32"));

            OnConfiguring(configuration, contentTypeName);

            var sb     = new StringBuilder();
            var writer = new StringWriter(sb);

            var dataTypeProvider = new TestDataTypeProvider();
            var generator        = new CodeGenerator(typeConfig, dataTypeProvider, CreateGeneratorFactory());

            generator.Generate(contentType, writer);

            writer.Flush();
            Console.WriteLine(sb.ToString());

            Assert.AreEqual(expectedOutput, sb.ToString());
        }
Exemplo n.º 2
0
        private static void TestParse <T>(string fileName, string contentTypeName, T expectedContentType, ParserFactory factory)
            where T : ContentType
        {
            string code;

            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".cs"))
            {
                code = inputReader.ReadToEnd();
            }

            var config = new CodeGeneratorConfiguration().Get(contentTypeName);

            config.BaseClass = "DocumentTypeBase";

            var parser = new CodeParser(
                config,
                TestDataTypeProvider.All,
                factory
                );

            var contentType = parser.Parse(new StringReader(code)).SingleOrDefault();

            var expectedXml = SerializationHelper.BclSerialize(expectedContentType);
            var actualXml   = SerializationHelper.BclSerialize((T)contentType);

            Assert.AreEqual(expectedXml, actualXml);
        }
        private static void TestGeneratedXml(string classFileName, string xmlFileName, string contentTypeName, ParserFactory factory)
        {
            ContentType contentType;
            string      expectedOutput;

            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + xmlFileName + ".xml"))
            {
                expectedOutput = goldReader.ReadToEnd();
            }

            var contentTypeConfig = CodeGeneratorConfiguration.Create().Get(contentTypeName);

            contentTypeConfig.BaseClass = "Umbraco.Core.Models.TypedModelBase";

            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + classFileName + ".cs"))
            {
                var codeParser = new CodeParser(contentTypeConfig, TestDataTypeProvider.All, factory);
                contentType = codeParser.Parse(inputReader).Single();
            }

            var serializer = new ContentTypeSerializer();
            var xml        = serializer.Serialize(contentType);

            Console.WriteLine(xml);

            Assert.AreEqual(expectedOutput, xml);
        }
Exemplo n.º 4
0
        private void TestBuildCode(string classFileName, string xmlFileName, string contentTypeName)
        {
            ContentType contentType;
            var         expectedOutput = "";

            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + xmlFileName + ".xml"))
            {
                contentType = new ContentTypeSerializer().Deserialize(inputReader);
            }
            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + classFileName + ".cs"))
            {
                expectedOutput = goldReader.ReadToEnd();
            }

            var configuration = new CodeGeneratorConfiguration();

            configuration.TypeMappings.Add(new TypeMapping("1413afcb-d19a-4173-8e9a-68288d2a73b8", "Int32"));
            var typeConfig = configuration.Get(contentTypeName);

            typeConfig.BaseClass = "Umbraco.Core.Models.TypedModelBase";
            typeConfig.Namespace = "Umbraco.CodeGen.Models";

            var sb     = new StringBuilder();
            var writer = new StringWriter(sb);

            var dataTypeProvider = new TestDataTypeProvider();
            var generator        = new CodeGenerator(typeConfig, dataTypeProvider, new AnnotatedCodeGeneratorFactory());

            generator.Generate(contentType, writer);

            writer.Flush();
            Console.WriteLine(sb.ToString());

            Assert.AreEqual(expectedOutput, sb.ToString());
        }
Exemplo n.º 5
0
        private static void LoadConfiguration()
        {
            var configurationProvider =
                new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

            configuration = configurationProvider.GetConfiguration();
        }
Exemplo n.º 6
0
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Parser        = new CommonInfoParser(Configuration);
     ContentType   = new MediaType();
     Info          = ContentType.Info;
 }
Exemplo n.º 7
0
 public void SetUp()
 {
     Generator     = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Candidate     = Type = new CodeTypeDeclaration();
     ContentType   = new MediaType();
 }
Exemplo n.º 8
0
        public void SetUp()
        {
            Configuration         = new CodeGeneratorConfiguration().MediaTypes;
            dataTypeConfiguration = TestDataTypeProvider.All;

            Parser = new PropertyParser(Configuration, dataTypeConfiguration);
        }
 public void SetUp()
 {
     Generator     = new StructureGenerator(Configuration);
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     attribute     = new CodeAttributeDeclaration("MediaType");
     contentType   = new MediaType();
 }
Exemplo n.º 10
0
        public void SetUp()
        {
            Configuration         = CodeGeneratorConfiguration.Create().MediaTypes;
            DataTypeConfiguration = TestDataTypeProvider.All;

            Parser = CreateParser();
        }
Exemplo n.º 11
0
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Parser        = new DocumentTypeInfoParser(Configuration);
     ContentType   = new DocumentType();
     Info          = ContentType.Info;
     typedInfo     = (DocumentTypeInfo)Info;
 }
 public void SetUp()
 {
     Configuration           = new CodeGeneratorConfiguration().MediaTypes;
     Configuration.Namespace = "MyWeb.Models";
     ContentType             = new MediaType();
     Generator   = new NamespaceGenerator(Configuration);
     compileUnit = new CodeCompileUnit();
 }
Exemplo n.º 13
0
        public static void SaveConfiguration(CodeGeneratorConfiguration newConfiguration)
        {
            var configurationProvider =
                new CodeGeneratorConfigurationFileProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

            configurationProvider.SaveConfiguration(newConfiguration);
            LoadConfiguration();
        }
Exemplo n.º 14
0
 public void MergeInto (CodeGeneratorConfiguration result) {
     if (EliminateStructCopies.HasValue)
         result.EliminateStructCopies = EliminateStructCopies;
     if (EliminateTemporaries.HasValue)
         result.EliminateTemporaries = EliminateTemporaries;
     if (SimplifyLoops.HasValue)
         result.SimplifyLoops = SimplifyLoops;
     if (SimplifyOperators.HasValue)
         result.SimplifyOperators = SimplifyOperators;
     if (EliminateRedundantControlFlow.HasValue)
         result.EliminateRedundantControlFlow = EliminateRedundantControlFlow;
     if (CacheMethodSignatures.HasValue)
         result.CacheMethodSignatures = CacheMethodSignatures;
     if (DisableGenericSignaturesLocalCache.HasValue)
         result.DisableGenericSignaturesLocalCache = DisableGenericSignaturesLocalCache;
     if (PreferLocalCacheForGenericMethodSignatures.HasValue)
         result.PreferLocalCacheForGenericMethodSignatures = PreferLocalCacheForGenericMethodSignatures;
     if (PreferLocalCacheForGenericInterfaceMethodSignatures.HasValue)
         result.PreferLocalCacheForGenericInterfaceMethodSignatures = PreferLocalCacheForGenericInterfaceMethodSignatures;
     if (CacheOneMethodSignaturePerMethod.HasValue)
         result.CacheOneMethodSignaturePerMethod = CacheOneMethodSignaturePerMethod;
     if (CacheTypeExpressions.HasValue)
         result.CacheTypeExpressions = CacheTypeExpressions;
     if (CacheBaseMethodHandles.HasValue)
         result.CacheBaseMethodHandles = CacheBaseMethodHandles;
     if (EliminatePointlessFinallyBlocks.HasValue)
         result.EliminatePointlessFinallyBlocks = EliminatePointlessFinallyBlocks;
     if (PreferAccessorMethods.HasValue)
         result.PreferAccessorMethods = PreferAccessorMethods;
     if (HintIntegerArithmetic.HasValue)
         result.HintIntegerArithmetic = HintIntegerArithmetic;
     if (FreezeImmutableObjects.HasValue)
         result.FreezeImmutableObjects = FreezeImmutableObjects;
     if (EnableUnsafeCode.HasValue)
         result.EnableUnsafeCode = EnableUnsafeCode;
     if (EnableThreadedTransforms.HasValue)
         result.EnableThreadedTransforms = EnableThreadedTransforms;
     if (HoistAllocations.HasValue)
         result.HoistAllocations = HoistAllocations;
     if (HintDoubleArithmetic.HasValue)
         result.HintDoubleArithmetic = HintDoubleArithmetic;
     if (AutoGenerateEventAccessorsInSkeletons.HasValue)
         result.AutoGenerateEventAccessorsInSkeletons = AutoGenerateEventAccessorsInSkeletons;
     if (AggressivelyUseElementProxies.HasValue)
         result.AggressivelyUseElementProxies = AggressivelyUseElementProxies;
     if (EmitAllParameterNames.HasValue)
         result.EmitAllParameterNames = EmitAllParameterNames;
     if (StripUnusedLoopNames.HasValue)
         result.StripUnusedLoopNames = StripUnusedLoopNames;
     if (IntroduceCharCasts.HasValue)
         result.IntroduceCharCasts = IntroduceCharCasts;
     if (IntroduceEnumCasts.HasValue)
         result.IntroduceEnumCasts = IntroduceEnumCasts;
     if (EmulateInt64.HasValue)
         result.EmulateInt64 = EmulateInt64;
     if (DecomposeAllMutationOperators.HasValue)
         result.DecomposeAllMutationOperators = DecomposeAllMutationOperators;
 }
Exemplo n.º 15
0
        public void Parse_Definition_WhenMissingOrUnknown_AndDefaultIsMissing_Throws()
        {
            codeGenConfig = new CodeGeneratorConfiguration();
            codeGenConfig.DefaultDefinitionId = "";
            Configuration = codeGenConfig.MediaTypes;
            Parser        = new PropertyParser(Configuration, dataTypeConfiguration);

            ParseProperty(PureProperty);
        }
        public void Create_DelegatesConfiguration()
        {
            var factory             = new DefaultParserFactory();
            var configuration       = new ContentTypeConfiguration(CodeGeneratorConfiguration.Create(), "DocumentType");
            var dataTypeDefinitions = new List <DataTypeDefinition>();
            var parser = factory.Create(configuration, dataTypeDefinitions);

            Assert.IsInstanceOf <DocumentTypeCodeParser>(parser);
        }
        public void Parse_Definition_WhenMissingOrUnknown_AndDefaultIsMissing_Throws()
        {
            CodeGenConfig = CodeGeneratorConfiguration.Create();
            CodeGenConfig.TypeMappings.DefaultDefinitionId = "";
            Configuration = CodeGenConfig.MediaTypes;
            Parser        = new PropertyParser(Configuration, DataTypeConfiguration);

            ParseProperty(PureProperty);
        }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().DocumentTypes;
     Candidate     = Type = new CodeTypeDeclaration();
     Generator     = new InterfaceNameGenerator(Configuration);
     documentType  = new DocumentType {
         Info = { Alias = "aMixin" }
     };
     EntityDescription = documentType.Info;
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Candidate     = Type = new CodeTypeDeclaration();
     generator     = new DocumentTypeInfoGenerator(Configuration);
     documentType  = new DocumentType {
         Info = { Alias = "aClass" }
     };
     info = (DocumentTypeInfo)documentType.Info;
 }
 public void SetUp()
 {
     Configuration = new CodeGeneratorConfiguration().MediaTypes;
     Candidate     = Type = new CodeTypeDeclaration();
     Generator     = new EntityDescriptionGenerator(Configuration);
     documentType  = new DocumentType {
         Info = { Alias = "anEntity" }
     };
     EntityDescription = documentType.Info;
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     attribute     = new CodeAttributeDeclaration();
     Generator     = new EntityDescriptionGenerator(Configuration);
     documentType  = new DocumentType {
         Info = { Alias = "anEntity" }
     };
     EntityDescription = documentType.Info;
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Generator     = new CommonInfoGenerator(Configuration);
     ContentType   = new MediaType {
         Info = { Alias = "anEntity" }
     };
     Candidate = Type = new CodeTypeDeclaration();
     info      = ContentType.Info;
 }
Exemplo n.º 23
0
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().DocumentTypes;
     Generator     = new InterfaceGenerator(
         Configuration
         );
     ContentType = new DocumentType {
         Info = { Alias = "Mixin" }
     };
     ns = new CodeNamespace("ANamespace");
 }
Exemplo n.º 24
0
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     attribute     = new CodeAttributeDeclaration("DocumentType");
     generator     = new DocumentTypeInfoGenerator(Configuration);
     documentType  = new DocumentType
     {
         Info = info = new DocumentTypeInfo {
             Alias = "aClass"
         }
     };
 }
 public void SetUp()
 {
     Configuration = CodeGeneratorConfiguration.Create().MediaTypes;
     Generator     = new ClassGenerator(
         Configuration,
         new EntityDescriptionGenerator(Configuration)
         );
     ContentType = new MediaType {
         Info = { Alias = "anEntity" }
     };
     info = ContentType.Info;
     ns   = new CodeNamespace("ANamespace");
 }
Exemplo n.º 26
0
 public ModelGenerator(
     CodeGeneratorConfiguration configuration,
     CodeGeneratorFactory generatorFactory,
     CodeGeneratorFactory interfaceGeneratorFactory,
     UmbracoDataTypesProvider dataTypeProvider,
     IDictionary <string, string> paths)
 {
     this.configuration             = configuration;
     this.generatorFactory          = generatorFactory;
     this.interfaceGeneratorFactory = interfaceGeneratorFactory;
     this.dataTypeProvider          = dataTypeProvider;
     this.paths = paths;
 }
 public void SetUp()
 {
     codeGenConfig = new CodeGeneratorConfiguration();
     Configuration = codeGenConfig.MediaTypes;
     Generator     = new PropertyInfoGenerator(
         Configuration,
         TestDataTypeProvider.All
         );
     attribute = new CodeAttributeDeclaration();
     property  = new GenericProperty {
         Alias = "anEntity"
     };
 }
Exemplo n.º 28
0
 public void SetUp()
 {
     codeGenConfig = CodeGeneratorConfiguration.Create();
     Configuration = codeGenConfig.DocumentTypes;
     Generator     = new InterfacePropertyDeclarationGenerator(
         Configuration,
         TestDataTypeProvider.All,
         new EntityDescriptionGenerator(Configuration)
         );
     Candidate = codeProperty = new CodeMemberProperty();
     property  = new GenericProperty {
         Alias = "aProperty"
     };
 }
Exemplo n.º 29
0
 public void SetUp()
 {
     codeGenConfig = CodeGeneratorConfiguration.Create();
     Configuration = codeGenConfig.MediaTypes;
     Generator     = new PropertyInfoGenerator(
         Configuration,
         TestDataTypeProvider.All,
         new EntityDescriptionGenerator(Configuration)
         );
     Candidate = codeProperty = new CodeMemberProperty();
     property  = new GenericProperty {
         Alias = "anEntity"
     };
 }
        public void SetUp()
        {
            Configuration = new CodeGeneratorConfiguration().MediaTypes;
            Candidate     = type = new CodeTypeDeclaration();
            contentType   = new MediaType
            {
                Info = info = new Info {
                    Alias = "anEntity"
                }
            };

            attribute = new CodeAttributeDeclaration("MediaType");
            type.CustomAttributes.Add(attribute);

            Generator = new CommonInfoGenerator(Configuration);
        }
        public void Generate_Adds_Getter()
        {
            var property = new GenericProperty {
                Alias = "aProperty"
            };
            var propNode = new CodeMemberProperty {
                Type = new CodeTypeReference("String")
            };

            var generator = new InterfacePropertyBodyGenerator(CodeGeneratorConfiguration.Create().DocumentTypes);

            generator.Generate(propNode, property);

            Assert.IsTrue(propNode.HasGet);
            Assert.AreEqual(0, propNode.GetStatements.Count);
        }
		private static void TestGeneratedXml(string fileName, string contentTypeName)
		{
			var code = "";
			var expectedOutput = "";
            using (var inputReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".cs"))
			{
				code = inputReader.ReadToEnd();
			}
            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".xml"))
			{
				expectedOutput = goldReader.ReadToEnd();
			}

			var configuration = new CodeGeneratorConfiguration
			{
				TypeMappings = new Dictionary<string, string>(),
				DefaultTypeMapping = "string"
			};
			configuration.DocumentTypes = new ContentTypeConfiguration(configuration)
			{
				ContentTypeName = contentTypeName,
				BaseClass = "DocumentTypeBase",
			};

			var dataTypeConfiguration = new List<DataTypeDefinition>
			{
				new DataTypeDefinition("RTE", "5e9b75ae-face-41c8-b47e-5f4b0fd82f83", "ca90c950-0aff-4e72-b976-a30b1ac57dad"),
				new DataTypeDefinition("Textstring", "ec15c1e5-9d90-422a-aa52-4f7622c63bea", "0cc0eba1-9960-42c9-bf9b-60e150b429ae"),
				new DataTypeDefinition("Numeric", "1413afcb-d19a-4173-8e9a-68288d2a73b8", "2e6d3631-066e-44b8-aec4-96f09099b2b5")
			};

			var reader = new StringReader(code);
			var generator = new DocumentTypeXmlGenerator(configuration.DocumentTypes, dataTypeConfiguration);
			var doc = generator.Generate(reader).First();

			var sb = new StringBuilder();
			var writer = new StringWriter(sb);
			doc.Save(writer);
			writer.Flush();
			Console.WriteLine(sb.ToString());

			Assert.AreEqual(expectedOutput, sb.ToString());
		}
Exemplo n.º 33
0
 public void MergeInto (CodeGeneratorConfiguration result) {
     if (EliminateStructCopies.HasValue)
         result.EliminateStructCopies = EliminateStructCopies;
     if (EliminateTemporaries.HasValue)
         result.EliminateTemporaries = EliminateTemporaries;
     if (SimplifyLoops.HasValue)
         result.SimplifyLoops = SimplifyLoops;
     if (SimplifyOperators.HasValue)
         result.SimplifyOperators = SimplifyOperators;
     if (EliminateRedundantControlFlow.HasValue)
         result.EliminateRedundantControlFlow = EliminateRedundantControlFlow;
     if (CacheMethodSignatures.HasValue)
         result.CacheMethodSignatures = CacheMethodSignatures;
     if (CacheGenericMethodSignatures.HasValue)
         result.CacheGenericMethodSignatures = CacheGenericMethodSignatures;
     if (CacheTypeExpressions.HasValue)
         result.CacheTypeExpressions = CacheTypeExpressions;
     if (CacheBaseMethodHandles.HasValue)
         result.CacheBaseMethodHandles = CacheBaseMethodHandles;
     if (EliminatePointlessFinallyBlocks.HasValue)
         result.EliminatePointlessFinallyBlocks = EliminatePointlessFinallyBlocks;
     if (PreferAccessorMethods.HasValue)
         result.PreferAccessorMethods = PreferAccessorMethods;
     if (HintIntegerArithmetic.HasValue)
         result.HintIntegerArithmetic = HintIntegerArithmetic;
     if (FreezeImmutableObjects.HasValue)
         result.FreezeImmutableObjects = FreezeImmutableObjects;
     if (EnableUnsafeCode.HasValue)
         result.EnableUnsafeCode = EnableUnsafeCode;
     if (EnableThreadedTransforms.HasValue)
         result.EnableThreadedTransforms = EnableThreadedTransforms;
     if (HoistAllocations.HasValue)
         result.HoistAllocations = HoistAllocations;
     if (HintDoubleArithmetic.HasValue)
         result.HintDoubleArithmetic = HintDoubleArithmetic;
     if (AutoGenerateEventAccessorsInSkeletons.HasValue)
         result.AutoGenerateEventAccessorsInSkeletons = AutoGenerateEventAccessorsInSkeletons;
     if (AggressivelyUseElementProxies.HasValue)
         result.AggressivelyUseElementProxies = AggressivelyUseElementProxies;
     if (EmitAllParameterNames.HasValue)
         result.EmitAllParameterNames = EmitAllParameterNames;
 }
Exemplo n.º 34
0
		public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			var uSyncConfigurationProvider = new USyncConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/uSyncSettings.config"), new HttpContextPathResolver());
			var configurationProvider = new UmbracoCodeGeneratorConfigurationProvider(HttpContext.Current.Server.MapPath("~/config/CodeGen.config"));

			uSyncConfiguration = uSyncConfigurationProvider.GetConfiguration();
			
			dataTypesProvider = new USyncDataTypeProvider(uSyncConfiguration.USyncFolder);
	
			dataTypes = dataTypesProvider.GetDataTypes();
			configuration = configurationProvider.GetConfiguration();

			paths.Add("DocumentType", HttpContext.Current.Server.MapPath(configuration.DocumentTypes.ModelPath));
			paths.Add("MediaType", HttpContext.Current.Server.MapPath(configuration.MediaTypes.ModelPath));

			XmlDoc.Saved += OnDocumentTypeSaved;

			if (configuration.DocumentTypes.GenerateXml)
				GenerateXml(configuration.DocumentTypes);
			if (configuration.MediaTypes.GenerateXml)
				GenerateXml(configuration.MediaTypes);
		}
		private static void TestBuildCode(string fileName, string contentTypeName)
		{
			var xml = "";
			var expectedOutput = "";
			using (var inputReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".xml"))
			{
				xml = inputReader.ReadToEnd();
			}
            using (var goldReader = File.OpenText(@"..\..\TestFiles\" + fileName + ".cs"))
			{
				expectedOutput = goldReader.ReadToEnd();
			}

			var configuration = new CodeGeneratorConfiguration
			{
				TypeMappings = new Dictionary<string, string>
				{
					{"1413afcb-d19a-4173-8e9a-68288d2a73b8", "Int32"}
				},
				DefaultTypeMapping = "String",
			};
			var typeConfig = new ContentTypeConfiguration(configuration)
			{
				ContentTypeName = contentTypeName,
				BaseClass = "DocumentTypeBase",
				Namespace = "Umbraco.CodeGen.Models"
			};

			var sb = new StringBuilder();
			var writer = new StringWriter(sb);
			var generator = new ContentTypeCodeGenerator(typeConfig, XDocument.Parse(xml), new CSharpCodeProvider());
			generator.BuildCode(writer);
			writer.Flush();
			Console.WriteLine(sb.ToString());

			Assert.AreEqual(expectedOutput, sb.ToString());
		}
Exemplo n.º 36
0
 public void MergeInto(CodeGeneratorConfiguration result)
 {
     if (EliminateStructCopies.HasValue)
         result.EliminateStructCopies = EliminateStructCopies;
     if (EliminateTemporaries.HasValue)
         result.EliminateTemporaries = EliminateTemporaries;
     if (SimplifyLoops.HasValue)
         result.SimplifyLoops = SimplifyLoops;
     if (SimplifyOperators.HasValue)
         result.SimplifyOperators = SimplifyOperators;
     if (EliminateRedundantControlFlow.HasValue)
         result.EliminateRedundantControlFlow = EliminateRedundantControlFlow;
     if (CacheMethodSignatures.HasValue)
         result.CacheMethodSignatures = CacheMethodSignatures;
     if (EliminatePointlessFinallyBlocks.HasValue)
         result.EliminatePointlessFinallyBlocks = EliminatePointlessFinallyBlocks;
     if (CacheTypeExpressions.HasValue)
         result.CacheTypeExpressions = CacheTypeExpressions;
     if (PreferAccessorMethods.HasValue)
         result.PreferAccessorMethods = PreferAccessorMethods;
     if (HintIntegerArithmetic.HasValue)
         result.HintIntegerArithmetic = HintIntegerArithmetic;
     if (FreezeImmutableObjects.HasValue)
         result.FreezeImmutableObjects = FreezeImmutableObjects;
     if (EnableUnsafeCode.HasValue)
         result.EnableUnsafeCode = EnableUnsafeCode;
     if (EnableThreadedTransforms.HasValue)
         result.EnableThreadedTransforms = EnableThreadedTransforms;
 }