internal BindingCompilerOptimization(XamlPlatformInfo xamlPlatformInfo, ProjectInfo projectInfo, BindingCompilerSettings bindingCompilerSettings, IFileSystem fileSystem)
        {
            this.xamlPlatformInfo        = xamlPlatformInfo;
            this.projectInfo             = projectInfo;
            this.useSourceGenerator      = bindingCompilerSettings.UseSourceGenerator;
            this.bindingXamlPlatformInfo = new BindingXamlPlatformInfo(xamlPlatformInfo, bindingCompilerSettings);
            this.bindingTreeParser       = new BindingTreeParser(
                this.bindingXamlPlatformInfo,
                new BindingMarkupExtensionParser(new BindingPathParser(new BindingPathLexicalAnalyzer())),
                bindingCompilerSettings.OptInToOptimizations);
            var codeAnalyzer = new CodeAnalyzer(
                this.projectInfo.AssemblyName,
                this.projectInfo.Compiles,
                this.projectInfo.AssemblyReferences,
                fileSystem.File,
                new XamlTypeBaseTypeSourceCodeGenerator(
                    this.projectInfo.XDocumentProvider,
                    this.bindingXamlPlatformInfo.XClassName,
                    this.projectInfo.AssemblyName,
                    this.projectInfo.AssemblyReferences,
                    this.bindingXamlPlatformInfo.XamlTypeToSourceCodeNamespaces),
                !bindingCompilerSettings.UseSourceGenerator);

            this.typeResolver = new TypeResolver(codeAnalyzer);
            this.bindingOptimizationWriter = new BindingOptimizationWriter(this.projectInfo.IntermediateDirectory, xamlPlatformInfo, fileSystem);
            this.bindingContainerXamlModificationCollector = new BindingContainerXamlModificationCollector();
            this.bindingContainerCodeGenerator             = new BindingContainerCodeGenerator(
                new BindingPathCodeGenerator(
                    this.typeResolver,
                    this.bindingXamlPlatformInfo,
                    new ReadOnlyDependencyPropertyToNotificationEventResolver(codeAnalyzer, this.bindingXamlPlatformInfo.ReadOnlyDependencyPropertyNotificationEvents),
                    new BindingModeResolver(this.bindingXamlPlatformInfo.OneWayBindingProperties, codeAnalyzer, xamlPlatformInfo.XamlPlatform),
                    new TypeAssignmentCompatibilityAssessor(codeAnalyzer)),
                this.bindingXamlPlatformInfo,
                this.typeResolver);
        }
 /// <summary>Initializes a new instance of the <see cref="BindingCompilerOptimization"/> class.</summary>
 /// <param name="xamlPlatformInfo">The xaml platform information.</param>
 /// <param name="projectInfo">The project info.</param>
 /// <param name="bindingCompilerSettings">The binding compiler settings.</param>
 public BindingCompilerOptimization(XamlPlatformInfo xamlPlatformInfo, ProjectInfo projectInfo, BindingCompilerSettings bindingCompilerSettings)
     : this(xamlPlatformInfo, projectInfo, bindingCompilerSettings, new FileSystem())
 {
 }