Пример #1
0
        /// <summary>
        /// Add a class to this Scope.  If this class already exists, throw
        /// an exception
        /// </summary>
        /// <param name="newClass">The class to be added</param>
        public void AddClass(ClassRef newClass)
        {
            Contract.Requires(newClass != null);
            ClassRef aClass = (ClassRef)GetClass(newClass.NameSpace, newClass.Name, true);

            if (aClass != null)
            {
                throw new DescriptorException("Class " + newClass.NameString());
            }
            if (Diag.DiagOn)
            {
                Console.WriteLine("Adding class " + newClass.Name + " to ResolutionScope " + name);
            }
            classes.Add(newClass);
            // Change Refs to Defs here
            newClass.SetScope(this);
        }
Пример #2
0
 /// <summary>
 /// Add a class to this Scope.  If this class already exists, throw
 /// an exception
 /// </summary>
 /// <param name="newClass">The class to be added</param>
 public void AddClass(ClassRef newClass)
 {
     Contract.Requires(newClass != null);
     ClassRef aClass = (ClassRef)GetClass(newClass.NameSpace, newClass.Name, true);
     if (aClass != null)
         throw new DescriptorException("Class " + newClass.NameString());
     if (Diag.DiagOn) Console.WriteLine("Adding class " + newClass.Name + " to ResolutionScope " + name);
     classes.Add(newClass);
     // Change Refs to Defs here
     newClass.SetScope(this);
 }