Ejemplo n.º 1
0
            public void Add(TypeCompilationContext type, StrengthKind strength)
            {
                var frame = new OrderingFrame
                {
                    Previous = Stack.FirstOrDefault(),
                    Type     = type,
                    Strength = strength
                };

                if (frame.Previous != null &&
                    frame.Previous.Type != null &&
                    frame.Previous.Type != frame.Type)
                {
                    StrengthKind priorStrength;
                    if (!frame.Previous.Type.Requires.TryGetValue(type, out priorStrength) ||
                        priorStrength < strength)
                    {
                        frame.Previous.Type.Requires[type] = strength;
                    }
                }

                if (Ordered.Contains(type) || frame.IsPrevented())
                {
                    return;
                }

                Stack.Push(frame);
                type.SymbolUsage(ShallowUsage, DeepUsage);
                if (!Ordered.Contains(type))
                {
                    Ordered.Add(type);
                }
                Stack.Pop();
            }
Ejemplo n.º 2
0
 public EmbeddedMetadataReference(TypeCompilationContext context)
     : base(context.AssemblyName, context.RealOrShallowReference())
 {
     using (var ms = new MemoryStream((int)context.OutputStream.Length))
     {
         // This stream is always seekable
         context.OutputStream.Position = 0;
         context.OutputStream.CopyTo(ms);
         Contents = ms.ToArray();
     }
 }
 public EmbeddedMetadataReference(TypeCompilationContext context)
     : base(context.AssemblyName, context.RealOrShallowReference())
 {
     Contents = new byte[context.OutputBytes.Length];
     Array.Copy(context.OutputBytes, Contents, context.OutputBytes.Length);
 }