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