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 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();
            }