Exemplo n.º 1
0
        public IEnumerable <Bits> SerializeTerm(IAnnotated <Bind, Id, ITerm <Bind, Id> > annotated)
        {
            var traversal = new Traversal <Bind, Id, IEnumerable <Bits> >(
                useDeclarationF: UseDeclarationF,
                stepF: SerializationStep);

            return(traversal.Traverse(annotated));
        }
Exemplo n.º 2
0
        public R Traverse(IAnnotated <Bind, Id, ITerm <Bind, Id> > annotated)
        {
            var mapping = new Mapping <Bind, Id, ITerm <Bind, Id>, R>(Traverse, UseDeclarationF);

            var unrolled = new ClosedTermF <Bind, Id, ITerm <Bind, Id> >(annotated.Environment, annotated.Expression.Fmap(term => term.Content));

            return(StepF(mapping.Fmap(unrolled)));
        }
Exemplo n.º 3
0
 public static IEnumerable <A> Annotations <A>(this IAnnotated annotated) => annotated.Annotations(typeof(A))?.Cast <A>() ?? Enumerable.Empty <A>();
Exemplo n.º 4
0
 public static A Annotation <A>(this IAnnotated annotated) => (A)annotated.Annotation(typeof(A));
Exemplo n.º 5
0
 public static object Annotation(this IAnnotated annotated, Type type) => annotated.Annotations(type)?.FirstOrDefault();
Exemplo n.º 6
0
        public void WriteInner(Utf8JsonWriter writer, IAnnotated value, JsonSerializerOptions options)
        {
            var reader = ReadAccessor.Create(typeof(T), AccessorMemberTypes.Properties, AccessorMemberScope.Public, out var members);

            JsonDeltaConverter <T> .WriteInner(members, reader, writer, (DeltaAnnotated <T>) value, options);
        }
Exemplo n.º 7
0
 public static bool TryGetAnnotation <A>(this IAnnotated annotated, out A annotation) where A : class
 {
     annotation = annotated.Annotations <A>()?.FirstOrDefault();
     return(annotation != null);
 }
Exemplo n.º 8
0
 public Constructor(IAnnotated <UntypedInitialization <Id, R> > initialization)
     : base(Productions.Constructor)
 {
     Initialization = initialization;
 }
Exemplo n.º 9
0
        internal static TAnnotation RequireAnnotation <T, TAnnotation>(this IAnnotated <T> annotated) where TAnnotation : T, new()
        {
            var result = annotated.GetAnnotation <TAnnotation>();

            return(result == null ? new TAnnotation() : result);
        }
Exemplo n.º 10
0
 public Type(IAnnotated <UntypedClass <Id, R> > @class)
     : base(Productions.Type)
 {
     Class = @class;
 }
Exemplo n.º 11
0
 public static bool ScanPredicate(IAnnotated provider)
 {
     return(provider.Annotations.OfType <InjectAttribute>().Any());
 }
Exemplo n.º 12
0
 public static ElementDefinitionSummary GetElementDefinitionSummary(this IAnnotated ann) =>
 ann.TryGetAnnotation <ElementDefinitionSummary>(out var rt) ? rt : null;
Exemplo n.º 13
0
 private static Func <Sequence <Tuple <Id, Guid> >, ITerm <Guid, Guid> > ConversionStep <Id>(IAnnotated <Id, Id, TermF <Id, Id, Func <Sequence <Tuple <Id, Guid> >, ITerm <Guid, Guid> > > > annotated)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 public static bool HasAnnotation(this IAnnotated annotated, Type type) => annotated.Annotations(type)?.Any() == true;
Exemplo n.º 15
0
 public Destructor(IAnnotated <R> focus, UntypedContinuation <Id, R> continuation)
     : base(Productions.Destructor)
 {
     Focus        = focus;
     Continuation = continuation;
 }
Exemplo n.º 16
0
 public static bool HasAnnotation <A>(this IAnnotated annotated) => annotated.HasAnnotation(typeof(A));
Exemplo n.º 17
0
 public static bool TryGetAnnotation(this IAnnotated annotated, Type type, out object annotation)
 {
     annotation = annotated.Annotations(type)?.FirstOrDefault();
     return(annotation != null);
 }
 public static XmlSerializationDetails GetXmlSerializationDetails(this IAnnotated ann) =>
 ann.TryGetAnnotation <XmlSerializationDetails>(out var rt) ? rt : null;
Exemplo n.º 19
0
 private static IEvaluator <R> EvaluationStep <R>(IAnnotated <Unit, uint, TermF <Unit, uint, IEvaluator <R> > > annotated)
 {
     return(EvaluationStep(annotated.Environment, annotated.Expression));
 }