src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (73)
20public static IEnumerable<INamedTypeSymbol> GetBaseTypesAndThis(this INamedTypeSymbol? namedType)
22var current = namedType;
30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol)
36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol)
42private static Stack<INamedTypeSymbol> GetContainmentStack(INamedTypeSymbol? symbol)
44var stack = new Stack<INamedTypeSymbol>();
45for (var current = symbol; current != null; current = current.ContainingType)
53public static bool IsContainedWithin([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol, INamedTypeSymbol outer)
56for (var current = symbol; current != null; current = current.ContainingType)
67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol)
78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member)
82this INamedTypeSymbol classOrStructType,
84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol)
122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType)
128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol)
151this INamedTypeSymbol classOrStructType,
153Func<INamedTypeSymbol, ISymbol, bool> isValid,
176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
177this INamedTypeSymbol classOrStructType,
178IEnumerable<INamedTypeSymbol> interfaces,
194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
247this INamedTypeSymbol classOrStructType,
248IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
265this INamedTypeSymbol classOrStructType,
266IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers(
284this INamedTypeSymbol classOrStructType,
285IEnumerable<INamedTypeSymbol> interfaces,
297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
325this INamedTypeSymbol classOrStructType,
326IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
358private static ImmutableArray<INamedTypeSymbol> GetTypesToImplement(
359INamedTypeSymbol classOrStructType,
360IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
369private static ImmutableArray<INamedTypeSymbol> GetAbstractClassesToImplement(
370IEnumerable<INamedTypeSymbol> abstractClasses)
377private static ImmutableArray<INamedTypeSymbol> GetInterfacesToImplement(
378INamedTypeSymbol classOrStructType,
379IEnumerable<INamedTypeSymbol> interfaces,
386var interfacesToImplement = new List<INamedTypeSymbol>(
391var baseType = classOrStructType.BaseType;
402this INamedTypeSymbol classOrStructType,
403INamedTypeSymbol interfaceType,
404Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
405Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
406Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
448this INamedTypeSymbol attributeSymbol,
454var systemAttributeType = compilation.AttributeType();
456foreach (var type in attributeSymbol.GetBaseTypesAndThis())
516private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within)
530this INamedTypeSymbol containingType, CancellationToken cancellationToken)
547foreach (var type in baseTypes)
568Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
589Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
611Dictionary<ISymbol, int> result, INamedTypeSymbol containingType,
612INamedTypeSymbol type, ref int index, CancellationToken cancellationToken)
625private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
667public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments)
670public static bool IsCollectionBuilderAttribute([NotNullWhen(true)] this INamedTypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (65)
21public bool AreEquivalent(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
50return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies);
54return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)y, (INamedTypeSymbol)x, equivalentTypesWithDifferingAssemblies);
64private bool AreArrayAndReadOnlySpanEquivalent(IArrayTypeSymbol array, INamedTypeSymbol readOnlySpanType, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
72internal bool AreEquivalent(CustomModifier x, CustomModifier y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
75internal bool AreEquivalent(ImmutableArray<CustomModifier> x, ImmutableArray<CustomModifier> y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
111private bool AreEquivalentWorker(ISymbol x, ISymbol y, SymbolKind k, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
125SymbolKind.NamedType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies),
126SymbolKind.ErrorType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies),
139private bool ArrayTypesAreEquivalent(IArrayTypeSymbol x, IArrayTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
151private bool FieldsAreEquivalent(IFieldSymbol x, IFieldSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false)
280private bool NamedTypesAreEquivalent(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
300private bool NamedTypesAreEquivalentError(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
302foreach (var type1 in Unwrap(x))
305foreach (var type2 in Unwrap(y))
329private bool HandleNamedTypesWorker(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
418private bool HandleTupleTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
463Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies,
486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null)
492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
511private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
564private bool ParametersAreEquivalent(IParameterSymbol x, IParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
574private bool PointerTypesAreEquivalent(IPointerTypeSymbol x, IPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
581private bool FunctionPointerTypesAreEquivalent(IFunctionPointerTypeSymbol x, IFunctionPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
608private bool EventsAreEquivalent(IEventSymbol x, IEventSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
615private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
28protected abstract bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType);
33protected abstract bool TryInitializeImplicitObjectCreation(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
34protected abstract bool TryInitializeSimpleNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
35protected abstract bool TryInitializeConstructorInitializerGeneration(SemanticDocument document, SyntaxNode constructorInitializer, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
36protected abstract bool TryInitializeSimpleAttributeNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (13)
33[NotNullWhen(true)] INamedTypeSymbol? typeToGenerateIn,
57INamedTypeSymbol containingType,
60[NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn,
74INamedTypeSymbol containingType,
77out INamedTypeSymbol? typeToGenerateIn,
112underlyingType is INamedTypeSymbol underlyingNamedType)
130typeToGenerateIn = pointerType.PointedAtType as INamedTypeSymbol;
146typeToGenerateIn = attributeType.Type as INamedTypeSymbol;
154typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol;
166typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol;
181out INamedTypeSymbol? typeToGenerateIn,
191: typeInfo.Type as INamedTypeSymbol;
193isStatic = semanticInfo.Symbol is INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (15)
60public TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
89public SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
128protected abstract TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
151public abstract SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
350INamedTypeSymbol namedType => CreateNamedTypeDeclaration(namedType, codeGenerationDestination, info, cancellationToken),
368INamedTypeSymbol namedType => AddNamedType(currentDestination, namedType, info, availableIndices, cancellationToken),
393CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
420public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
478return AddNamedTypeAsync(context, destination, (INamedTypeSymbol)namespaceOrType, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (10)
15protected abstract SyntaxNode CreateExplicitlyCastedLiteralValue(SyntaxGenerator generator, INamedTypeSymbol enumType, SpecialType underlyingSpecialType, object constantValue);
16protected abstract bool IsValidName(INamedTypeSymbol enumType, string name);
18public SyntaxNode CreateEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
34private static bool IsFlagsEnum(INamedTypeSymbol typeSymbol)
46var type = ctor.ContainingType;
63private SyntaxNode CreateFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
75INamedTypeSymbol enumType,
141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType)
171INamedTypeSymbol enumType,
188private SyntaxNode CreateNonFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (14)
48INamedTypeSymbol? containingType,
153INamedTypeSymbol? containingType,
227INamedTypeSymbol? containingType = null,
255INamedTypeSymbol? containingType = null,
409INamedTypeSymbol attributeClass,
419public static INamedTypeSymbol CreateNamedTypeSymbol(
425INamedTypeSymbol? baseType = null,
426ImmutableArray<INamedTypeSymbol> interfaces = default,
438public static INamedTypeSymbol CreateNamedTypeSymbol(
444INamedTypeSymbol? baseType = null,
445ImmutableArray<INamedTypeSymbol> interfaces = default,
456members.WhereAsArray(m => m is not INamedTypeSymbol),
457members.OfType<INamedTypeSymbol>().Select(n => n.ToCodeGenerationSymbol()).ToImmutableArray(),
524INamedTypeSymbol? containingType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (8)
30public static Task<Document> AddEventDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
37public static Task<Document> AddFieldDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
58public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
86public static Task<Document> AddMemberDeclarationsAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (10)
44SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken);
74TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
134Task<Document> AddEventAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken);
139Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken);
144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken);
149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken);
154Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken);
159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken);
174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (16)
79var namedTypeToAnalyzer = new ConcurrentDictionary<INamedTypeSymbol, Analyzer>();
85INamedTypeSymbol namedType,
142INamedTypeSymbol namedType,
145ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer)
150private readonly INamedTypeSymbol _namedType = namedType;
154private readonly ConcurrentDictionary<INamedTypeSymbol, Analyzer> _namedTypeToAnalyzer = namedTypeToAnalyzer;
204ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer)
209var startSymbol = (INamedTypeSymbol)context.Symbol;
215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType)
245INamedTypeSymbol namedType)
260Analyzer? TryCreateAnalyzer(INamedTypeSymbol namedType)
340INamedTypeSymbol namedType,
385INamedTypeSymbol namedType,
406INamedTypeSymbol namedType,
463INamedTypeSymbol namedType,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
63CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
68var namedType = @event.Type as INamedTypeSymbol;
247protected override TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken)
729INamedTypeSymbol namedType, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
28INamedTypeSymbol namedType,
42INamedTypeSymbol namedType,
57INamedTypeSymbol namedType,
69INamedTypeSymbol namedType,
152INamedTypeSymbol namedType,
182INamedTypeSymbol namedType,
226INamedTypeSymbol namedType,
244INamedTypeSymbol namedType,
261INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info)
267INamedTypeSymbol namedType,
311INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info)
316private static BaseListSyntax? GenerateBaseList(INamedTypeSymbol namedType)
322foreach (var type in namedType.Interfaces)
331private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateConstraintClauses(INamedTypeSymbol namedType)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (5)
125private IEnumerable<INamedTypeSymbol>? FindNearestTupleConstructionWithInferrableType(SyntaxNode root, SemanticModel semanticModel, int position, SignatureHelpTriggerInfo triggerInfo,
137var tupleTypes = inferredTypes.Where(t => t.IsTupleType).OfType<INamedTypeSymbol>().ToList();
151SyntaxNode targetExpression, SemanticModel semanticModel, IEnumerable<INamedTypeSymbol> tupleTypes, CancellationToken cancellationToken)
165private static SignatureHelpItem Convert(INamedTypeSymbol tupleType, ImmutableArray<TaggedText> prefixParts, ImmutableArray<TaggedText> suffixParts,
179private static IEnumerable<SignatureHelpParameter> ConvertTupleMembers(INamedTypeSymbol tupleType, SemanticModel semanticModel, int position)
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (16)
79var namedTypeToAnalyzer = new ConcurrentDictionary<INamedTypeSymbol, Analyzer>();
85INamedTypeSymbol namedType,
142INamedTypeSymbol namedType,
145ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer)
150private readonly INamedTypeSymbol _namedType = namedType;
154private readonly ConcurrentDictionary<INamedTypeSymbol, Analyzer> _namedTypeToAnalyzer = namedTypeToAnalyzer;
204ConcurrentDictionary<INamedTypeSymbol, Analyzer> namedTypeToAnalyzer)
209var startSymbol = (INamedTypeSymbol)context.Symbol;
215for (var containingType = startSymbol.ContainingType; containingType != null; containingType = containingType.ContainingType)
245INamedTypeSymbol namedType)
260Analyzer? TryCreateAnalyzer(INamedTypeSymbol namedType)
340INamedTypeSymbol namedType,
385INamedTypeSymbol namedType,
406INamedTypeSymbol namedType,
463INamedTypeSymbol namedType,
Recommendations\CSharpRecommendationServiceRunner_Conversions.cs (6)
137if (container.RemoveNullableIfPresent() is INamedTypeSymbol namedType)
153ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols)
201ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols)
229ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols, ImmutableArray<SpecialType> specialTypes)
258private static IMethodSymbol CreateConversion(INamedTypeSymbol containingType, ITypeSymbol fromType, ITypeSymbol toType, string? documentationCommentXml)
266ITypeSymbol container, INamedTypeSymbol containerWithoutNullable, ArrayBuilder<ISymbol> symbols)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (5)
63CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
68var namedType = @event.Type as INamedTypeSymbol;
247protected override TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken)
729INamedTypeSymbol namedType, CodeGenerationDestination destination, CSharpCodeGenerationContextInfo info, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
28INamedTypeSymbol namedType,
42INamedTypeSymbol namedType,
57INamedTypeSymbol namedType,
69INamedTypeSymbol namedType,
152INamedTypeSymbol namedType,
182INamedTypeSymbol namedType,
226INamedTypeSymbol namedType,
244INamedTypeSymbol namedType,
261INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info)
267INamedTypeSymbol namedType,
311INamedTypeSymbol namedType, CSharpCodeGenerationContextInfo info)
316private static BaseListSyntax? GenerateBaseList(INamedTypeSymbol namedType)
322foreach (var type in namedType.Interfaces)
331private static SyntaxList<TypeParameterConstraintClauseSyntax> GenerateConstraintClauses(INamedTypeSymbol namedType)
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (9)
41if (semanticModel.GetDeclaredSymbol(node, cancellationToken) is INamedTypeSymbol declaredSymbol)
61private CompletionItem CreateCompletionItem(INamedTypeSymbol symbol, TSyntaxContext context)
75protected abstract ImmutableArray<KeyValuePair<string, string>> GetProperties(INamedTypeSymbol symbol, TSyntaxContext context);
79protected abstract (string displayText, string suffix, string insertionText) GetDisplayAndSuffixAndInsertionText(INamedTypeSymbol symbol, TSyntaxContext context);
81protected virtual IEnumerable<INamedTypeSymbol>? LookupCandidateSymbols(TSyntaxContext context, INamedTypeSymbol declaredSymbol, CancellationToken cancellationToken)
94.OfType<INamedTypeSymbol>()
100private static bool InSameProject(INamedTypeSymbol symbol, Compilation compilation)
103private static bool NotNewDeclaredMember(INamedTypeSymbol symbol, TSyntaxContext context)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (8)
104var namedTypeSymbol = await GenerateFinalNamedTypeAsync(
178Document document, SyntaxEditor editor, INamedTypeSymbol classSymbol,
180INamedTypeSymbol anonymousType, CancellationToken cancellationToken)
214SyntaxEditor editor, INamedTypeSymbol classSymbol,
242private static async Task<INamedTypeSymbol> GenerateFinalNamedTypeAsync(
283var namedTypeWithoutMembers = CreateNamedType(typeName, isRecord: false, capturedTypeParameters, members: default);
312private static INamedTypeSymbol CreateNamedType(
321Document document, INamedTypeSymbol anonymousType)
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (10)
232INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol
239INamedTypeSymbol containingType, ITypeSymbol type, string memberName) where TSymbol : class, ISymbol
245INamedTypeSymbol containingType, ITypeSymbol collectionType,
246INamedTypeSymbol ienumerableType, INamedTypeSymbol ienumeratorType,
281INamedTypeSymbol containingType, IMethodSymbol getEnumeratorMethod,
282INamedTypeSymbol ienumeratorType, [NotNullWhen(true)] out ITypeSymbol? iterationType)
314INamedTypeSymbol containingType,
500INamedTypeSymbol containingType,
502INamedTypeSymbol ienumerableType)
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (25)
183private static async Task<(SyntaxNode, INamedTypeSymbol)> TryGetTupleInfoAsync(
207var tupleType = semanticModel.GetTypeInfo(expressionOrType, cancellationToken).Type as INamedTypeSymbol;
327SyntaxNode tupleExprOrTypeNode, INamedTypeSymbol tupleType,
420INamedTypeSymbol tupleType, Scope scope, CancellationToken cancellationToken)
436Project startingProject, INamedTypeSymbol tupleType, CancellationToken cancellationToken)
478Project project, INamedTypeSymbol tupleType, CancellationToken cancellationToken)
526var typeSymbol = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(containingType, cancellationToken);
553Document document, SyntaxNode tupleExprOrTypeNode, INamedTypeSymbol namedTypeSymbol,
615SyntaxNode startingNode, INamedTypeSymbol tupleType, TNameSyntax fullyQualifiedStructName,
635SyntaxNode startingNode, INamedTypeSymbol tupleType, TNameSyntax qualifiedTypeName,
649if (semanticModel.GetTypeInfo(childCreation, cancellationToken).Type is not INamedTypeSymbol childType)
666private static bool AreEquivalent(StringComparer comparer, INamedTypeSymbol tupleType, INamedTypeSymbol childType)
749INamedTypeSymbol tupleType, TNameSyntax qualifiedTypeName,
762if (semanticModel.GetTypeInfo(childTupleType, cancellationToken).Type is not INamedTypeSymbol childType)
798private static async Task<INamedTypeSymbol> GenerateFinalNamedTypeAsync(
800INamedTypeSymbol tupleType, NamingRule parameterNamingRule, CancellationToken cancellationToken)
812var namedTypeWithoutMembers = CreateNamedType(
848var namedTypeSymbol = CreateNamedType(
855INamedTypeSymbol tupleType, IMethodSymbol constructor)
881INamedTypeSymbol tupleType, INamedTypeSymbol structType)
908private static INamedTypeSymbol CreateNamedType(
ExtractInterface\AbstractExtractInterfaceService.cs (10)
40INamedTypeSymbol extractedInterfaceSymbol,
41INamedTypeSymbol typeToExtractFrom,
46internal abstract string GetContainingNamespaceDisplay(INamedTypeSymbol typeSymbol, CompilationOptions compilationOptions);
94if (semanticModel.GetDeclaredSymbol(typeNode, cancellationToken) is not INamedTypeSymbol typeToExtractFrom)
142var extractedInterfaceSymbol = CodeGenerationSymbolFactory.CreateNamedTypeSymbol(
176Solution solution, string containingNamespaceDisplay, INamedTypeSymbol extractedInterfaceSymbol,
218Solution solution, ExtractInterfaceTypeAnalysisResult refactoringResult, INamedTypeSymbol extractedInterfaceSymbol,
258INamedTypeSymbol type,
318INamedTypeSymbol typeToExtractFrom,
319INamedTypeSymbol extractedInterfaceSymbol,
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (14)
66var containingType = semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken) as INamedTypeSymbol;
70using var _1 = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var missingComparableTypes);
72foreach (var iface in containingType.Interfaces)
122private static IMethodSymbol? TryGetCompareMethodImpl(INamedTypeSymbol containingType, ITypeSymbol comparableType)
136INamedTypeSymbol comparableType,
141var containingType = (INamedTypeSymbol)semanticModel.GetRequiredDeclaredSymbol(typeDeclaration, cancellationToken);
160INamedTypeSymbol comparableType,
177INamedTypeSymbol containingType,
178INamedTypeSymbol comparableType,
183var boolType = compilation.GetSpecialType(SpecialType.System_Boolean);
229private static bool HasAllComparisonOperators(INamedTypeSymbol containingType, ITypeSymbol comparedType)
240private static bool HasComparisonOperator(INamedTypeSymbol containingType, ITypeSymbol comparedType, CodeGenerationOperatorKind kind)
GenerateEqualsAndGetHashCodeFromMembers\AbstractGenerateEqualsAndGetHashCodeService.cs (9)
39Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members,
51Document document, INamedTypeSymbol namedType,
52ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken)
62Document document, INamedTypeSymbol containingType, CancellationToken cancellationToken)
118Document document, INamedTypeSymbol namedType,
129INamedTypeSymbol namedType, ImmutableArray<ISymbol> members)
149INamedTypeSymbol namedType, ImmutableArray<ISymbol> members)
152var hashCodeType = compilation.GetTypeByMetadataName("System.HashCode");
183var valueTupleType = compilation.GetTypeByMetadataName(typeof(ValueTuple).FullName!);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (12)
89var containingType = semanticModel.GetDeclaredSymbol(typeDeclaration) as INamedTypeSymbol;
123private static bool HasOperators(INamedTypeSymbol containingType)
127private static bool HasOperator(INamedTypeSymbol containingType, string operatorName)
136SemanticModel semanticModel, INamedTypeSymbol containingType,
137[NotNullWhen(true)] out INamedTypeSymbol? constructedType)
143var equatableTypeOpt = semanticModel.Compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName!);
158private static void GetExistingMemberInfo(INamedTypeSymbol containingType, out bool hasEquals, out bool hasGetHashCode)
201Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> selectedMembers,
241Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
258Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
295Document document, SyntaxNode typeDeclaration, INamedTypeSymbol containingType, ImmutableArray<ISymbol> members,
GenerateEqualsAndGetHashCodeFromMembers\IGenerateEqualsAndGetHashCodeService.cs (5)
29Task<IMethodSymbol> GenerateEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, string? localNameOpt, CancellationToken cancellationToken);
35Task<IMethodSymbol> GenerateEqualsMethodThroughIEquatableEqualsAsync(Document document, INamedTypeSymbol namedType, CancellationToken cancellationToken);
41Task<IMethodSymbol> GenerateIEquatableEqualsMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, INamedTypeSymbol constructedEquatableType, CancellationToken cancellationToken);
50Task<IMethodSymbol> GenerateGetHashCodeMethodAsync(Document document, INamedTypeSymbol namedType, ImmutableArray<ISymbol> members, CancellationToken cancellationToken);
LanguageServices\AnonymousTypeDisplayService\AbstractStructuralTypeDisplayService.cs (17)
23protected abstract ImmutableArray<SymbolDisplayPart> GetNormalAnonymousTypeParts(INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position);
25public ImmutableArray<SymbolDisplayPart> GetAnonymousTypeParts(INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position)
31INamedTypeSymbol anonymousType,
63ImmutableArray<INamedTypeSymbol> directStructuralTypeReferences,
70SpecializedCollections.EmptyDictionary<INamedTypeSymbol, string>(),
92var structuralType = transitiveStructuralTypeReferences[i];
120private static Dictionary<INamedTypeSymbol, string> GenerateStructuralTypeNames(
121IList<INamedTypeSymbol> anonymousTypes)
124var anonymousTypeToName = new Dictionary<INamedTypeSymbol, string>();
125foreach (var type in anonymousTypes)
145private static ImmutableArray<INamedTypeSymbol> OrderStructuralTypes(
146ImmutableArray<INamedTypeSymbol> structuralTypes,
185private static ImmutableArray<INamedTypeSymbol> GetTransitiveStructuralTypeReferences(
186ImmutableArray<INamedTypeSymbol> structuralTypes)
188var transitiveReferences = new Dictionary<INamedTypeSymbol, (int order, int count)>();
191foreach (var type in structuralTypes)
198using var _ = ArrayBuilder<INamedTypeSymbol>.GetInstance(out var result);
Shared\Utilities\ExtractTypeHelpers.cs (7)
29public static async Task<(Document containingDocument, SyntaxAnnotation typeAnnotation)> AddTypeToExistingFileAsync(Document document, INamedTypeSymbol newType, AnnotatedSymbolMapping symbolMapping, CancellationToken cancellationToken)
56INamedTypeSymbol newSymbol,
115public static string GetTypeParameterSuffix(Document document, SyntaxFormattingOptions formattingOptions, INamedTypeSymbol type, IEnumerable<ISymbol> extractableMembers, CancellationToken cancellationToken)
130public static ImmutableArray<ITypeParameterSymbol> GetRequiredTypeParametersForMembers(INamedTypeSymbol type, IEnumerable<ISymbol> includedMembers)
163private static ImmutableArray<ITypeParameterSymbol> GetPotentialTypeParameters(INamedTypeSymbol type)
167var typesToVisit = new Stack<INamedTypeSymbol>();
169var currentType = type;
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (5)
28protected abstract bool ContainingTypesOrSelfHasUnsafeKeyword(INamedTypeSymbol containingType);
33protected abstract bool TryInitializeImplicitObjectCreation(SemanticDocument document, SyntaxNode node, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
34protected abstract bool TryInitializeSimpleNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
35protected abstract bool TryInitializeConstructorInitializerGeneration(SemanticDocument document, SyntaxNode constructorInitializer, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
36protected abstract bool TryInitializeSimpleAttributeNameGenerationState(SemanticDocument document, SyntaxNode simpleName, CancellationToken cancellationToken, out SyntaxToken token, out ImmutableArray<Argument<TExpressionSyntax>> arguments, out INamedTypeSymbol typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (13)
33[NotNullWhen(true)] INamedTypeSymbol? typeToGenerateIn,
57INamedTypeSymbol containingType,
60[NotNullWhen(true)] out INamedTypeSymbol? typeToGenerateIn,
74INamedTypeSymbol containingType,
77out INamedTypeSymbol? typeToGenerateIn,
112underlyingType is INamedTypeSymbol underlyingNamedType)
130typeToGenerateIn = pointerType.PointedAtType as INamedTypeSymbol;
146typeToGenerateIn = attributeType.Type as INamedTypeSymbol;
154typeToGenerateIn = semanticModel.GetTypeInfo(initializedObject, cancellationToken).Type as INamedTypeSymbol;
166typeToGenerateIn = inferenceService.InferType(semanticModel, propertyPatternClause, objectAsDefault: true, cancellationToken) as INamedTypeSymbol;
181out INamedTypeSymbol? typeToGenerateIn,
191: typeInfo.Type as INamedTypeSymbol;
193isStatic = semanticInfo.Symbol is INamedTypeSymbol;
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\AbstractGenerateConversionService.cs (2)
26protected abstract bool TryInitializeImplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
27protected abstract bool TryInitializeExplicitConversionState(SemanticDocument document, SyntaxNode expression, ISet<TypeKind> classInterfaceModuleStructTypes, CancellationToken cancellationToken, out SyntaxToken identifierToken, out IMethodSymbol methodSymbol, out INamedTypeSymbol typeToGenerateIn);
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (16)
97Dim targetType As INamedTypeSymbol = Nothing
110targetType = TryCast(sourceDefinition, INamedTypeSymbol)
124targetType As INamedTypeSymbol,
172Dim typeSymbol = TryCast(semanticModel.GetTypeInfo(handlerExpression, cancellationToken).Type, INamedTypeSymbol)
187Private Shared Function ResolveTargetType(ByRef targetType As INamedTypeSymbol, semanticModel As SemanticModel) As Boolean
194targetType = DirectCast(targetType.GetSymbolKey().Resolve(semanticModel.Compilation).Symbol, INamedTypeSymbol)
203Private Shared Function TryGetNameAndTargetType(eventExpression As ExpressionSyntax, containingSymbol As INamedTypeSymbol, semanticModel As SemanticModel, ByRef targetType As INamedTypeSymbol, ByRef actualEventName As String, cancellationToken As CancellationToken) As Boolean
205Dim eventType As INamedTypeSymbol = Nothing
213eventType = TryCast(semanticModel.GetTypeInfo(qualifier, cancellationToken).Type, INamedTypeSymbol)
259Dim targetType = TryCast(SymbolFinder.FindSourceDefinition(semanticModel.GetSymbolInfo(node.Left, cancellationToken).Symbol, document.Project.Solution, cancellationToken), INamedTypeSymbol)
278Dim eventType = TryCast(boundEvent.Type, INamedTypeSymbol)
327Dim targetType As INamedTypeSymbol = Nothing
350targetType = TryCast(SymbolFinder.FindSourceDefinition(withEventsProperty.Type, document.Project.Solution, cancellationToken), INamedTypeSymbol)
354targetType = TryCast(SymbolFinder.FindSourceDefinition(targetType, document.Project.Solution, cancellationToken), INamedTypeSymbol)
363targetType = DirectCast(targetType.GetSymbolKey(cancellationToken).Resolve(semanticModel.Compilation, cancellationToken:=cancellationToken).Symbol, INamedTypeSymbol)
GenerateType\VisualBasicGenerateTypeService.vb (4)
327generateTypeServiceStateOptions.DelegateCreationMethodSymbol = DirectCast(type, INamedTypeSymbol).DelegateInvokeMethod
389cancellationToken As CancellationToken) As INamedTypeSymbol
394Return If(typeBlock Is Nothing, Nothing, TryCast(semanticModel.GetDeclaredSymbol(typeBlock.BlockStatement, cancellationToken), INamedTypeSymbol))
420Public Overrides Async Function GetOrGenerateEnclosingNamespaceSymbolAsync(namedTypeSymbol As INamedTypeSymbol, containers() As String, selectedDocument As Document, selectedDocumentRoot As SyntaxNode, cancellationToken As CancellationToken) As Task(Of (INamespaceSymbol, INamespaceOrTypeSymbol, Location))
NavigationBar\VisualBasicNavigationBarItemService.vb (9)
61Private Shared Function GetTypesAndDeclarationsInFile(semanticModel As SemanticModel, cancellationToken As CancellationToken) As IEnumerable(Of Tuple(Of INamedTypeSymbol, SyntaxNode))
63Dim typesAndDeclarations As New Dictionary(Of INamedTypeSymbol, SyntaxNode)
70Return SpecializedCollections.EmptyEnumerable(Of Tuple(Of INamedTypeSymbol, SyntaxNode))()
74Dim type = TryCast(semanticModel.GetDeclaredSymbol(node, cancellationToken), INamedTypeSymbol)
103type As INamedTypeSymbol,
157type As INamedTypeSymbol,
202type As INamedTypeSymbol,
311containingType As INamedTypeSymbol,
360DirectCast(e.Type, INamedTypeSymbol).DelegateInvokeMethod IsNot Nothing Then
src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\VisualBasicGenerateConversionService.vb (11)
55Protected Overrides Function TryInitializeExplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean
69Protected Overrides Function TryInitializeImplicitConversionState(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef identifierToken As SyntaxToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean
83Private Shared Function TryGetConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean
113Private Shared Function TryGetExplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, castExpression As CastExpressionSyntax, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean
115typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Type, cancellationToken).Type, INamedTypeSymbol)
116Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(castExpression.Expression, cancellationToken).Type, INamedTypeSymbol)
129Private Shared Function TryGetImplicitConversionMethodAndTypeToGenerateIn(document As SemanticDocument, expression As SyntaxNode, classInterfaceModuleStructTypes As ISet(Of TypeKind), cancellationToken As CancellationToken, ByRef methodSymbol As IMethodSymbol, ByRef typeToGenerateIn As INamedTypeSymbol) As Boolean
131typeToGenerateIn = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).ConvertedType, INamedTypeSymbol)
132Dim parameterSymbol = TryCast(document.SemanticModel.GetTypeInfo(expression, cancellationToken).Type, INamedTypeSymbol)
145Private Shared Function GenerateMethodSymbol(typeToGenerateIn As INamedTypeSymbol, parameterSymbol As INamedTypeSymbol) As IMethodSymbol
FindSymbols\FindReferences\DependentTypeFinder.cs (30)
20using SymbolSet = HashSet<INamedTypeSymbol>;
45private static readonly Func<INamedTypeSymbol, bool> s_isInterface = static t => t is { TypeKind: TypeKind.Interface };
46private static readonly Func<INamedTypeSymbol, bool> s_isNonSealedClass = static t => t is { TypeKind: TypeKind.Class, IsSealed: false };
47private static readonly Func<INamedTypeSymbol, bool> s_isInterfaceOrNonSealedClass = static t => s_isInterface(t) || s_isNonSealedClass(t);
49private static readonly ObjectPool<PooledHashSet<INamedTypeSymbol>> s_symbolSetPool = PooledHashSet<INamedTypeSymbol>.CreatePool(SymbolEquivalenceComparer.Instance);
52/// Walks down a <paramref name="type"/>'s inheritance tree looking for more <see cref="INamedTypeSymbol"/>'s
60private static async Task<ImmutableArray<INamedTypeSymbol>> DescendInheritanceTreeAsync(
61INamedTypeSymbol type,
64Func<INamedTypeSymbol, SymbolSet, bool> typeMatches,
65Func<INamedTypeSymbol, bool> shouldContinueSearching,
209foreach (var type in typesToSearchFor)
254Func<INamedTypeSymbol, bool>? predicate)
266if (info.TryResolve(semanticModel, cancellationToken) is INamedTypeSymbol namedType &&
282if (info.TryResolve(semanticModel, cancellationToken) is INamedTypeSymbol namedType &&
351foreach (var metadataType in metadataTypes)
360foreach (var derivedType in symbolTreeInfo.GetDerivedMetadataTypes(baseTypeName, compilation, cancellationToken))
377foreach (var type in foundTypes)
384foreach (var type in foundTypes)
388private static void AddRange(SymbolSet foundTypes, SymbolSet currentTypes, Func<INamedTypeSymbol, bool> shouldContinueSearching)
391foreach (var type in foundTypes)
399INamedTypeSymbol type,
514private static bool TypeHasBaseTypeInSet(INamedTypeSymbol type, SymbolSet set)
516var baseType = type.BaseType?.OriginalDefinition;
520private static bool TypeHasInterfaceInSet(INamedTypeSymbol type, SymbolSet set)
522foreach (var interfaceType in type.Interfaces)
541Func<INamedTypeSymbol, bool> shouldContinueSearching)
548foreach (var derivedType in tempBuffer)
562public static PooledDisposer<PooledHashSet<INamedTypeSymbol>> GetSymbolSet(out SymbolSet instance)
567return new PooledDisposer<PooledHashSet<INamedTypeSymbol>>(pooledInstance);
FindSymbols\FindReferences\Finders\NamedTypeSymbolReferenceFinder.cs (12)
17internal sealed class NamedTypeSymbolReferenceFinder : AbstractReferenceFinder<INamedTypeSymbol>
19protected override bool CanFind(INamedTypeSymbol symbol)
22protected override Task<ImmutableArray<string>> DetermineGlobalAliasesAsync(INamedTypeSymbol symbol, Project project, CancellationToken cancellationToken)
28INamedTypeSymbol symbol,
53INamedTypeSymbol symbol,
108INamedTypeSymbol namedType,
141INamedTypeSymbol namedType,
158INamedTypeSymbol namedType, FindReferencesDocumentState state, Action<FinderLocation, TData> processResult, TData processResultData, string alias, CancellationToken cancellationToken)
176INamedTypeSymbol symbol,
191INamedTypeSymbol namedType,
208INamedTypeSymbol symbol,
228INamedTypeSymbol namedType,
FindSymbols\SymbolFinder_Hierarchy.cs (24)
48var containingType = symbol.ContainingType;
62foreach (var type in derivedTypes)
143var containingType = symbol.ContainingType.OriginalDefinition;
212public static Task<IEnumerable<INamedTypeSymbol>> FindDerivedClassesAsync(
213INamedTypeSymbol type, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken)
230public static async Task<IEnumerable<INamedTypeSymbol>> FindDerivedClassesAsync(
231INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
243/// <inheritdoc cref="FindDerivedClassesArrayAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
245internal static async Task<ImmutableArray<INamedTypeSymbol>> FindDerivedClassesArrayAsync(
246INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
266public static async Task<IEnumerable<INamedTypeSymbol>> FindDerivedInterfacesAsync(
267INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
279/// <inheritdoc cref="FindDerivedInterfacesAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
281internal static async Task<ImmutableArray<INamedTypeSymbol>> FindDerivedInterfacesArrayAsync(
282INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
302public static async Task<IEnumerable<INamedTypeSymbol>> FindImplementationsAsync(
303INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
315/// <inheritdoc cref="FindImplementationsAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
317internal static async Task<ImmutableArray<INamedTypeSymbol>> FindImplementationsArrayAsync(
318INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
329/// cref="INamedTypeSymbol"/> this will be both immediate and transitive implementations.
342if (symbol is INamedTypeSymbol namedTypeSymbol)
361var containingType = symbol.ContainingType.OriginalDefinition;
371foreach (var t in allTypes)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (73)
20public static IEnumerable<INamedTypeSymbol> GetBaseTypesAndThis(this INamedTypeSymbol? namedType)
22var current = namedType;
30public static ImmutableArray<ITypeParameterSymbol> GetAllTypeParameters(this INamedTypeSymbol? symbol)
36public static IEnumerable<ITypeSymbol> GetAllTypeArguments(this INamedTypeSymbol? symbol)
42private static Stack<INamedTypeSymbol> GetContainmentStack(INamedTypeSymbol? symbol)
44var stack = new Stack<INamedTypeSymbol>();
45for (var current = symbol; current != null; current = current.ContainingType)
53public static bool IsContainedWithin([NotNullWhen(returnValue: true)] this INamedTypeSymbol? symbol, INamedTypeSymbol outer)
56for (var current = symbol; current != null; current = current.ContainingType)
67public static ISymbol? FindImplementationForAbstractMember(this INamedTypeSymbol? type, ISymbol symbol)
78private static bool ImplementationExists(INamedTypeSymbol classOrStructType, ISymbol member)
82this INamedTypeSymbol classOrStructType,
84Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
114private static bool IsInterfacePropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol)
122static bool IsAccessorImplemented(IMethodSymbol? accessor, INamedTypeSymbol classOrStructType)
128private static bool IsAbstractPropertyImplemented(INamedTypeSymbol classOrStructType, IPropertySymbol propertySymbol)
151this INamedTypeSymbol classOrStructType,
153Func<INamedTypeSymbol, ISymbol, bool> isValid,
176public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
177this INamedTypeSymbol classOrStructType,
178IEnumerable<INamedTypeSymbol> interfaces,
194static ImmutableArray<ISymbol> GetImplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
246public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
247this INamedTypeSymbol classOrStructType,
248IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
264public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembersInThis(
265this INamedTypeSymbol classOrStructType,
266IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
267Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
283public static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedExplicitMembers(
284this INamedTypeSymbol classOrStructType,
285IEnumerable<INamedTypeSymbol> interfaces,
297private static ImmutableArray<ISymbol> GetExplicitlyImplementableMembers(INamedTypeSymbol type, ISymbol within)
324private static ImmutableArray<(INamedTypeSymbol type, ImmutableArray<ISymbol> members)> GetAllUnimplementedMembers(
325this INamedTypeSymbol classOrStructType,
326IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
327Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
328Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
329Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
358private static ImmutableArray<INamedTypeSymbol> GetTypesToImplement(
359INamedTypeSymbol classOrStructType,
360IEnumerable<INamedTypeSymbol> interfacesOrAbstractClasses,
369private static ImmutableArray<INamedTypeSymbol> GetAbstractClassesToImplement(
370IEnumerable<INamedTypeSymbol> abstractClasses)
377private static ImmutableArray<INamedTypeSymbol> GetInterfacesToImplement(
378INamedTypeSymbol classOrStructType,
379IEnumerable<INamedTypeSymbol> interfaces,
386var interfacesToImplement = new List<INamedTypeSymbol>(
391var baseType = classOrStructType.BaseType;
402this INamedTypeSymbol classOrStructType,
403INamedTypeSymbol interfaceType,
404Func<INamedTypeSymbol, ISymbol, Func<INamedTypeSymbol, ISymbol, bool>, CancellationToken, bool> isImplemented,
405Func<INamedTypeSymbol, ISymbol, bool> isValidImplementation,
406Func<INamedTypeSymbol, ISymbol, ImmutableArray<ISymbol>> interfaceMemberGetter,
448this INamedTypeSymbol attributeSymbol,
454var systemAttributeType = compilation.AttributeType();
456foreach (var type in attributeSymbol.GetBaseTypesAndThis())
516private static ImmutableArray<ISymbol> GetMembers(INamedTypeSymbol type, ISymbol within)
530this INamedTypeSymbol containingType, CancellationToken cancellationToken)
547foreach (var type in baseTypes)
568Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
589Dictionary<ISymbol, int> result, INamedTypeSymbol containingType, CancellationToken cancellationToken)
611Dictionary<ISymbol, int> result, INamedTypeSymbol containingType,
612INamedTypeSymbol type, ref int index, CancellationToken cancellationToken)
625private static bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
667public static INamedTypeSymbol TryConstruct(this INamedTypeSymbol type, ITypeSymbol[] typeArguments)
670public static bool IsCollectionBuilderAttribute([NotNullWhen(true)] this INamedTypeSymbol? type)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (65)
21public bool AreEquivalent(ISymbol? x, ISymbol? y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
50return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies);
54return AreArrayAndReadOnlySpanEquivalent((IArrayTypeSymbol)y, (INamedTypeSymbol)x, equivalentTypesWithDifferingAssemblies);
64private bool AreArrayAndReadOnlySpanEquivalent(IArrayTypeSymbol array, INamedTypeSymbol readOnlySpanType, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
72internal bool AreEquivalent(CustomModifier x, CustomModifier y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
75internal bool AreEquivalent(ImmutableArray<CustomModifier> x, ImmutableArray<CustomModifier> y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
111private bool AreEquivalentWorker(ISymbol x, ISymbol y, SymbolKind k, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
125SymbolKind.NamedType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies),
126SymbolKind.ErrorType => NamedTypesAreEquivalent((INamedTypeSymbol)x, (INamedTypeSymbol)y, equivalentTypesWithDifferingAssemblies),
139private bool ArrayTypesAreEquivalent(IArrayTypeSymbol x, IArrayTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
151private bool FieldsAreEquivalent(IFieldSymbol x, IFieldSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
169private bool MethodsAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies, bool considerReturnRefKinds = false)
280private bool NamedTypesAreEquivalent(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
300private bool NamedTypesAreEquivalentError(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
302foreach (var type1 in Unwrap(x))
305foreach (var type2 in Unwrap(y))
329private bool HandleNamedTypesWorker(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
418private bool HandleTupleTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
463Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies,
486internal bool ReturnTypesAreEquivalent(IMethodSymbol x, IMethodSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies = null)
492private bool TypeArgumentsAreEquivalent(ImmutableArray<ITypeSymbol> xTypeArguments, ImmutableArray<ITypeSymbol> yTypeArguments, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
511private bool HandleAnonymousTypes(INamedTypeSymbol x, INamedTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
547private bool NamespacesAreEquivalent(INamespaceSymbol x, INamespaceSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
564private bool ParametersAreEquivalent(IParameterSymbol x, IParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
574private bool PointerTypesAreEquivalent(IPointerTypeSymbol x, IPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
581private bool FunctionPointerTypesAreEquivalent(IFunctionPointerTypeSymbol x, IFunctionPointerTypeSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
584private bool PropertiesAreEquivalent(IPropertySymbol x, IPropertySymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
608private bool EventsAreEquivalent(IEventSymbol x, IEventSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
615private bool TypeParametersAreEquivalent(ITypeParameterSymbol x, ITypeParameterSymbol y, Dictionary<INamedTypeSymbol, INamedTypeSymbol>? equivalentTypesWithDifferingAssemblies)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (15)
60public TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode
89public SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken)
128protected abstract TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, TCodeGenerationContextInfo info, IList<bool>? availableIndices, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
151public abstract SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, TCodeGenerationContextInfo info, CancellationToken cancellationToken);
350INamedTypeSymbol namedType => CreateNamedTypeDeclaration(namedType, codeGenerationDestination, info, cancellationToken),
368INamedTypeSymbol namedType => AddNamedType(currentDestination, namedType, info, availableIndices, cancellationToken),
393CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
402public Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
411public Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
420public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
429public Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
447public Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
456public Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
478return AddNamedTypeAsync(context, destination, (INamedTypeSymbol)namespaceOrType, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (10)
15protected abstract SyntaxNode CreateExplicitlyCastedLiteralValue(SyntaxGenerator generator, INamedTypeSymbol enumType, SpecialType underlyingSpecialType, object constantValue);
16protected abstract bool IsValidName(INamedTypeSymbol enumType, string name);
18public SyntaxNode CreateEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
34private static bool IsFlagsEnum(INamedTypeSymbol typeSymbol)
46var type = ctor.ContainingType;
63private SyntaxNode CreateFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
75INamedTypeSymbol enumType,
141SyntaxGenerator generator, IFieldSymbol field, INamedTypeSymbol enumType, SpecialType underlyingSpecialType)
171INamedTypeSymbol enumType,
188private SyntaxNode CreateNonFlagsEnumConstantValue(SyntaxGenerator generator, INamedTypeSymbol enumType, object constantValue)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationSymbolFactory.cs (14)
48INamedTypeSymbol? containingType,
153INamedTypeSymbol? containingType,
227INamedTypeSymbol? containingType = null,
255INamedTypeSymbol? containingType = null,
409INamedTypeSymbol attributeClass,
419public static INamedTypeSymbol CreateNamedTypeSymbol(
425INamedTypeSymbol? baseType = null,
426ImmutableArray<INamedTypeSymbol> interfaces = default,
438public static INamedTypeSymbol CreateNamedTypeSymbol(
444INamedTypeSymbol? baseType = null,
445ImmutableArray<INamedTypeSymbol> interfaces = default,
456members.WhereAsArray(m => m is not INamedTypeSymbol),
457members.OfType<INamedTypeSymbol>().Select(n => n.ToCodeGenerationSymbol()).ToImmutableArray(),
524INamedTypeSymbol? containingType = null,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerator.cs (8)
30public static Task<Document> AddEventDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken)
37public static Task<Document> AddFieldDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken)
44public static Task<Document> AddMethodDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken)
51public static Task<Document> AddPropertyDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken)
58public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
65public static Task<Document> AddNamedTypeDeclarationAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken)
86public static Task<Document> AddMemberDeclarationsAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\ICodeGenerationService.cs (10)
44SyntaxNode CreateNamedTypeDeclaration(INamedTypeSymbol namedType, CodeGenerationDestination destination, CodeGenerationContextInfo info, CancellationToken cancellationToken);
74TDeclarationNode AddNamedType<TDeclarationNode>(TDeclarationNode destination, INamedTypeSymbol namedType, CodeGenerationContextInfo info, CancellationToken cancellationToken) where TDeclarationNode : SyntaxNode;
134Task<Document> AddEventAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEventSymbol @event, CancellationToken cancellationToken);
139Task<Document> AddFieldAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IFieldSymbol field, CancellationToken cancellationToken);
144Task<Document> AddMethodAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IMethodSymbol method, CancellationToken cancellationToken);
149Task<Document> AddPropertyAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IPropertySymbol property, CancellationToken cancellationToken);
154Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken);
159Task<Document> AddNamedTypeAsync(CodeGenerationSolutionContext context, INamespaceSymbol destination, INamedTypeSymbol namedType, CancellationToken cancellationToken);
174Task<Document> AddMembersAsync(CodeGenerationSolutionContext context, INamedTypeSymbol destination, IEnumerable<ISymbol> members, CancellationToken cancellationToken);