Exemplo n.º 1
0
        private SourceFileGroupingBuilder(IFileResolver fileResolver, IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, SourceFileGrouping current, RootConfiguration configuration)
        {
            this.fileResolver     = fileResolver;
            this.moduleDispatcher = moduleDispatcher;
            this.workspace        = workspace;
            this.configuration    = configuration;

            this.sourceFilesByModuleDeclaration   = new(current.SourceFilesByModuleDeclaration);
            this.errorBuildersByModuleDeclaration = new(current.ErrorBuildersByModuleDeclaration);

            this.modulesToRestore = new();

            this.sourceFilesByUri   = current.SourceFiles.ToDictionary(tree => tree.FileUri);
            this.errorBuildersByUri = new();
        }
Exemplo n.º 2
0
        public static SourceFileGrouping Rebuild(IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, SourceFileGrouping current, RootConfiguration configuration)
        {
            var builder = new SourceFileGroupingBuilder(current.FileResolver, moduleDispatcher, workspace, current, configuration);

            foreach (var module in current.ModulesToRestore)
            {
                builder.sourceFilesByModuleDeclaration.Remove(module);
                builder.errorBuildersByModuleDeclaration.Remove(module);
            }

            return(builder.Build(current.EntryPoint.FileUri));
        }
Exemplo n.º 3
0
        public static SourceFileGrouping Rebuild(IModuleDispatcher moduleDispatcher, IReadOnlyWorkspace workspace, SourceFileGrouping current, RootConfiguration configuration)
        {
            var builder = new SourceFileGroupingBuilder(current.FileResolver, moduleDispatcher, workspace, current, configuration);

            foreach (var module in current.ModulesToRestore)
            {
                builder.sourceFilesByModuleDeclaration.Remove(module);
                builder.errorBuildersByModuleDeclaration.Remove(module);
            }

            // Rebuild source files that contains external module references restored during the inital build.
            var sourceFilesToRebuild = current.SourceFiles
                                       .Where(sourceFile => GetModuleDeclarations(sourceFile).Any(moduleDeclaration => current.ModulesToRestore.Contains(moduleDeclaration)))
                                       .ToImmutableHashSet();

            return(builder.Build(current.EntryPoint.FileUri, sourceFilesToRebuild));
        }