protected CompilationTrackerState( ValueSource <Optional <Compilation> >?compilationWithoutGeneratedDocuments, CompilationTrackerGeneratorInfo generatorInfo) { CompilationWithoutGeneratedDocuments = compilationWithoutGeneratedDocuments; GeneratorInfo = generatorInfo; }
public static CompilationTrackerState Create( Compilation compilation, CompilationTrackerGeneratorInfo generatorInfo, Compilation?compilationWithGeneratedDocuments, ImmutableArray <ValueTuple <ProjectState, CompilationAndGeneratorDriverTranslationAction> > intermediateProjects) { Contract.ThrowIfTrue(intermediateProjects.IsDefault); // If we don't have any intermediate projects to process, just initialize our // DeclarationState now. We'll pass false for generatedDocumentsAreFinal because this is being called // if our referenced projects are changing, so we'll have to rerun to consume changes. return(intermediateProjects.Length == 0 ? new AllSyntaxTreesParsedState(compilation, generatorInfo.WithDocumentsAreFinal(false)) : new InProgressState(compilation, generatorInfo, compilationWithGeneratedDocuments, intermediateProjects)); }
protected CompilationTrackerState( Compilation?compilationWithoutGeneratedDocuments, CompilationTrackerGeneratorInfo generatorInfo) { CompilationWithoutGeneratedDocuments = compilationWithoutGeneratedDocuments; GeneratorInfo = generatorInfo; #if DEBUG // As a sanity check, we should never see the generated trees inside of the compilation that should not // have generated trees. var compilation = compilationWithoutGeneratedDocuments; if (compilation != null) { foreach (var generatedDocument in generatorInfo.Documents.States.Values) { Contract.ThrowIfTrue(compilation.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None))); } } #endif }
private FinalState( Compilation finalCompilation, Compilation compilationWithoutGeneratedFiles, bool hasSuccessfullyLoaded, CompilationTrackerGeneratorInfo generatorInfo, UnrootedSymbolSet unrootedSymbolSet) : base(compilationWithoutGeneratedFiles, generatorInfo.WithDocumentsAreFinal(true)) // when we're in a final state, we've ran generators and should not run again { Contract.ThrowIfNull(finalCompilation); HasSuccessfullyLoaded = hasSuccessfullyLoaded; FinalCompilationWithGeneratedDocuments = finalCompilation; UnrootedSymbolSet = unrootedSymbolSet; if (this.GeneratorInfo.Documents.IsEmpty) { // In this case, the finalCompilationSource and compilationWithoutGeneratedFilesSource should point to the // same Compilation, which should be compilationWithoutGeneratedFiles itself Debug.Assert(object.ReferenceEquals(finalCompilation, compilationWithoutGeneratedFiles)); } }
private FinalState( Compilation finalCompilation, Compilation compilationWithoutGeneratedFiles, bool hasSuccessfullyLoaded, CompilationTrackerGeneratorInfo generatorInfo, UnrootedSymbolSet unrootedSymbolSet) : base(compilationWithoutGeneratedFiles, generatorInfo.WithDocumentsAreFinal(true)) // when we're in a final state, we've ran generators and should not run again { Contract.ThrowIfNull(finalCompilation); HasSuccessfullyLoaded = hasSuccessfullyLoaded; FinalCompilationWithGeneratedDocuments = finalCompilation; UnrootedSymbolSet = unrootedSymbolSet; if (this.GeneratorInfo.Documents.IsEmpty) { // If we have no generated files, the pre-generator compilation and post-generator compilation // should be the exact same instance; that way we're not creating more compilations than // necessary that would be unable to share source symbols. Debug.Assert(object.ReferenceEquals(finalCompilation, compilationWithoutGeneratedFiles)); } }
/// <param name="finalCompilation">Not held onto</param> /// <param name="projectId">Not held onto</param> /// <param name="metadataReferenceToProjectId">Not held onto</param> public static FinalState Create( Compilation finalCompilationSource, Compilation compilationWithoutGeneratedFiles, bool hasSuccessfullyLoaded, CompilationTrackerGeneratorInfo generatorInfo, Compilation finalCompilation, ProjectId projectId, Dictionary <MetadataReference, ProjectId>?metadataReferenceToProjectId) { // Keep track of information about symbols from this Compilation. This will help support other APIs // the solution exposes that allows the user to map back from symbols to project information. var unrootedSymbolSet = UnrootedSymbolSet.Create(finalCompilation); RecordAssemblySymbols(projectId, finalCompilation, metadataReferenceToProjectId); return(new FinalState( finalCompilationSource, compilationWithoutGeneratedFiles, hasSuccessfullyLoaded, generatorInfo, unrootedSymbolSet)); }
public InProgressState( Compilation inProgressCompilation, CompilationTrackerGeneratorInfo generatorInfo, Compilation?compilationWithGeneratedDocuments, ImmutableArray <(ProjectState state, CompilationAndGeneratorDriverTranslationAction action)> intermediateProjects)
public NoCompilationState(CompilationTrackerGeneratorInfo generatorInfo) : base(compilationWithoutGeneratedDocuments: null, generatorInfo) { }
public AllSyntaxTreesParsedState(Compilation declarationCompilation, CompilationTrackerGeneratorInfo generatorInfo) : base(declarationCompilation, generatorInfo) { }
public static CompilationTrackerState Create( Compilation compilation, CompilationTrackerGeneratorInfo generatorInfo, Compilation?compilationWithGeneratedDocuments, ImmutableList <(ProjectState state, CompilationAndGeneratorDriverTranslationAction action)> intermediateProjects)