Exemplo n.º 1
0
        public static ValueTask <ImmutableArray <ISymbol> > FindBasesAsync(
            ISymbol symbol,
            Solution solution,
            CancellationToken cancellationToken
            )
        {
            if (
                symbol is INamedTypeSymbol namedTypeSymbol &&
                (
                    namedTypeSymbol.TypeKind == TypeKind.Class ||
                    namedTypeSymbol.TypeKind == TypeKind.Interface ||
                    namedTypeSymbol.TypeKind == TypeKind.Struct
                )
                )
            {
                return(ValueTaskFactory.FromResult(
                           BaseTypeFinder.FindBaseTypesAndInterfaces(namedTypeSymbol)
                           ));
            }

            if (
                symbol.Kind == SymbolKind.Property ||
                symbol.Kind == SymbolKind.Method ||
                symbol.Kind == SymbolKind.Event
                )
            {
                return(BaseTypeFinder.FindOverriddenAndImplementedMembersAsync(
                           symbol,
                           solution,
                           cancellationToken
                           ));
            }

            return(ValueTaskFactory.FromResult(ImmutableArray <ISymbol> .Empty));
        }
Exemplo n.º 2
0
 public static ImmutableArray <ISymbol> FindBases(
     ISymbol symbol, Solution solution, CancellationToken cancellationToken)
 {
     if (symbol is INamedTypeSymbol namedTypeSymbol &&
         (namedTypeSymbol.TypeKind == TypeKind.Class ||
          namedTypeSymbol.TypeKind == TypeKind.Interface ||
          namedTypeSymbol.TypeKind == TypeKind.Struct))
     {
         return(BaseTypeFinder.FindBaseTypesAndInterfaces(namedTypeSymbol));
     }