Example #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));
        }
Example #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)));
        }
Example #3
0
 public static IEnumerable <A> Annotations <A>(this IAnnotated annotated) => annotated.Annotations(typeof(A))?.Cast <A>() ?? Enumerable.Empty <A>();
Example #4
0
 public static A Annotation <A>(this IAnnotated annotated) => (A)annotated.Annotation(typeof(A));
Example #5
0
 public static object Annotation(this IAnnotated annotated, Type type) => annotated.Annotations(type)?.FirstOrDefault();
Example #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);
        }
Example #7
0
 public static bool TryGetAnnotation <A>(this IAnnotated annotated, out A annotation) where A : class
 {
     annotation = annotated.Annotations <A>()?.FirstOrDefault();
     return(annotation != null);
 }
Example #8
0
 public Constructor(IAnnotated <UntypedInitialization <Id, R> > initialization)
     : base(Productions.Constructor)
 {
     Initialization = initialization;
 }
Example #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);
        }
Example #10
0
 public Type(IAnnotated <UntypedClass <Id, R> > @class)
     : base(Productions.Type)
 {
     Class = @class;
 }
Example #11
0
 public static bool ScanPredicate(IAnnotated provider)
 {
     return(provider.Annotations.OfType <InjectAttribute>().Any());
 }
Example #12
0
 public static ElementDefinitionSummary GetElementDefinitionSummary(this IAnnotated ann) =>
 ann.TryGetAnnotation <ElementDefinitionSummary>(out var rt) ? rt : null;
Example #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();
 }
Example #14
0
 public static bool HasAnnotation(this IAnnotated annotated, Type type) => annotated.Annotations(type)?.Any() == true;
Example #15
0
 public Destructor(IAnnotated <R> focus, UntypedContinuation <Id, R> continuation)
     : base(Productions.Destructor)
 {
     Focus        = focus;
     Continuation = continuation;
 }
Example #16
0
 public static bool HasAnnotation <A>(this IAnnotated annotated) => annotated.HasAnnotation(typeof(A));
Example #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;
Example #19
0
 private static IEvaluator <R> EvaluationStep <R>(IAnnotated <Unit, uint, TermF <Unit, uint, IEvaluator <R> > > annotated)
 {
     return(EvaluationStep(annotated.Environment, annotated.Expression));
 }