public override TrackedGeneratorDriver TransformGeneratorDriver(TrackedGeneratorDriver generatorDriver) { // https://github.com/dotnet/roslyn/issues/44161: right now there is no way to tell a GeneratorDriver that an additional file has been added // to allow for incremental updates: our only option is to recreate the generator driver from scratch. // return generatorDriver.WithPendingEdits(_additionalDocuments.SelectAsArray(a => (PendingEdit)new AdditionalFileAddedEdit(new AdditionalTextWithState(a)))); return(new TrackedGeneratorDriver(generatorDriver: null)); }
public override TrackedGeneratorDriver TransformGeneratorDriver(TrackedGeneratorDriver generatorDriver) { // PROTOTYPE: right now there is no way to tell a GeneratorDriver that an additional file has been removed // to allow for incremental updates: our only option is to recreate the generator driver from scratch. // return generatorDriver.WithPendingEdits(_additionalDocuments.SelectAsArray(a => (PendingEdit)new AdditionalFileRemovedEdit(...))); return(new TrackedGeneratorDriver(generatorDriver: null)); }
public override TrackedGeneratorDriver TransformGeneratorDriver(TrackedGeneratorDriver generatorDriver) { // https://github.com/dotnet/roslyn/issues/44161: right now there is no way to tell a GeneratorDriver that an additional file has been changed // to allow for incremental updates: our only option is to recreate the generator driver from scratch. _ = _oldState; _ = _newState; return(new TrackedGeneratorDriver(generatorDriver: null)); }
protected State(ValueSource <Optional <Compilation> >?compilation, Compilation?declarationOnlyCompilation, TrackedGeneratorDriver generatorDriver) { // Declaration-only compilations should never have any references Contract.ThrowIfTrue(declarationOnlyCompilation != null && declarationOnlyCompilation.ExternalReferences.Any()); Compilation = compilation; DeclarationOnlyCompilation = declarationOnlyCompilation; GeneratorDriver = generatorDriver; }
public static State Create( Compilation compilation, TrackedGeneratorDriver generatorDriver, ImmutableArray <ValueTuple <ProjectState, CompilationAndGeneratorDriverTranslationAction> > intermediateProjects) { Contract.ThrowIfNull(compilation); Contract.ThrowIfTrue(intermediateProjects.IsDefault); // If we don't have any intermediate projects to process, just initialize our // DeclarationState now. return(intermediateProjects.Length == 0 ? new FullDeclarationState(compilation, generatorDriver) : (State) new InProgressState(compilation, generatorDriver, intermediateProjects)); }
protected State( ValueSource <Optional <Compilation> >?compilation, Compilation?declarationOnlyCompilation, TrackedGeneratorDriver generatorDriver, ConditionalWeakTable <ISymbol, object?>?unrootedSymbolSet) { // Declaration-only compilations should never have any references Contract.ThrowIfTrue(declarationOnlyCompilation != null && declarationOnlyCompilation.ExternalReferences.Any()); Compilation = compilation; DeclarationOnlyCompilation = declarationOnlyCompilation; GeneratorDriver = generatorDriver; UnrootedSymbolSet = unrootedSymbolSet; }
public override TrackedGeneratorDriver TransformGeneratorDriver(TrackedGeneratorDriver generatorDriver) { var generators = _analyzerReferences.SelectMany(a => a.GetGenerators()).ToImmutableArray(); return(new TrackedGeneratorDriver(generatorDriver.GeneratorDriver?.RemoveGenerators(generators))); }
/// <summary> /// Returns a new <see cref="TrackedGeneratorDriver" /> that can be used for future generator invocations. /// </summary> public virtual TrackedGeneratorDriver TransformGeneratorDriver(TrackedGeneratorDriver generatorDriver) { // Our default behavior is that any edit requires us to re-run a full generation pass, since anything // could have changed. return(new TrackedGeneratorDriver(generatorDriver: null)); }
public InProgressState( Compilation inProgressCompilation, TrackedGeneratorDriver inProgressGeneratorDriver, ImmutableArray <(ProjectState state, CompilationAndGeneratorDriverTranslationAction action)> intermediateProjects)