public class ClassDef : Class {
Class superType;
+ bool setSuperType;
ArrayList fields = new ArrayList();
ArrayList methods = new ArrayList();
ArrayList events;
MetaData md) : base(nsName, name, md)
{
metaData = md;
- if (! ((nsName == "" && name == "<Module>") || (nsName == "System" && name == "Object")) ) {
- superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
- }
flags = (uint)attrSet;
tabIx = MDTable.TypeDef;
}
internal void SetSuper(Class sClass)
{
superType = sClass;
+ setSuperType = true;
if (! (sClass is GenericTypeInst))
typeIndexChecked = false;
}
else
superType = metaData.mscorlib.ValueType();
+ setSuperType = true;
typeIndex = PrimitiveType.ValueType.GetTypeIndex ();
}
public void SpecialNoSuper()
{
- superType = null;
+ setSuperType = true;
}
/// <summary>
internal sealed override void BuildTables(MetaData md)
{
- if (done) return;
- if ((flags & (uint)TypeAttr.Interface) != 0) { superType = null; }
+ if (done)
+ return;
+
+ if ((flags & (uint)TypeAttr.Interface) != 0) {
+ superType = null;
+ setSuperType = true;
+ }
// Console.WriteLine("Building tables for " + name);
if (layout != null) md.AddToTable(MDTable.ClassLayout,layout);
// Console.WriteLine("adding methods " + methods.Count);
((Property)properties[0]).Row,MDTable.Property));
}
// Console.WriteLine("End of building tables");
+
+ if (!setSuperType)
+ superType = metaData.mscorlib.GetSpecialSystemClass(PrimitiveType.Object);
+
done = true;
}
private byte heapSizes = 0;
MetaDataElement entryPoint;
BinaryWriter output;
- public MSCorLib mscorlib;
+ MSCorLib _mscorlib;
private TypeSpec[] systemTypeSpecs = new TypeSpec[PrimitiveType.NumSystemTypes];
long mdStart;
private ArrayList cattr_list;
for (int i=0; i < lgeCIx.Length; i++) {
lgeCIx[i] = false;
}
- mscorlib = new MSCorLib(this);
}
+ public MSCorLib mscorlib {
+ get {
+ return _mscorlib ?? (_mscorlib = new MSCorLib (this));
+ }
+ }
+
+
internal TypeSpec GetPrimitiveTypeSpec(int ix)
{
return systemTypeSpecs[ix];