Ejemplo n.º 1
0
        public NameInfo Lookup(ErrorCollector collector, IEnumerable <string> names)
        {
            IEnumerator <string> enumerator = names.GetEnumerator();

            if (!enumerator.MoveNext())
            {
                throw new ArgumentOutOfRangeException("List of names cannot be empty.");
            }
            if (Children.ContainsKey(enumerator.Current))
            {
                if (Children[enumerator.Current] == null)
                {
                    collector.ReportForbiddenNameAccess(this, enumerator.Current);
                    return(new JunkInfo());
                }
                return(Children[enumerator.Current].Lookup(collector, enumerator));
            }
            if (ForceBack)
            {
                Parent.Lookup(collector, names);
            }
            if (Parent != null && Parent.HasName(enumerator.Current))
            {
                return(Lookback(enumerator.Current).Lookup(collector, enumerator));
            }
            var info = new OpenNameInfo(this, enumerator.Current);

            Children[enumerator.Current] = info;
            return(info.Lookup(collector, enumerator));
        }
Ejemplo n.º 2
0
 public override void CreateChild(ErrorCollector collector, string name, string root, ref bool success)
 {
     if (ForceBack)
     {
         Source.CreateChild(collector, name, root, ref success);
     }
     if (Source.HasName(name))
     {
         Children[name] = new CopyFromParentInfo(Environment, root + "." + name, Source.Lookup(collector, name, ref success), ForceBack);
     }
     else
     {
         Children[name] = new OpenNameInfo(Environment, root + "." + name);
     }
 }
Ejemplo n.º 3
0
 public override void CreateChild(ErrorCollector collector, string name, string root, ref bool success)
 {
     Children[name] = new OpenNameInfo(Environment, root + "." + name);
 }
Ejemplo n.º 4
0
 public NameInfo AddFreeName(string name)
 {
     return(Children[name] = new OpenNameInfo(this, name));
 }