3 types derived from DiagnosticOr
Microsoft.Interop.SourceGeneration (3)
DiagnosticOr.cs (3)
33private sealed record Diag : DiagnosticOr<T> 43private sealed record Val : DiagnosticOr<T> 53private sealed record ValueAndDiagnostic : DiagnosticOr<T>
48 references to DiagnosticOr
Microsoft.Interop.ComInterfaceGenerator (29)
ComClassInfo.cs (5)
26public static DiagnosticOr<ComClassInfo> From(INamedTypeSymbol type, ClassDeclarationSyntax syntax, bool unsafeCodeIsEnabled) 30return DiagnosticOr<ComClassInfo>.From(DiagnosticInfo.Create(GeneratorDiagnostics.RequiresAllowUnsafeBlocks, syntax.Identifier.GetLocation())); 35return DiagnosticOr<ComClassInfo>.From( 58return DiagnosticOr<ComClassInfo>.From(DiagnosticInfo.Create(GeneratorDiagnostics.ClassDoesNotImplementAnyGeneratedComInterface, 63return DiagnosticOr<ComClassInfo>.From(
ComInterfaceContext.cs (14)
30public static ImmutableArray<DiagnosticOr<ComInterfaceContext>> GetContexts(ImmutableArray<ComInterfaceInfo> data, CancellationToken _) 33var accumulator = ImmutableArray.CreateBuilder<DiagnosticOr<ComInterfaceContext>>(data.Length); 38Dictionary<string, DiagnosticOr<ComInterfaceContext>> nameToContextCache = new(); 46DiagnosticOr<ComInterfaceContext> AddContext(ComInterfaceInfo iface) 48if (nameToContextCache.TryGetValue(iface.ThisInterfaceKey, out var cachedValue)) 55var baselessCtx = DiagnosticOr<ComInterfaceContext>.From(new ComInterfaceContext(iface, null, iface.Options) { IsExternallyDefined = iface.IsExternallyDefined }); 60DiagnosticOr<ComInterfaceContext> baseReturnedValue; 63(nameToContextCache.TryGetValue(iface.BaseInterfaceKey, out var baseCachedValue) && baseCachedValue.HasDiagnostic) 70var diagnostic = DiagnosticOr<ComInterfaceContext>.From( 77DiagnosticOr<ComInterfaceContext> baseContext = baseCachedValue ?? baseReturnedValue; 79var ctx = DiagnosticOr<ComInterfaceContext>.From(new ComInterfaceContext(iface, baseContext.Value, iface.Options) { IsExternallyDefined = iface.IsExternallyDefined });
ComMethodInfo.cs (10)
40public static SequenceEqualImmutableArray<DiagnosticOr<(ComMethodInfo ComMethod, IMethodSymbol Symbol)>> GetMethodsFromInterface((ComInterfaceInfo ifaceContext, INamedTypeSymbol ifaceSymbol) data, CancellationToken ct) 42var methods = ImmutableArray.CreateBuilder<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>(); 53methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(member.CreateDiagnosticInfo(GeneratorDiagnostics.InstancePropertyDeclaredInInterface, member.Name, data.ifaceSymbol.ToDisplayString()))); 56methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(member.CreateDiagnosticInfo(GeneratorDiagnostics.InstanceEventDeclaredInInterface, member.Name, data.ifaceSymbol.ToDisplayString()))); 86private static DiagnosticOr<(ComMethodInfo, IMethodSymbol)> CalculateMethodInfo(ComInterfaceInfo ifaceContext, IMethodSymbol method, CancellationToken ct) 96return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(( 119return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.MethodNotDeclaredInAttributedInterface, method.Locations.FirstOrDefault(), method.ToDisplayString())); 135return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.CannotAnalyzeMethodPattern, method.Locations.FirstOrDefault(), method.ToDisplayString())); 141return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(diag); 153return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From((comMethodInfo, method));
Microsoft.Interop.LibraryImportGenerator (2)
LibraryImportGenerator.cs (2)
58? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 59: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol));
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelLibraryImportGenerator.cs (2)
57? DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From(diagnostic) 58: DiagnosticOr<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)>.From((data.Syntax, data.Symbol));
Microsoft.Interop.SourceGeneration (15)
DiagnosticOr.cs (15)
65/// Adds a diagnostic to the <see cref="DiagnosticOr{T}.Diagnostics"/> property 67public DiagnosticOr<T> AddDiagnostic(DiagnosticInfo diagnostic) => this switch 76/// Creates a new <see cref="DiagnosticOr{T}"/> with the <see cref="DiagnosticOr{T}.Value"/> set to <paramref name="value"/> 78public DiagnosticOr<T> WithValue(T value) => this switch 89public static DiagnosticOr<T> From(DiagnosticInfo diagnostic) 97public static DiagnosticOr<T> From(T value) 106public static DiagnosticOr<T> From(T value, params DiagnosticInfo[] diagnostics) 119public static (IncrementalValuesProvider<T>, IncrementalValuesProvider<DiagnosticInfo>) Split<T>(this IncrementalValuesProvider<DiagnosticOr<T>> provider) 129public static (IncrementalValuesProvider<SequenceEqualImmutableArray<T>>, IncrementalValuesProvider<DiagnosticInfo>) SplitArrays<T>(this IncrementalValuesProvider<SequenceEqualImmutableArray<DiagnosticOr<T>>> provider) 139public static (IncrementalValuesProvider<(T, T2)>, IncrementalValuesProvider<DiagnosticInfo>) Split<T, T2>(this IncrementalValuesProvider<(DiagnosticOr<T>, T2)> provider) 149public static IncrementalValuesProvider<T> FilterAndReportDiagnostics<T>(this IncrementalGeneratorInitializationContext ctx, IncrementalValuesProvider<DiagnosticOr<T>> diagnosticOrValues) 161IncrementalValuesProvider<DiagnosticOr<T>> diagnosticOrValues, 170/// Filters each inner <see cref="IEnumerable{T}"/> of <see cref="DiagnosticOr{T}"/> by whether the elements are <see cref="Diagnostic"/>s, reports the diagnostics, and returns the values. 174IncrementalValuesProvider<SequenceEqualImmutableArray<DiagnosticOr<T>>> diagnosticOrValues)