public UnionType(string name, IList <IType> types, UnionOptions options = null) : base(name)
        {
            _Types = types;

            _Dispatcher = options?.Dispatcher;

            _Eager = options?.Eager ?? true;

            Flags = types.Aggregate(TypeFlags.Union, (acc, type) => acc | type.Flags);

            ShouldAttachNode = types.Any(type => type.ShouldAttachNode);
        }
Exemplo n.º 2
0
        public static IType <S, T> Union <S, T>(UnionOptions options, params IType[] types)
        {
            var name = $"({string.Join(" | ", types.Select(type => type.Name))})";

            return(new UnionType <S, T>(name, types, options));
        }