Exemplo n.º 1
0
 /// <summary>
 /// Creates a decoder.
 /// </summary>
 /// <param name="log">A log to use for error and warning messages.</param>
 /// <param name="typeResolver">A read-only type resolver for resolving types.</param>
 /// <param name="codec">A Flame IR codec.</param>
 public DecoderState(
     ILog log,
     ReadOnlyTypeResolver typeResolver,
     IrCodec codec)
     : this(log, typeResolver, codec, TypeParent.Nothing)
 {
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a decoder.
 /// </summary>
 /// <param name="log">A log to use for error and warning messages.</param>
 /// <param name="typeResolver">A read-only type resolver for resolving types.</param>
 /// <param name="codec">A Flame IR codec.</param>
 /// <param name="scope">The decoder's scope.</param>
 private DecoderState(
     ILog log,
     ReadOnlyTypeResolver typeResolver,
     IrCodec codec,
     TypeParent scope)
 {
     this.Log             = log;
     this.TypeResolver    = typeResolver;
     this.Codec           = codec;
     this.Scope           = scope;
     this.typeCache       = new ConcurrentDictionary <LNode, IType>();
     this.TypeMemberIndex = new Index <IType, UnqualifiedName, ITypeMember>(
         type =>
         type.Fields
         .Concat <ITypeMember>(type.Properties)
         .Concat <ITypeMember>(type.Methods)
         .Select(member =>
                 new KeyValuePair <UnqualifiedName, ITypeMember>(
                     member.Name,
                     member)));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates an encoder state that uses a particular codec
 /// but retains all other fields.
 /// </summary>
 /// <param name="newCodec">The new codec to use.</param>
 /// <returns>An encoder state that uses <paramref name="newCodec"/>.</returns>
 public EncoderState WithCodec(IrCodec newCodec)
 {
     return(new EncoderState(newCodec, Factory));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Instantiates a Flame IR encoder.
 /// </summary>
 /// <param name="codec">The codec to use for encoding.</param>
 public EncoderState(IrCodec codec)
     : this(
         codec,
         new LNodeFactory(EmptySourceFile.Default))
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Instantiates a Flame IR encoder.
 /// </summary>
 /// <param name="codec">The codec to use for encoding.</param>
 /// <param name="factory">The node factory to use for creating nodes.</param>
 public EncoderState(IrCodec codec, LNodeFactory factory)
 {
     this.Codec   = codec;
     this.Factory = factory;
 }