internal MSCorLib()
     : base("mscorlib")
 {
     classes.Add(new SystemClass(this, PrimitiveType.Void));
     classes.Add(new SystemClass(this, PrimitiveType.Boolean));
     classes.Add(new SystemClass(this, PrimitiveType.Char));
     classes.Add(new SystemClass(this, PrimitiveType.Int8));
     classes.Add(new SystemClass(this, PrimitiveType.UInt8));
     classes.Add(new SystemClass(this, PrimitiveType.Int16));
     classes.Add(new SystemClass(this, PrimitiveType.UInt16));
     classes.Add(new SystemClass(this, PrimitiveType.Int32));
     classes.Add(new SystemClass(this, PrimitiveType.UInt32));
     classes.Add(new SystemClass(this, PrimitiveType.Int64));
     classes.Add(new SystemClass(this, PrimitiveType.UInt64));
     classes.Add(new SystemClass(this, PrimitiveType.Float32));
     classes.Add(new SystemClass(this, PrimitiveType.Float64));
     classes.Add(new SystemClass(this, PrimitiveType.IntPtr));
     classes.Add(new SystemClass(this, PrimitiveType.UIntPtr));
     classes.Add(new SystemClass(this, PrimitiveType.String));
     classes.Add(new SystemClass(this, PrimitiveType.TypedRef));
     ObjectClass = new SystemClass(this, PrimitiveType.Object);
     classes.Add(ObjectClass);
     valueType = new ClassRef(this, "System", "ValueType");
     valueType.MakeValueClass();
     classes.Add(valueType);
 }
        /// <summary>
        /// Add a value class to this scope.  If the class already exists,
        /// throw an exception.
        /// </summary>
        /// <param name="nsName">name space name</param>
        /// <param name="name">class name</param>
        /// <returns></returns>
        public virtual ClassRef AddValueClass(string nsName, string name)
        {
            Contract.Requires(nsName != null);
            Contract.Requires(name != null);
            ClassRef aClass = AddClass(nsName, name);

            aClass.MakeValueClass();
            return(aClass);
        }
        /*------------------------- public set and get methods --------------------------*/


        /// <summary>
        /// Add a class which is declared public in this external module of
        /// THIS assembly.  This class will be exported from this assembly.
        /// The ilasm syntax for this is .extern class
        /// </summary>
        /// <param name="attrSet">attributes of the class to be exported</param>
        /// <param name="nsName">name space name</param>
        /// <param name="name">external class name</param>
        /// <param name="declFile">the file where the class is declared</param>
        /// <param name="isValueClass">is this class a value type?</param>
        /// <returns>a descriptor for this external class</returns>
        public ClassRef AddExternClass(TypeAttr attrSet, string nsName,
                                       string name, bool isValueClass, PEFile pefile)
        {
            Contract.Requires(nsName != null);
            Contract.Requires(name != null);
            Contract.Requires(pefile != null);
            ClassRef cRef = new ClassRef(this, nsName, name);

            if (isValueClass)
            {
                cRef.MakeValueClass();
            }
            ExternClass eClass = new ExternClass(attrSet, nsName, name, modFile);

            exportedClasses.Add(eClass);
            cRef.SetExternClass(eClass);
            classes.Add(cRef);
            return(cRef);
        }
Exemple #4
0
 internal MSCorLib()
     : base("mscorlib")
 {
     classes.Add(new SystemClass(this, PrimitiveType.Void));
     classes.Add(new SystemClass(this, PrimitiveType.Boolean));
     classes.Add(new SystemClass(this, PrimitiveType.Char));
     classes.Add(new SystemClass(this, PrimitiveType.Int8));
     classes.Add(new SystemClass(this, PrimitiveType.UInt8));
     classes.Add(new SystemClass(this, PrimitiveType.Int16));
     classes.Add(new SystemClass(this, PrimitiveType.UInt16));
     classes.Add(new SystemClass(this, PrimitiveType.Int32));
     classes.Add(new SystemClass(this, PrimitiveType.UInt32));
     classes.Add(new SystemClass(this, PrimitiveType.Int64));
     classes.Add(new SystemClass(this, PrimitiveType.UInt64));
     classes.Add(new SystemClass(this, PrimitiveType.Float32));
     classes.Add(new SystemClass(this, PrimitiveType.Float64));
     classes.Add(new SystemClass(this, PrimitiveType.IntPtr));
     classes.Add(new SystemClass(this, PrimitiveType.UIntPtr));
     classes.Add(new SystemClass(this, PrimitiveType.String));
     classes.Add(new SystemClass(this, PrimitiveType.TypedRef));
     ObjectClass = new SystemClass(this, PrimitiveType.Object);
     classes.Add(ObjectClass);
     valueType = new ClassRef(this, "System", "ValueType");
     valueType.MakeValueClass();
     classes.Add(valueType);
 }
Exemple #5
0
 /*------------------------- public set and get methods --------------------------*/
 /// <summary>
 /// Add a class which is declared public in this external module of
 /// THIS assembly.  This class will be exported from this assembly.
 /// The ilasm syntax for this is .extern class
 /// </summary>
 /// <param name="attrSet">attributes of the class to be exported</param>
 /// <param name="nsName">name space name</param>
 /// <param name="name">external class name</param>
 /// <param name="declFile">the file where the class is declared</param>
 /// <param name="isValueClass">is this class a value type?</param>
 /// <returns>a descriptor for this external class</returns>
 public ClassRef AddExternClass(TypeAttr attrSet, string nsName,
     string name, bool isValueClass, PEFile pefile)
 {
     Contract.Requires(nsName != null);
     Contract.Requires(name != null);
     Contract.Requires(pefile != null);
     ClassRef cRef = new ClassRef(this, nsName, name);
     if (isValueClass) cRef.MakeValueClass();
     ExternClass eClass = new ExternClass(attrSet, nsName, name, modFile);
     exportedClasses.Add(eClass);
     cRef.SetExternClass(eClass);
     classes.Add(cRef);
     return cRef;
 }