private static IImmutableList<Symbol> AddSymbols(Type type, IImmutableList<Symbol> derivedTypeSymbols)
 {
    if (type == null)
       return derivedTypeSymbols;
    var symbolFields = type.GetFields(BindingFlags.Public | BindingFlags.Static)
       .Where(field => SymbolType.IsAssignableFrom(field.FieldType));
    var symbols = symbolFields.Select(field => (Symbol)field.GetValue(null));
    return AddSymbols(type.BaseType, derivedTypeSymbols.AddRange(symbols));
 }
Beispiel #2
0
 public SorterStageImpl(int keyCount, IReadOnlyList <IKeyPair> keyPairs)
 {
     _keyCount = keyCount;
     _keyPairs = _keyPairs.AddRange(keyPairs.OrderBy(kp => kp.Index));
 }
Beispiel #3
0
 public INonemptyList <T> AddRange(IEnumerable <T> items)
 {
     return(_list.AddRange(items)
            .AsNonemptyList()
            .Extract(() => throw new InvalidOperationException()));
 }