3 types derived from DiagnosticOr
Microsoft.Interop.SourceGeneration (3)
DiagnosticOr.cs (3)
30private sealed record Diag : DiagnosticOr<T> 40private sealed record Val : DiagnosticOr<T> 50private sealed record ValueAndDiagnostic : DiagnosticOr<T>
63 references to DiagnosticOr
Microsoft.Interop.ComInterfaceGenerator (60)
Analyzers\ComInterfaceGeneratorDiagnosticsAnalyzer.cs (9)
85var interfaceInfoCache = new ConcurrentDictionary<INamedTypeSymbol, DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)>>(SymbolEqualityComparer.Default); 118ConcurrentDictionary<INamedTypeSymbol, DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)>> interfaceInfoCache) 123DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)> ciiResult = interfaceInfoCache.GetOrAdd( 144ImmutableArray<DiagnosticOr<ComInterfaceContext>> contextResults = ComInterfaceContext.GetContexts(contextChain, ct); 148DiagnosticOr<ComInterfaceContext> thisContextResult = contextResults[contextResults.Length - 1]; 157foreach (DiagnosticOr<(ComMethodInfo ComMethod, IMethodSymbol Symbol)> methodResult in 216ConcurrentDictionary<INamedTypeSymbol, DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)>> interfaceInfoCache, 248DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)> baseResult = interfaceInfoCache.GetOrAdd( 254return DiagnosticOr<(ComInterfaceInfo, INamedTypeSymbol)>.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 });
ComInterfaceGenerator.cs (3)
55var cii = ComInterfaceInfo.From(symbol, syntax, stubEnvironment, CancellationToken.None); 79foreach (var m in cmi) 93var cic = comInterfaceContexts[i];
ComInterfaceInfo.cs (13)
14using DiagnosticOrInterfaceInfo = Microsoft.Interop.DiagnosticOr<(Microsoft.Interop.ComInterfaceInfo InterfaceInfo, Microsoft.CodeAnalysis.INamedTypeSymbol Symbol)>; 56public static DiagnosticOrInterfaceInfo From(INamedTypeSymbol symbol, InterfaceDeclarationSyntax syntax, StubEnvironment env, CancellationToken _) 59return DiagnosticOrInterfaceInfo.From(DiagnosticInfo.Create(GeneratorDiagnostics.RequiresAllowUnsafeBlocks, syntax.Identifier.GetLocation())); 64return DiagnosticOrInterfaceInfo.From( 72return DiagnosticOrInterfaceInfo.From(partialContextDiagnostic); 76return DiagnosticOrInterfaceInfo.From(DiagnosticInfo.Create( 84return DiagnosticOrInterfaceInfo.From(guidDiagnostic); 87return DiagnosticOrInterfaceInfo.From(baseDiagnostic); 93return DiagnosticOrInterfaceInfo.From(stringMarshallingDiagnostic); 96return DiagnosticOrInterfaceInfo.From(optionsDiagnostic); 99return DiagnosticOrInterfaceInfo.From(exceptionToUnmanagedMarshallerDiagnostic); 138return DiagnosticOrInterfaceInfo.From(info, nonFatalDiagnostics.ToArray()); 142return DiagnosticOrInterfaceInfo.From(info);
ComMethodInfo.cs (21)
61public static SequenceEqualImmutableArray<DiagnosticOr<(ComMethodInfo ComMethod, IMethodSymbol Symbol)>> GetMethodsFromInterface((ComInterfaceInfo ifaceContext, INamedTypeSymbol ifaceSymbol) data, CancellationToken ct) 63var methods = ImmutableArray.CreateBuilder<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>(); 77methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(member.CreateDiagnosticInfo(GeneratorDiagnostics.InstanceEventDeclaredInInterface, member.Name, data.ifaceSymbol.ToDisplayString()))); 139ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 159methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(( 187methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.MethodNotDeclaredInAttributedInterface, method.Locations.FirstOrDefault(), method.ToDisplayString()))); 204methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(DiagnosticInfo.Create(GeneratorDiagnostics.CannotAnalyzeMethodPattern, method.Locations.FirstOrDefault(), method.ToDisplayString()))); 211methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(diag!)); 222methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From((comMethodInfo, method))); 244ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 275methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From( 295methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From( 303methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(shapeDiagnostic!)); 319ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 331methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(( 346ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 356methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(( 573ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 598ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 619ImmutableArray<DiagnosticOr<(ComMethodInfo, IMethodSymbol)>>.Builder methods, 631methods.Add(DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(
Microsoft.Interop.SourceGeneration (3)
DiagnosticOr.cs (3)
64public static DiagnosticOr<T> From(DiagnosticInfo diagnostic) 72public static DiagnosticOr<T> From(T value) 81public static DiagnosticOr<T> From(T value, params DiagnosticInfo[] diagnostics)